# 352 - Topic 02 - Separable Equations

## 2243 days ago by Professor352

Solving Separable Differential Equations

John Travis

Mississippi College

Blanchard, Devaney and Hall, 4th edition.

Enter the right-hand-side for a separable differential equation of the form

$\frac{\mathrm{dy}}{\mathrm{dt}} = f(t,y)$

with y as a function of t entered as "y(t)" instead of just plain "y".

Of course, the DE will be separable if it is possible to write $f(t,y) = g(y) h(t)$ for some functions $g$ and $h$.

# Worksheet still under development. Use at your own risk! 8-o
var('t,k,M,m') y = function('y', t) f = 3*y^2/t # f = 1*y*(10-y)*(y-2) F = maxima.factor(f) html('Differential Equation can be separated into\n\n<center>$dy/dx = %s$</center>'%str(latex(F))) # Enter the domain value for the initial condition t0=0 t1=2 # Enter the range value for the initial condition y0=1 sol = desolve(diff(y,t) - f, y) sol_p = desolve(diff(y,t) - f, y, ics=[t0,y0]) html('The exact general solution for this problem is given by $y(t)=%s$'%str(latex(sol))) var('y') G = plot(sol_p,(t,t0,t1)) + point2d((t0,y0),color='red',pointsize=20) show(G)
 Differential Equation can be separated into $dy/dx = -\left(y\left(t\right)-10\right)\,\left(y\left(t\right)-2\right)\,y \left(t\right)$The exact general solution for this problem is given by $y(t)=\frac{1}{16} \, \log\left(y\left(t\right) - 2\right) - \frac{1}{80} \, \log\left(y\left(t\right) - 10\right) - \frac{1}{20} \, \log\left(y\left(t\right)\right) = c + t$verbose 0 (2387: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (2387: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' Differential Equation can be separated into The exact general solution for this problem is given by verbose 0 (2387: plot.py, generate_plot_points) WARNING: When plotting, failed to evaluate function at 200 points. verbose 0 (2387: plot.py, generate_plot_points) Last error message: 'unable to simplify to float approximation' var('x,y,M') f = 1/(x*(M-x)) f.show() f.partial_fraction(x).show()
# checking a nice example var ('C') f = integrate(x*sin(x),x)+C soln = f/x^2 print soln solnp = diff(soln,x) print solnp # and plug both back into original de # x y' + 2 y = sin(x) print left = x*solnp +2*soln left.show() print left.simplify()
 -(x*cos(x) - C - sin(x))/x^2 sin(x)/x + 2*(x*cos(x) - C - sin(x))/x^3 x*(sin(x)/x + 2*(x*cos(x) - C - sin(x))/x^3) - 2*(x*cos(x) - C - sin(x))/x^2 -(x*cos(x) - C - sin(x))/x^2 sin(x)/x + 2*(x*cos(x) - C - sin(x))/x^3 x*(sin(x)/x + 2*(x*cos(x) - C - sin(x))/x^3) - 2*(x*cos(x) - C - sin(x))/x^2