Hello,
I am developing a toy application to teach me how to generate a more complex CDF app. The current toy app is taking integral.
Manipulate[
DynamicModule[{f = Sin[x], xR = 1, xL = 0, Res = 0.4596976941},
Column[{ InputField[Dynamic[xL], Number],
InputField[Dynamic[xR], Number], InputField[Dynamic[f]],
Button["Calculate",
Dynamic[Res =
NumberForm[
NIntegrate[f, {x, xL, xR}, WorkingPrecision -> nw], np];]],
InputField[Dynamic[Res]],
Dynamic[If[fp == True, Plot[f, {x, xL, xR}]]]}]], {{np, 10,
"NumberFormat"}, 10, 30, 1}, {{nw, 16, "WorkingPrecision"}, 10,
30, 1}, {{fp, True, "Plot the function"}, {False, True},
Checkbox}]
But there are couple of problems that I am trying to solve.
-
I would like to have name tags on the left or top of each input fields. FieldHint does not work.
Manipulate[ DynamicModule[{f, xR, xL, Res}, Column[{ InputField[Dynamic[xL], Number, FieldHint -> "Lower Limit"], InputField[Dynamic[xR], Number, FieldHint -> "Upper Limit"], InputField[Dynamic[f], FieldHint -> "Function"], InputField[Dynamic[Res], FieldHint -> "Result"], Button["Calculate", Dynamic[Res = NumberForm[ NIntegrate[f, {x, xL, xR}, WorkingPrecision -> nw], np];]], Dynamic[If[fp == True, Plot[f, {x, xL, xR}]]]}]], {{np, 10, "NumberFormat"}, 10, 30, 1}, {{nw, 16, "WorkingPrecision"}, 10, 30, 1}, {{fp, False, "Plot the function"}, {False, True}, Checkbox}]
There is no problem with Lower and Upper Limit in here but I don’t know why I don’t get “Function” and “Result”
And to be honest I prefer to have the name tags with an example calculation.
- I tried to make the plotting also part of the push button but it is not working (I simply moved the ] of Button to the end of the plotting). Also when I dont have the plot I have a string “Null” which I don’t like. Is there a way of getting rid off that? And how can I make the size of the plot bigger?
- The last thing I could not figure it out is to limit xL and xR inputs to a number. I specified in the inputfield that the input is number but when I enter I get an error but I thought it supposed to simply not update (according to help document “The input field will not be updated if the input is not of the specified type”)
Thank you for the help. As I said I am trying to create a more complex app and this app is helping me to learn, Thank you for the help


