2
$\begingroup$

I need to plot f(m) vs m the function

f(m) = t m^2 + c m^3 + u m^4

For different values of t, c, and u. For

f[x_] := x^4 + a*x^2

this can be done by using

Plot[Evaluate[Table[Labeled[f[x], a], {a, {1, 20, 100}}]], {x, 0, 3}]

How to generalize it for f(m)? Please help.

$\endgroup$
1
  • $\begingroup$ Huh? Why not merely plot $f(m)$ directly? $\endgroup$ Commented Apr 30, 2023 at 23:04

1 Answer 1

3
$\begingroup$

For different values of t, c, and u. For

If I understand you right, why not use Manipulate? This is exactly what it is designed for

enter image description here

code

Manipulate[ 
 Module[{m},
  Plot[t*m^2 + c*m^3 + u*m^4, {m, -extend, extend}, 
   GridLines -> Automatic, GridLinesStyle -> LightGray, 
   PlotStyle -> Red]
  ]
 ,
 {{extend, 3, "domain length"}, .1, 10, .1, Appearance -> "Labeled"},
 {{t, -88, "t"}, -200, 200, .1, Appearance -> "Labeled"},
 {{c, -54, "c"}, -100, 100, .1, Appearance -> "Labeled"},
 {{u, 3, "u"}, -100, 100, .1, Appearance -> "Labeled"},
 TrackedSymbols :> {extend, t, c, u}
 ]
$\endgroup$

Your Answer

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

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