Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Ploting ODE (unable to simplify to float approximation)

I wanted to to draw the slope field aswell as the solution for my ODE. When I try to plot the solution i get a warning and an error.

verbose 0 (3749: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points.
verbose 0 (3749: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'

My Code:

y = function('y')(x)
a,b,c,d=var('a b c d')
_C=var('_C')
a=1
b=0
c=0
d=1
de =  diff(y,x) == (a*x+b*y)/(c*x+d*y)

h = desolve(de, y, ivar=x);  
h=h.substitute(_C==0)
h

y = var('y')
x = var('x')

Plot1=plot_slope_field(((a*x+b*y)/(c*x+d*y)),(x,-10,10),(y,-10,10))
Plot2=plot(h,(x,0,5))

Plot1+Plot2