Numerical Methods for Engineers
Numerical Methods for Engineers
7th Edition
ISBN: 9780073397924
Author: Steven C. Chapra Dr., Raymond P. Canale
Publisher: McGraw-Hill Education
bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 14P

Two distances are required to specify the location of a point relative to an origin in two-dimensional space (Fig. P2.14):

The horizontal and vertical distances ( x ,   y ) inCartesian coordinates

The radius and angle ( r ,   θ ) in radial coordinates.

Chapter 2, Problem 14P, 2.14	Two distances are required to specify the location of a point relative to an origin in

FIGURE P2.14

It is relatively straight forward to compute Cartesian coordinates ( x ,   y ) on the basis of polar coordinates ( r ,   θ ) . The reverseprocess is not so simple. The radius can be computed by the following formula:

r = x 2 + y 2

If the coordinates lie within the first and fourth coordinates ( i .e . ,   x > 0 ) , then a simple formula can be used to compute θ

θ = tan 1 ( y x )

The difficulty arises for the other cases. The following table summarizes the possibilities:

x Y θ
< 0 >0 tan 1 ( y / x ) + π
< 0 < 0 tan 1 ( y / x ) π
< 0 = 0 π
= 0 >0 π / 2
= 0 < 0 π / 2
= 0 = 0 0

(a) Write a well-structured flowchart for a subroutine procedure to calculate r and θ as a function of x and y. Express the finalresults for θ in degrees.

(b) Write a well-structured function procedure based on your flowchart. Test your program by using it to fill out the following table:

x Y r θ
1 0
1 1
0 1
–1 1
–1 0
–1 –1
0 –1
1 –1
0 0

(a)

Expert Solution
Check Mark
To determine

A well-structured flowchart for a subordinate procedure to calculate r and θ as a function of x and y for the table given below, if two distances are required to specify the location of a point relative to an origin in two-dimensional space.

xyθ<0>0tan1(y/x)+π<0<0tan1(y/x)π<0=0π=0>0π/2=0<0π/2=0=00

Answer to Problem 14P

Solution:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  1

Explanation of Solution

Given Information:

To specify the location of a point relative to origin, cartesian coordinates (x,y) and polar coordinates (r,θ) are used.

Cartesian coordinates can be easily computed from the polar coordinates.

Polar coordinates are computed as follows:

r=x2+y2,θ=tan1(yx)

Formula used:

Calculation:

The flowchart for converting from Cartesian to polar coordinates is as follows

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  2

(b)

Expert Solution
Check Mark
To determine

A well-structured function procedure based on flowchart of part (a) if two distances are required to specify the location of a point relative to an origin in two-dimensional space. Also, test the program by filling the table given below:

xyrθ101101111011011100

Answer to Problem 14P

Solution:

The values of r and θ corresponding to provided x and y are:

xyrθ1010111.41424501190111.4142135101180111.41421350111111.4142450000

Explanation of Solution

Given Information:

To specify the location of a point relative to origin, cartesian coordinates (x,y) and polar coordinates (r,θ) are used.

Cartesian coordinates can be easily computed from the polar coordinates.

Polar coordinates are computed as follows:

r=x2+y2,θ=tan1(yx)

Calculation:

The MATLAB program for converting Cartesian to polar coordinates is as follows:

% Define a function polar()

function polar(x, y)

% Formula to calculate r

r = sqrt (x.^ 2+ y.^ 2);

if x > 0

% Formula to calculate theta

th= atan(y/ x);

elseif x < 0

% Use for loop to check the condition

if y > 0

th= atan(y / x)+ pi;

elseif y < 0

th= atan(y / x)- pi;

else

th= pi;

end

else

if y > 0

th= pi / 2;

elseif y < 0

th=- pi / 2;

else

th= 0;

end

end

theta = th* 180 / pi;

% Display the polar coordinates

fprintf('r = %4.4f theta = %4.2f\n',r,theta);

Now, to test the program use the following command.

First find polar coordinates for x=1,y=0.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  3

Now, for polar coordinates for x=1,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  4

Now, for polar coordinates for x=0,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  5

Now, forpolar coordinates for x=1,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  6

Now, forpolar coordinates for x=1,y=0.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  7

Now, forpolar coordinates for x=1,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  8

Now, forpolar coordinates for x=0,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  9

Now, forpolar coordinates for x=1,y=1.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  10

Now, forpolar coordinates for x=0,y=0.

OUTPUT:

Numerical Methods for Engineers, Chapter 2, Problem 14P , additional homework tip  11

Hence, the values of r and θ corresponding to provided x and y are:

xyrθ1010111.41424501190111.4142135101180111.41421350111111.4142450000

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!

Chapter 2 Solutions

Numerical Methods for Engineers

Knowledge Booster
Background pattern image
Advanced Math
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, advanced-math and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Algebra & Trigonometry with Analytic Geometry
Algebra
ISBN:9781133382119
Author:Swokowski
Publisher:Cengage
Text book image
Trigonometry (MindTap Course List)
Trigonometry
ISBN:9781337278461
Author:Ron Larson
Publisher:Cengage Learning
Chain Rule dy:dx = dy:du*du:dx; Author: Robert Cappetta;https://www.youtube.com/watch?v=IUYniALwbHs;License: Standard YouTube License, CC-BY
CHAIN RULE Part 1; Author: Btech Maths Hub;https://www.youtube.com/watch?v=TIAw6AJ_5Po;License: Standard YouTube License, CC-BY