I'm making on a demo working with differential equations as functions of two variables (x and y). The demo will have to Fold the differential equation with an initial y-value and a series of x-values. Here's a simple code for the demo. The output should be a list on new y-values.

DynamicModule[{dydx = Null}, 
{{"Differential equation: (dy/dx)=", 
   "List of Slopes:"},
   InputField[Dynamic[FoldList[dydx, 1, {0, 1, 2, 3}]]]}}]

The code doesn't work because dydx cannot be applied as a function in FoldList. "dydx" needs to be defined as a function f[y_,x_]. However, I'm not sure how to dynamically change a function using InputField.

f[y_,x_]= dydx

I'd like to have this as part of the Dynamic Module. Users would be able to input a function then receive a list of new y values.
Any advice?

  • $\begingroup$ Hi, you may be interested in this topic. Which may be even considered duplicate. $\endgroup$ – Kuba Apr 18 '14 at 21:00
  • $\begingroup$ So, are you or I've missed the point? $\endgroup$ – Kuba Apr 19 '14 at 9:28
  • $\begingroup$ Wow, thanks for checking back in! That topic is exactly what I needed. $\endgroup$ – Shaggy1135 Apr 21 '14 at 0:23