Docsity

Introduction to Computational Methods: Homework Set 4 - Prof. E. Cliff, Assignments of Engineering

Toggle sidebar
bg1
AOE/ESM 2074
Introduction to Computational Methods
H.W. Set 4
due 20 September 2000
1. Read Chapter 5 through page 183 in the Chapman text.
2. Write a Matlab script to evaluate the Maclaurin series approximation of tan(x), the
tangent of x. The code should ask the user to specify a value of xand a tolerance and
then evaluate the partial sum until the next term (the first one not included) is less
than the specified value. Compare the series approximation to the value provided the
Matlab tan function.
Turn in a listing of your command script and the diary from exercising the code for
x=0.2,tol=.0001.
3. Generalize the random walk code so that it will repeat the entire walk sequence for a
user specified number of times (say m= 500). Compute the probablity that the sailor
falls of the pier of length 15 in 1000 steps for the coin-toss probablility parameter
p=.5. Repeat the calculation for several values of the pier length parameter. Draw a
graph of the fall-off probablity versus the pier length and estimate the value of length
so that there is about a 50% chance of falling off the pier.
Turn in the listing of your script file, including ā€˜comments’, and a well-labeled graph.
Annotate the graph to distinguish the value of the length parameter for which there is
a 50% chance of falling off the pier.
4. Write a Matlab function .m file to convert from plane Cartesian (x, y) to plane polar
(r, Īø)coordinates.
Turn in a listing of your function and a diary illustrating the use of your code for
the point (1,2).
5. Write a Matlab function .m file to convert from Cartesian (x, y, z) to spherical polar
coordinates (r, Īø, φ), where φis the co-latitude, the angle between the positive z-axis
and the radial vector to the point.
Turn in a listing of your function and a diary illustrating the use of your code for
the point (1,2,2).
1

Partial preview of the text

Download Introduction to Computational Methods: Homework Set 4 - Prof. E. Cliff and more Assignments Engineering in PDF only on Docsity!

AOE/ESM 2074

Introduction to Computational Methods

H.W. Set 4

due 20 September 2000

  1. Read Chapter 5 through page 183 in the Chapman text.
  2. Write a Matlab script to evaluate the Maclaurin series approximation of tan(x),the tangent of x. The code should ask the user to specify a value of x and a tolerance and then evaluate the partial sum until the next term (the first one not included) is less than the specified value. Compare the series approximation to the value provided the Matlab tan function. Turn in a listing of your command script and the diary from exercising the code for x = 0. 2 , tol = .0001.
  3. Generalize the random walk code so that it will repeat the entire walk sequence for a user specified number of times (say m = 500). Compute the probablity that the sailor falls of the pier of length 15 in 1000 steps for the coin-toss probablility parameter p = .5. Repeat the calculation for several values of the pier length parameter. Draw a graph of the fall-off probablity versus the pier length and estimate the value of length so that there is about a 50% chance of falling off the pier. Turn in the listing of your script file,including ā€˜comments’,and a well-labeled graph. Annotate the graph to distinguish the value of the length parameter for which there is a 50% chance of falling off the pier.
  4. Write a Matlab function .m file to convert from plane Cartesian (x, y) to plane polar (r, Īø) coordinates. Turn in a listing of your function and a diary illustrating the use of your code for the point (1, 2).
  5. Write a Matlab function .m file to convert from Cartesian (x, y, z) to spherical polar coordinates (r, Īø, φ),where φ is the co-latitude,the angle between the positive z-axis and the radial vector to the point. Turn in a listing of your function and a diary illustrating the use of your code for the point (1, 2 , 2).