I've posted before and I think (hopefully) I'm almost done. I want to make a program that models a cantilever bending on a box given parameters, like this:

enter image description here

I calculated the parametric equations (given a rotation) as:

x*Cos[θ] - (P*x^2)/(6*C*D) (3 F + x) Sin[θ]
x*Sin[θ] + (P*x^2)/(6*C*D) (3 F + x) Cos[θ]

where the first equation is x-coor and the second is y-coor. I confusingly used x as the parameter in the parametric equations.

B = 2;
  {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[θ] + 
      G}, {x, 0, B}, Axes -> True]}],
 {P, 0, 1},
 {{C, 1}, 0, 10},
 {{D, 1}, 0, 10},
 {F, 0, 10},
 {{θ, 0}, -2 π, 2 π},
 {{G, 0} , -3, 3},
 SaveDefinitions -> True]

enter image description here

Instead of slide bars, I want them to be InputFields. Further, I want adjustment of the Y axis to touch the corner of the box to be dynamic.

To find the parameter where the cantilever touches the box (corner at coordinates (a,b),

Solve[a == x*Cos[θ] - (P*x^2)/(6*C*D) (3 F + x) Sin[θ]] = c

Then, to find the needed adjustment to the y-component,

c*Sin[θ] + (P*c^2)/(6*C*D) (3 F + c) Cos[θ] -b = d

my idea is that this d is now the adjustment to the y-component of the parametric equation above. If this could be made dynamic, it would be great. I tried modifying the example application code from Wolfram.com to just output the values

DynamicModule[{a = 0, b = 0}, Deploy[Style[
         Transpose[{{Style["right side x-coor", Red], 
            Style["right side y-coor", Red],
            "value of x'", "y-shift"},
           {InputField[Dynamic[a], Number], 
            InputField[Dynamic[b], Number],
              Solve[a == x*Cos[θ] - (P*x^2)/(6*C*D) (3 F + x) Sin[θ]] = c],Enabled -> False], 
              c*Sin[θ] + (P*c^2)/(6*C*D) (3 F + c) Cos[θ] - b,Enabled -> False]}}],Alignment -> Right], ImageMargins -> 10, DefaultOptions -> {InputField -> {ContinuousAction -> True, FieldSize -> {{5, 30}, {1, Infinity}}}}]]]]

Obviously, it didn't work. Further, my attempts to make the plot dynamic did not work either. Perhaps I should be using Manipulate instead of Dynamic? I'm not sure. In either case, if someone could help me figure out how to get Dynamic to work with just outputting numbers and then how to get my plot inside as well (mostly the second part), that would be great.



closed as off-topic by Michael E2, MarcoB, user9660, Yves Klett, PlatoManiac Jul 8 '16 at 14:34

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, MarcoB, Community, Yves Klett, PlatoManiac
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Go to the docs for Manipulate and search for InputField. Several alternatives are described. $\endgroup$ – Michael E2 Jul 7 '16 at 21:55
  • $\begingroup$ Your DynamicModule code has unmatched delimiters ([, {, etc.). $\endgroup$ – Michael E2 Jul 7 '16 at 21:56

Referring to the Manipulate documentation, you can change your sliders to input fields by going from control {x,0,10} to {x,0}.

B = 2;
 Show[{Graphics[{Opacity[0.5], Red, Rectangle[{1, 0}, {2, 1}]}, 
    PlotRange -> {{-1, 2}, {-3, 3}}, Axes -> True, 
    AxesOrigin -> {0, 0}], 
       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]] + 
      G}, {x, 0, B}, Axes -> True]}], {P, 0}, {C, 1}, {D, 1}, {F, 
  0}, {\[Theta], 0}, {G, 0}, SaveDefinitions -> True]
  • $\begingroup$ I didn't have the reputation to say this above, but I do not entirely understand your second question! Clarifying it would be appreciated. $\endgroup$ – user6014 Jul 7 '16 at 21:04

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