Search code examples
plotmaple

plot solution of fsolve() of parametric function


I have a function f(v,u) and I defined function

solutionf(u) := fsolve(f(v,u)=v);

I need to plot solutionf(u) depending on u but just

plot(solutionf(u), u = 0 .. 0.4e-1)

gives me an error

Error, (in fsolve) number of equations, 1, does not match number of variables, 2

However I can always take the value solutionf(x) at any x.

Is there simple way to plot this? Or I have to make own for loop over u, take value at every point and plot interploating values?


Solution

  • This is one of the most-often-asked Maple questions. Your error is caused by what is known as premature evaluation, the expression solutionf(u) being evaluated before u has been given a numeric value.

    There are several ways to avoid premature evaluation. The simplest is probably to use forward single quotes:

    plot('solutionf(u)', u= 0..0.4e-1);