Name: Sally (email_not_shown)
Date: 03/05/05-01:41:52 PM Z


Hi
I was wondering if you could help me with this problem:
"An arrow is shot upward from the origin with an initial velocity of 300 ft/sec. Assume that there is no air resistance and use the model:
m(dv/dt)=-mg
Find the maximum height, and the impact velocity (with the Runge-Kutta method) using Mathematica.
(note: g=32)"

I cant seem to get the right answer (maximum height=1406.25), for this problem, that i have gotten earlier using analytical methods.

CODE SO FAR:
ClearAll[x, y, f, g, v]
n = 10; g = 32; a = 0; b = 1.0; maxi = 0;
h = (b-a)/n; x = a; Y = 1;
f[x_,y_] = -g
Do[{ h = (b-a)/n,
k1 = h*f[x,Y], k2 = h*f[x+h/2,Y+k1/2],
k3 = h*f[x+h/2,Y+k2/2], k4 = h*f[x+h,Y+k1],
Y = Y + (1/6)(k1+2k2+2k3+k4), x = x+h,
Print[" y(",x,")", Y], If[Y > maxi, maxi = Y]}, {i, 1, n}]
Print["The maximum height is ", maxi]

Note: the answers i get from this program are negative numbers, which are obviously incorrect



This archive was generated by hypermail 2b29 : 09/04/20-12:55:05 AM Z CEST