I have a function that describes temperature throughout space, and a heat seeking particle that starts at a point and ﬂies along the gradient to this function. I had to solve for the coordinates of the point when it was 5 units away from the origin. This problem was one that I had in my Math class, and I ended up solving it as shown below using brute force, which was what we were supposed to do. The function is T=1/2*x^2*y-x*z+x+y, and the initial starting point is (1,0,2). I was wondering if anyone could help me out, in solving this problem exactly, or if there is anyway that I could optimize the current while loop that I have so that it would run faster, and therefore calculate the resultant point more accurately. I am using Maple V r4 to do this:
The following execuation loops determines the location of the particle when it is 5 units away from the origin. The accuracy of this result is determined by setting the err variable in the initial line. Digits are set to 20 to minimize roundoﬀ error during the calculation.
Initilize variables so no errors returned
I am look at the current point, and taking the gradient vector, and taking a very small step in that direction. and evaluating the new point to check if it is more than 5 units away from the origin. I believe that I am doing this right, but it takes a very long time to solve, when err < .001 (like > 10 min). And as err > the time increases very rapidly. I’m running the Windows version of MapleVr4, on a PII 400, running Win98 (just in case that is important).
Consider the system of diﬀerential equations
dp/dt = grad(T(p)) where p = [x,y,z]. This describes a particle moving so that its velocity is equal to the gradient vector. It's more convenient for your purposes, however, to write p as a function of r (the distance from 0). By the Chain Rule, dp/dr = (dp/dt)/(dr/dt) = (grad(T(p)))/(p . grad(T(p))/r) = r grad(T(p))/(p . grad(T(p)))
You have the initial condition p(sqrt(5)) = [1,0,2], and you want to ﬁnd p(5). It’s unlikely that there would be an exact ”closed-form” solution, but Maple can do it numerically.