0

Manipulate is a fantastic feature of Mathematica. However, I face a weird thing. When I intend to plot height[t], and manipulate height[t] with M, the plot does not change! Also how can I put height[t] inside Manipulate part of the code. It is too long in the way below. If I just put height[t], it did not recognise M and g I think. Anyway the manipulation with g manipulation works but with M not.

κ = 1;
b = 0.4;
Γ = 0.2;
h[0] = κ*b*(1 - b);
θ[0] = κ*(1 - 2*b);
h[2] = 1/2*(1/2 - M*g + 
     8*κ^2*(h[0] + (1 - b)*θ[0])^2*(κ^2 + 
         3*θ[0]^2)/(3*(κ^2 - θ[0]^2)^3));


height[t_] := h[0] + t^2*h[2];

Manipulate[
 Plot[ h[0] + 
   t^2*(1/2*(1/2 - M*g + 
        8*κ^2*(h[0] + (1 - b)*θ[0])^2*(κ^2 + 
            3*θ[0]^2)/(3*(κ^2 - θ[0]^2)^3))), {t,
    0, 0.1}, Filling -> filling, PlotRange -> Automatic], {M, 0, 
  1}, {g, 0, 
  2}, {filling, {None, 2, 1.5, 1, 0.5, 
   0, -0.5, -1, -1.5, -2}}, {filling, -2, 2}]
Kuba
  • 136,707
  • 13
  • 279
  • 740
Meva
  • 223
  • 2
  • 8
  • Manipulate scopes controllers' variables. – Kuba Oct 12 '16 at 06:38
  • Try adding /. {M -> m, g -> G} in the plot function, then Manipulate[] over m, G. Or make sure h[] takes M and G. – Feyre Oct 12 '16 at 08:25
  • @Feyre, I could not have capital letters in my function as it would crash with mathematica's built-in functions in its library. – Meva Oct 12 '16 at 09:57
  • I merely explained the possible solutions, you can use different variables, but these worked fine for me. – Feyre Oct 12 '16 at 12:19

0 Answers0