352 - Topic 03 - Qualitative Solutions

3422 days ago by Professor352

Solving Separable Differential Equations

John Travis

Mississippi College

Blanchard, Devaney and Hall, 4th edition.

Once again, we consider various differential equations in the form

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

Qualitative analysis can be appropriate when:

  • it may be more difficult to discern an analytic approach to solving the equation
  • all you want is an idea about how solutions behave over time
  • you need only asymptotic behavior (as $t \to \infty$)
# Worksheet still under development. Use at your own risk! 8-o 
       
t,y,yy = var('t y yy') def f(t,y): # enter the desired right hand side below return t^2+y def ff(t,yy): # enter the desired right hand side below return t^2+yy html('Using $f(t,y) = '+str(f(t,y))+'$') yy = function('yy',t) DE = diff(yy,t)== f(t,yy) html('Differential Equation is $%s$'%str(latex(DE))) 
       
Using 
Differential Equation is 
                                
                            
Using 
Differential Equation is 
                                
tmin=-2 tmax=2 ymin=-2 ymax=2 
       
plot_slope_field(f(t,y),(t,tmin,tmax),(y,ymin,ymax)).show(aspect_ratio=1) html('<center>Slope field for $dy/dt = %s$</center>'%str(f(t,y))) 
       
Slope field for
Slope field for
# Overlay particular slopes on the slope field above at an interactively chosen initial value. Also draw soln curve. @interact def _(t0 = slider(tmin,tmax,1/10,tmin,label='$t_0$'),y0 = slider(ymin,ymax,1/10,(ymin+ymax)/2,label='$y_0$'), soln_curve=checkbox(default=False,label='Draw Solution?')): G = plot_slope_field(f(t,y),(t,tmin,tmax),(y,ymin,ymax),color='gray') G += point((t0,y0),color='red',size=40) G += plot(f(t0,y0)*(t-t0)+y0,(t,t0-0.2,t0+0.2),color='blue') # could blow up if vertical...need parametric if soln_curve: desolve_rk4(t^2+y^2,y,ics=[t0,y0],end_points=[tmin,tmax],step=0.1) # G += points(desolve_rk4(ff(t,yy),yy,ics=[t0,y0],end_points=[tmin,tmax],step=0.1)) G.show(aspect_ratio=1) html('<center>Slope field for $dy/dt = %s$</center>'%str(f(t,y))) 
       

Click to the left again to hide and once more to show the dynamic interactive window

# The following still have issues. Fixes? 
       
# This works ok so long as DE is autonomous. Putting any t's in the DE make this take forever. P=desolve_rk4(DE,y,ics=[0,1],ivar=t,output='slope_field',end_points=[-4,6],thickness=3) show(P) 
       
points(desolve_rk4(f(t,y),y,ics=[0,1]),ivar=t) 
       
verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                        

    faceted        If True color the edge of the point.                 

    hue            The color given as a hue.                            

    legend_color   The color of the legend text                         

    legend_label   The label for this item in the legend.               

    rgbcolor       The color as an RGB tuple.                           

    size           How big the point is (i.e., area in points^2=(1/72
inch)^2).
    zorder         The layer level in which to draw                     


verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                        

    faceted        If True color the edge of the point.                 

    hue            The color given as a hue.                            

    legend_color   The color of the legend text                         

    legend_label   The label for this item in the legend.               

    rgbcolor       The color as an RGB tuple.                           

    size           How big the point is (i.e., area in points^2=(1/72
inch)^2).
    zorder         The layer level in which to draw                     


verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                        

    faceted        If True color the edge of the point.                 

    hue            The color given as a hue.                            

    legend_color   The color of the legend text                         

    legend_label   The label for this item in the legend.               

    rgbcolor       The color as an RGB tuple.                           

    size           How big the point is (i.e., area in points^2=(1/72
inch)^2).
    zorder         The layer level in which to draw                     


verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                               
    faceted        If True color the edge of the point.                        
    hue            The color given as a hue.                                   
    legend_color   The color of the legend text                                
    legend_label   The label for this item in the legend.                      
    rgbcolor       The color as an RGB tuple.                                  
    size           How big the point is (i.e., area in points^2=(1/72 inch)^2).
    zorder         The layer level in which to draw                            

verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                               
    faceted        If True color the edge of the point.                        
    hue            The color given as a hue.                                   
    legend_color   The color of the legend text                                
    legend_label   The label for this item in the legend.                      
    rgbcolor       The color as an RGB tuple.                                  
    size           How big the point is (i.e., area in points^2=(1/72 inch)^2).
    zorder         The layer level in which to draw                            

verbose 0 (154: primitive.py, options) WARNING: Ignoring option 'ivar'=t
verbose 0 (154: primitive.py, options) 
The allowed options for Point set defined by 101 point(s) are:
    alpha          How transparent the point is.                               
    faceted        If True color the edge of the point.                        
    hue            The color given as a hue.                                   
    legend_color   The color of the legend text                                
    legend_label   The label for this item in the legend.                      
    rgbcolor       The color as an RGB tuple.                                  
    size           How big the point is (i.e., area in points^2=(1/72 inch)^2).
    zorder         The layer level in which to draw                            

# do something with isoclines... 
       
# Playing around with slope fields @interact def _(t0 = slider(tmin,tmax,1/10,tmin,label='$t_0$'),y0 = slider(ymin,ymax,1/10,(ymin+ymax)/2,label='$y_0$'), soln_curve=checkbox(default=False,label='Draw Solution?')): G = plot_slope_field(f(t,y),(t,tmin,tmax),(y,ymin,ymax),color='gray') G += point((t0,y0),color='red',size=40) G += plot(f(t0,y0)*(t-t0)+y0,(t,t0-0.2,t0+0.2),color='blue') # could blow up if vertical...need parametric if soln_curve: desolve_rk4(t^2+y,y,ics=[t0,y0],end_points=[tmin,tmax],step=0.1) G += points(desolve_rk4(ff(t,yy),yy,ics=[t0,y0],end_points=[tmin,tmax],step=0.1)) G.show(aspect_ratio=1) html('<center>Slope field for $dy/dt = %s$</center>'%str(f(t,y))) 
       

Click to the left again to hide and once more to show the dynamic interactive window