-1

With Maxima, I want to plot the value of a parameter depending on time by solving an equation for that specific parameter. I am new to Maxima and I already struggle with the beginning of my calculations. I use the following equation m which I want to solve for L:

m= m_I - (m_I-m_R)/(1+%e^(-s_R*(t-L)))
solve(%,L);

which gives me

L=(t*s_R-log(m_I/(m-m_R)-m/(m-m_R)))/s_R

as output. If I now assign values to all parameters except L and t

ev(%,m=0.5,m_I=1,m_R=0.1,s_R=0.01);
plot2d(%,[t,0,10]);

I get the error message

"plot2d: expression evaluates to non-numeric value everywhere in plotting range. plot2d: nothing to plot."

I know this is very basic but I still don't know what I am doing wrong. I also tried to use a function m(t):=... instead of an expression m=..., with the same result.

gsamaras
  • 71,951
  • 46
  • 188
  • 305
Inopinans
  • 43
  • 4
  • Looks like a duplicate of https://stackoverflow.com/questions/15619231/plotting-solution-of-ode-in-maxima-expression-evalues-to-non-numeric-value-eve?rq=1 – ederag Sep 20 '21 at 16:41

1 Answers1

1

Note that solve has returned a list containing one element, which is an equation. In order to plot the result, you need to isolate the right-hand side of the equation, because that's what plot2d understands (it doesn't know what to do with the output of solve otherwise).

My advice is to get the part of the solve result that you want first, and then plot that. Something like:

solve (...);
my_equation : %[1];
my_equation_rhs : rhs(%);
plot2d (my_equation_rhs, [t, 0, 10]);

It is a deficiency of plot2d that it doesn't know what to do with the result of solve; sorry about that.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
  • 1
    The ability to [plot implicit functions](https://maxima.sourceforge.io/docs/manual/maxima_64.html#index-plot2d) (equations) has been added between `5.43.2` and `5.45.1`, which is awesome. – ederag Sep 20 '21 at 16:43