Search code examples
maxima

Maxima plot not working


What am I doing wrong in this code?

atvalue(y(x),[x=0],1)$
desolve(diff(y(x),x)=y(x),y(x));
plot2d(y(x),[x,-6,6]);

Output:

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

I want to plot y(x) which is obtained from a differential equation.


Solution

  • In Maxima y(x) = ... is an equation, and y(x) := ... is a function, and those two things are different. Try this:

    atvalue (y(x), [x=0], 1)$
    desolve (diff(y(x),x)=y(x), y(x));
    define (y(x), rhs(%));
    plot2d (y(x), [x, -6, 6]);
    

    Here define(y(x), ...) is a different way to define a function. define evaluates the function body rhs(%) to yield exp(x) but := quotes it (not what you want).