On the 7th line, I have an InputField that I want to dynamically change as I change the input. It solves an equation that is later used to determine the change in y intercept in the graph. However, the value (h) doesn't change as I change the other values. What am I doing wrong here?
I included a picture here. When I change the values in yellow, they should change the value in blue.
Manipulate[
DynamicModule[{p = 0, c = 1, d = 1, f = 0, \[Theta] = 0, i = 1, j = 1, k = 2}, Deploy[Style[
Panel[Grid[Transpose[{{"P", "C", "D", "F", "\[Theta]", "h", "height", "left", "right"},
{InputField[Dynamic[p]], InputField[Dynamic[c]],
InputField[Dynamic[d]], InputField[Dynamic[f]],
InputField[Dynamic[\[Theta]]],
InputField[Dynamic[h = x /.Solve[2 == x*Cos[\[Theta]] - (p*x^2)/(6*c*d) (3 f + x) Sin[\[Theta]], x, Reals][[1]]],
InputField[Dynamic[i]],
InputField[Dynamic[j]], InputField[Dynamic[k]]]}}],
Alignment -> Right], ImageMargins -> 10, DefaultOptions ->
{InputField -> {ContinuousAction -> True, FieldSize -> {{5, 30}, {1, Infinity}}}}]]] Dynamic[Show[
{Graphics[{Opacity[0.5], Red,
Rectangle[{1, 0}, {2, 1}]},
PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True,
AxesOrigin -> {0, 0}],
ParametricPlot[{x*Cos[\[Theta]] - (p*x^2)/(6*c*d) (3 f + x) Sin[\[Theta]],
x*Sin[\[Theta]] + (p*x^2)/(6*c*d) (3 f + x) Cos[\[Theta]] + h*Sin[\[Theta]] + (p*h^2)/(6*c*d) (3 f + h) Cos[\[Theta]] + i}, {x, 0, h}, Axes -> True]}]]]]
Thanks!
edit: small error in pasting
edit2: some changes, pasted below
Manipulate[h = x /. Quiet@Solve[2 == x*Cos[\[Theta]] - (p*x^2)/(6*c*d) (3 f + x) Sin[\[Theta]], x, Reals][[1]];
Text[h]
Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]},
PlotRange -> {{-1, 2}, {-3, 3}},
Axes -> True, AxesOrigin -> {0, 0}],
ParametricPlot[{x*Cos[\[Theta]] - (p*x^2)/(6*c*d) (3 f + x) Sin[\[Theta]],x*Sin[\[Theta]] + (p*x^2)/(6*c*d) (3 f + x) Cos[\[Theta]] + h*Sin[\[Theta]] + (p*h^2)/(6*c*d) (3 f + h) Cos[\[Theta]] + i},
{x, 0, h}, Axes -> True]}],
{p, 0.2, 2, ControlType -> InputField}, {c, 0.2, 2, ControlType -> InputField},
{d, 0.2, 2, ControlType -> InputField}, {f, 0.2, 2, ControlType -> InputField},
{\[Theta], 0, \[Pi], ControlType -> InputField}, {i, 0.2, 2, ControlType -> InputField},
{j, 0.2, 2, ControlType -> InputField}, {k, 0.2, 2, ControlType -> InputField},
{l, 0.2, 2, ControlType -> InputField}]
Manipulate[]
? $\endgroup$