next up previous
Next: Solution methods 5 and Up: Solving equations Previous: Pasting plots into worksheets

Solution methods 3 and 4

For this part of the lab, load the worksheet

/usr7/bfarr/Maple/solve2.ms
which is based on the second worksheet from the previous lab. Once you've loaded the worksheet, execute all the commands up to and including the plot command. Then go the the next command, which should be the following, and execute it.
  > solve(subs(par_vals2,x(t_hit[2])) = 30,theta);

You shouldn't have gotten any output from this command. This means that Maple couldn't figure out how to solve this equation. This is rather surprising, since this is the same equation that Maple was able to solve before. What is even more surprising is that Maple can solve this equation if we replace 30 with the nearby values 29.9 and 30.1. (You should try these values yourself.) The reason is that solving equations is very hard to program, and our value of 30 seems to have uncovered a slight bug in Maple.

There are equations, however, that the solve command will never be able to solve, no matter how sophisticated the programming becomes. Some equations just can't be solved analytically. Fortunately, such equations can often be solved numerically with the Maple fsolve command. The syntax of the fsolve command is very similar to that of the solve command, but there is an optional third argument that can be used to tell Maple where to look for the solution. See the three commands below.

  > fsolve(subs(par_vals2,x(t_hit[2])) = 30,theta);

displaymath367

  > fsolve(subs(par_vals2,x(t_hit[2])) = 30,theta,theta=0.5..0.7);

displaymath368

  > fsolve(subs(par_vals2,x(t_hit[2])) = 30,theta,theta=0.8..1.2);

displaymath331

The first command gives an answer, but it isn't one we want. In the next two commands, a range is specified and Maple looks for a solution inside the range.

The fsolve command generally works pretty well, but you have to be aware of the following points.


next up previous
Next: Solution methods 5 and Up: Solving equations Previous: Pasting plots into worksheets

Sean O Anderson
Tue Sep 10 11:45:07 EDT 1996