I'm trying to get this piece of code to work:
Panel[
DynamicModule[{f = x, g = -x},
xmax = 10;
Column[{
InputField[Dynamic[f], ContinuousAction -> True],
InputField[Dynamic[g]],
Dynamic[ Show[Plot[{f, g}, {x, -xmax, xmax}, AspectRatio -> 1,
PlotRange -> {{-xmax, xmax}, {-xmax, xmax}}]
]
]
}]
]
]
This works and updates dynamically the graphs of f
and g
. Now, I would like to add the intersections, dynamically, if any (so with a IF
testing), and I tried different things, without success:
solution = Dynamic[Solve[f == g, {x,y}]
gives me indeed the dynamically updated solution. But I can't use this information to plot points, nor even get Length[solution]
update dynamically...
Any help with this?
solution
definition looks strange, usesolution:=...
and useDynamic
at the end in the plotting procedure. p.s. isn'tShow
redundant? $\endgroup$