Skip to main content
Added inputfield
Source Link
Feyre
  • 8.7k
  • 2
  • 29
  • 48

There's no need for all this dynamic stuff, you can use Solve[] in conjunction with Manipulate[], and let Manipulate[] handle the dynamic stuff.

Manipulate[
 h = x /. Quiet@
    Solve[2 == 
       x*Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], x, 
      Reals][[1]]; 
 Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, 
    PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, 
    AxesOrigin -> {0, 0}], 
   ParametricPlot[{x*
       Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], 
     x*Sin[θ] + (p*x^2)/(6*c*d) (3 f + x) Cos[θ] + 
      h*Sin[θ] + (p*h^2)/(6*c*d) (3 f + h) Cos[θ] + 
      i}, {x, 0, h}, Axes -> True]}], {ρ, 0, 1, 0.1}, {c, 0.2, 2,
   0.2}, {d, 0.2, 2, 0.2}, {f, 0, 2, 0.2}, {p, 0, 2, 0.2}, {θ, 
  0, π, 0.1 π}, {i, -2, 2, 0.5}],ControlType -> InputField]

There's no need for all this dynamic stuff, you can use Solve[] in conjunction with Manipulate[], and let Manipulate[] handle the dynamic stuff.

Manipulate[
 h = x /. Quiet@
    Solve[2 == 
       x*Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], x, 
      Reals][[1]]; 
 Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, 
    PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, 
    AxesOrigin -> {0, 0}], 
   ParametricPlot[{x*
       Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], 
     x*Sin[θ] + (p*x^2)/(6*c*d) (3 f + x) Cos[θ] + 
      h*Sin[θ] + (p*h^2)/(6*c*d) (3 f + h) Cos[θ] + 
      i}, {x, 0, h}, Axes -> True]}], {ρ, 0, 1, 0.1}, {c, 0.2, 2,
   0.2}, {d, 0.2, 2, 0.2}, {f, 0, 2, 0.2}, {p, 0, 2, 0.2}, {θ, 
  0, π, 0.1 π}, {i, -2, 2, 0.5}]

There's no need for all this dynamic stuff, you can use Solve[] in conjunction with Manipulate[], and let Manipulate[] handle the dynamic stuff.

Manipulate[
 h = x /. Quiet@
    Solve[2 == 
       x*Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], x, 
      Reals][[1]]; 
 Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, 
    PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, 
    AxesOrigin -> {0, 0}], 
   ParametricPlot[{x*
       Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], 
     x*Sin[θ] + (p*x^2)/(6*c*d) (3 f + x) Cos[θ] + 
      h*Sin[θ] + (p*h^2)/(6*c*d) (3 f + h) Cos[θ] + 
      i}, {x, 0, h}, Axes -> True]}], {ρ, 0, 1, 0.1}, {c, 0.2, 2,
   0.2}, {d, 0.2, 2, 0.2}, {f, 0, 2, 0.2}, {p, 0, 2, 0.2}, {θ, 
  0, π, 0.1 π}, {i, -2, 2, 0.5},ControlType -> InputField]
Source Link
Feyre
  • 8.7k
  • 2
  • 29
  • 48

There's no need for all this dynamic stuff, you can use Solve[] in conjunction with Manipulate[], and let Manipulate[] handle the dynamic stuff.

Manipulate[
 h = x /. Quiet@
    Solve[2 == 
       x*Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], x, 
      Reals][[1]]; 
 Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, 
    PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, 
    AxesOrigin -> {0, 0}], 
   ParametricPlot[{x*
       Cos[θ] - (p*x^2)/(6*c*d) (3 f + x) Sin[θ], 
     x*Sin[θ] + (p*x^2)/(6*c*d) (3 f + x) Cos[θ] + 
      h*Sin[θ] + (p*h^2)/(6*c*d) (3 f + h) Cos[θ] + 
      i}, {x, 0, h}, Axes -> True]}], {ρ, 0, 1, 0.1}, {c, 0.2, 2,
   0.2}, {d, 0.2, 2, 0.2}, {f, 0, 2, 0.2}, {p, 0, 2, 0.2}, {θ, 
  0, π, 0.1 π}, {i, -2, 2, 0.5}]