2
$\begingroup$

I need to find all the roots of this function. I know it is simple to find by hand, however, I wish to learn how to do it so I can apply it later. The problem is that it only gives me one root.

Distance[t_] := t*(t - 1)*(t - 1.5)^2*(t - 3)
Velocity[t_] := Simplify[Distance'[t]]
FindRoot[Velocity[t], {t, -100, 100}]

{t -> 2.63641}

I can find the minimum and maximum. However, how would I plot them on the same graph as the function without copy and pasting the points manually into a list?

$\endgroup$
2
  • 3
    $\begingroup$ Any reason you can't just use Solve[Velocity[t] == 0, t]? $\endgroup$
    – Andy Ross
    Nov 14, 2012 at 22:21
  • $\begingroup$ Gah! You might as well close the question now. $\endgroup$ Nov 14, 2012 at 22:32

1 Answer 1

6
$\begingroup$

As Andy said, you can simply use

solutions = Solve[velocity[t] == 0, t]

to find the extrema: {{t -> 0.291169}, {t -> 1.17242}, {t -> 1.5}, {t -> 2.63641}}

To answer the second part of your question:

However, how would I plot them on the same graph as the function without copy and pasting the points manually into a list?

You can use Show to draw multiple plots or graphics in the same coordinate system:

Show[
 Plot[distance[t], {t, 0, 3}],
 Graphics[{Red, PointSize[Large], 
   Point[{t, distance[t]} /. solutions]}]]

Result:

Mathematica graphics

$\endgroup$
2
  • $\begingroup$ You could also use Epilog to plot the points. $\endgroup$
    – wxffles
    Nov 14, 2012 at 23:06
  • $\begingroup$ Thank you so much. When I find the maximum and minimum, I'll just define it as a variable. $\endgroup$ Nov 15, 2012 at 0:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.