0
|
6250 Views
|
|
0 Total Likes
View groups...
Share
GROUPS:

# Defining a function f[x_] := from InputField (How??)

Posted 10 years ago
 I just started using Mathematica in February, learning & enjoying (when I can). Recently i've just began exploring the manipulate function, while the manipulate part itself works fine, I have to manually change the f[x_] for each equation I want to explore. In order to export to CDF or just simplify the looks I wanted to use an InputField or similar method to express an equation but I can't seem to figure out how to go from InputField to an equation the manipulation expression will work with. The working code I have is:f[x_] := {{XXXX}}g[a_] := Evaluate[D[f[a], a]]Manipulate[Plot[{f[x], g[x], g[a] *(x-a) + f[a]}, {x, c,-1*c},PlotRange -> {b, -1*b},PlotLedgends -> {f[x], g[x], "f'(x) m value" -> g[a]}], {{a, -5}, {-10,10},{{b,5}, 0.1,10}, {{c, 5}, .1,10}]//Replace {{XXXX}} the equation All it does is plot a function, its derivative and the tangent line that tracks the original function. I was trying to define the function via InputField and despite my best efforts I can't crack it.
 Manipulate[  Grid[   {    {TraditionalForm[u]},    {"Equation", Row[{u, " = 0"}]},    {"Solutions", Solve[u == 0, x]},    {"Roots", Roots[u == 0, x]},    {"Discriminant", Discriminant[u, x]},    {Plot[u, {x, -5, 5}]}   },  Alignment -> Left], {{u, x^2 + 2 x + 1, "Equation"}}, BaseStyle -> Directive[   FontSize -> 16,    FontFamily -> "Optima"] ] Is this related to your question? I don't think you can make a CDF out of this, though.