I almost have everything working as intended, but have run into an issue. My code is below (some of the items like l and u are not being used yet). I want to be able to enter a function f[x] in an input field and then inv is supposed to be the inverse of its derivative (the function is Cos[x] by default) obtained numerically. In creating pts using Table, when i use f'[x] for the derivative (or even D[f[x],x]), it doesn't work. However, when I replace it with -Sin[x], it does. I need pts to be generated based on whatever function is entered in the Input Field (associated with the variable p).
I am fairly new to Mathematica Programming which may be evident in my coding. Thanks
Manipulate[
ClearAll[f, g];
f[x_] := p;
pts = Table[N[{x, f'[x]}], {x, a, b, .01}];
fn = Interpolation[pts];
inv = InverseFunction[fn];
l = Min[{f'[a], f'[b]}];
u = Max[{f'[a], f'[b]}];
Plot[{NIntegrate[inv[t], {t, 0, m}]}, {m, -.99, .99},
PlotStyle -> {Yellow, Dashed}, AxesOrigin -> {0, 0}],
{{p, Cos[x],
Text[Style[TraditionalForm["f(x)= "], Blue, Italic, 18]]},
ControlType -> InputField},
Row[
{
Control[{{a, -1.57,
Text[Style[TraditionalForm["a= "], Blue, Italic, 12]]},
ControlType -> InputField, ImageSize -> Tiny}],
Control[{{b, 1.57,
Text[Style[TraditionalForm["b= "], Blue, Italic, 12]]},
ControlType -> InputField, ImageSize -> Tiny}]
}
],
TrackedSymbols :> Manipulate
]