Plotting solution to O.D.E.
Hello,
I just started using sage yesterday, and I'm trying to plot a solution to an ODE. Here is my code:
t = var('t')
c = function('c',t)
s = 0.025
n = 10^8
r = 10^(-6)
ode = diff(c,t)==r*c*(1-c)*n+s/(1+s*c)*c*(1-c)
sol1 = desolve(de=ode, ivar=t, dvar=c,ics=[0,2])
sol1 = sol1.simplify_full()
solc = solve(sol1,c)
plot(solc,0,100)
sage returns a solution for solc:
...
solc = solve(sol1,c); solc
[log(c(t)) == 4001/40*t + 1/164040*log(4201) + log(2) - 1/164040*log(100*c(t) + 4001) + 164041/164040*log(c(t) - 1)]
The error message I get is:
verbose 0 (3517: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points.
verbose 0 (3517: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation'
Is there any way to plot this?
Thanks in advance.
note that to put a block of code, instead of a quote (with ">"), you should add four spaces for each line. It can be done by clicking on the 0101010 button.
The problem is that your solution seems to not have been solved (perhaps can't be) for
c(t)
by Sage's solver. You could conceivably try an implicit plot?