Ticket #8132: trac_8132_fixed_reference_manual.patch

File trac_8132_fixed_reference_manual.patch, 6.7 KB (added by Robert Marik, 13 years ago)

apply on the top of the previous two patches

  • doc/en/reference/calculus.rst

    # HG changeset patch
    # User Robert Marik <marik@mendelu.cz>
    # Date 1264954655 -3600
    # Node ID bc69314f50de7b35947ab728d0998c29572bacd6
    # Parent  888c77db88e67f0b2c00c9799559c26645bd9945
    added files to reference manual and few more fixes
    
    diff -r 888c77db88e6 -r bc69314f50de doc/en/reference/calculus.rst
    a b  
    1313   sage/calculus/tests
    1414   sage/symbolic/expression_conversions
    1515   sage/calculus/wester
     16   sage/calculus/desolvers
     17   sage/gsl/ode
  • sage/calculus/desolvers.py

    diff -r 888c77db88e6 -r bc69314f50de sage/calculus/desolvers.py
    a b  
    1 """
     1r"""
     2Solving ordinary differential equations
     3
    24This file contains functions useful for solving differential equations
    35which occur commonly in a 1st semester differential equations
    46course. For another numerical solver see :meth:`ode_solver` function
     
    8082     
    8183      - for a second-order boundary solution, specify initial and
    8284        final ``x`` and ``y`` initial conditions gives error if the
    83         solution is not SymbolisEquation (as happens for example for
     85        solution is not SymbolicEquation (as happens for example for
    8486        clairot equation)
    8587       
    86     - ``ivar`` - (optional) the independent variable  (hereafter called x),
    87                     which must be specified if there is more than one
    88                     independent variable in the equation.
     88    - ``ivar`` - (optional) the independent variable (hereafter called
     89      x), which must be specified if there is more than one
     90      independent variable in the equation.
    8991                   
    9092    - ``show_method`` - (optional) if true, then Sage returns pair
    9193      ``[solution, method]``, where method is the string describing
     
    638640       
    639641
    640642def desolve_system_strings(des,vars,ics=None):
    641     """
     643    r"""
    642644    Solves any size system of 1st order ODE's. Initials conditions are optional.
    643645
     646    This function is obsolete, use desolve_system.
    644647
    645648    INPUT:
    646         de    -- a list of strings representing the ODEs in maxima notation
    647                  (eg, de = "diff(f(x),x,2)=diff(f(x),x)+sin(x)")
    648         vars  -- a list of strings representing the variables
    649                  (eg, vars = ["s","x","y"], where s is the independent variable
    650                   and x,y the dependent variables)
    651         ics   -- a list of numbers representing initial conditions
    652                  (eg, x(0)=1, y(0)=2 is ics = [0,1,2])
     649
     650    - ``de`` - a list of strings representing the ODEs in maxima
     651      notation (eg, de = "diff(f(x),x,2)=diff(f(x),x)+sin(x)")
     652
     653    - ``vars`` - a list of strings representing the variables (eg,
     654      vars = ["s","x","y"], where s is the independent variable and
     655      x,y the dependent variables)
     656
     657    - ``ics`` - a list of numbers representing initial conditions
     658      (eg, x(0)=1, y(0)=2 is ics = [0,1,2])
    653659
    654660    WARNING:
    655         The given ics sets the initial values of the dependent vars in maxima, so
    656         subsequent ODEs involving these variables will have these initial conditions
    657         automatically imposed.
    658661
    659     EXAMPLES:
     662        The given ics sets the initial values of the dependent vars in
     663        maxima, so subsequent ODEs involving these variables will have
     664        these initial conditions automatically imposed.
     665
     666    EXAMPLES::
     667
    660668        sage: from sage.calculus.desolvers import desolve_system_strings
    661669        sage: s = var('s')
    662670        sage: function('x', s)
     
    678686        sage: P1 = plot([solnx,solny],(0,1))
    679687        sage: P2 = parametric_plot((solnx,solny),(0,1))
    680688
    681         Now type show(P1), show(P2) to view these.
     689    Now type show(P1), show(P2) to view these.
    682690                     
    683691
    684     AUTHORS: David Joyner (3-2006, 8-2007)
     692    AUTHORS:
     693
     694    - David Joyner (3-2006, 8-2007)
    685695    """
    686696    d = len(des)
    687697    dess = [de._maxima_init_() + "=0" for de in des]
     
    702712    return [f.rhs()._maxima_init_() for f in soln]
    703713
    704714def eulers_method(f,x0,y0,h,x1,method="table"):
    705     """
     715    r"""
    706716    This implements Euler's method for finding numerically the
    707717    solution of the 1st order ODE ``y' = f(x,y)``, ``y(a)=c``. The "x"
    708718    column of the table increments from ``x0`` to ``x1`` by ``h`` (so
     
    786796        return soln
    787797
    788798def eulers_method_2x2(f,g, t0, x0, y0, h, t1,method="table"):
    789     """
     799    r"""
    790800    This implements Euler's method for finding numerically the
    791801    solution of the 1st order system of two ODEs
    792802
     
    881891        return soln
    882892
    883893def eulers_method_2x2_plot(f,g, t0, x0, y0, h, t1):
    884     """
     894    r"""
     895    Plots solution of ODE
     896
    885897    This plots the soln in the rectangle ``(xrange[0],xrange[1])
    886898    x (yrange[0],yrange[1])`` and plots using Euler's method the
    887899    numerical solution of the 1st order ODEs `x' = f(t,x,y)`,
     
    891903   
    892904    EXAMPLES::
    893905
     906        sage: from sage.calculus.desolvers import eulers_method_2x2_plot
     907
    894908    The following example plots the solution to
    895     `\\theta''+\\sin(\\theta)=0`, `\\theta(0)=\\frac 34`, `\\theta'(0) =
     909    `\theta''+\sin(\theta)=0`, `\theta(0)=\frac 34`, `\theta'(0) =
    896910    0`.  Type ``P[0].show()`` to plot the solution,
    897     ``(P[0]+P[1]).show()`` to plot `(t,\\theta(t))` and
    898     `(t,\\theta'(t))`::
     911    ``(P[0]+P[1]).show()`` to plot `(t,\theta(t))` and
     912    `(t,\theta'(t))`::
    899913
    900         sage: from sage.calculus.desolvers import eulers_method_2x2_plot
    901914        sage: f = lambda z : z[2]; g = lambda z : -sin(z[1])
    902915        sage: P = eulers_method_2x2_plot(f,g, 0.0, 0.75, 0.0, 0.1, 1.0)
    903916    """
     
    11081121
    11091122
    11101123def desolve_system_rk4(des, vars, ics=None, ivar=None, end_points=None, step=0.1):
    1111     """
     1124    r"""
    11121125    Solves numerically system of first-order ordinary differential
    11131126    equations using the 4th order Runge-Kutta method. Wrapper for
    11141127    Maxima command ``rk``. See also ``ode_solver``.
     
    11421155
    11431156    EXAMPLES::
    11441157
     1158        sage: from sage.calculus.desolvers import desolve_system_rk4
     1159
    11451160    Lotka Volterra system::
    11461161
    11471162        sage: from sage.calculus.desolvers import desolve_system_rk4
  • sage/gsl/ode.pyx

    diff -r 888c77db88e6 -r bc69314f50de sage/gsl/ode.pyx
    a b  
     1r"""
     2Solving ODE numericaly by GSL
     3
     4AUTHORS:
     5
     6- Joshua Kantor (2004-2006)
     7
     8- Robert Marik (2010 - fixed docstrings)
     9
     10"""
    111##############################################################################
    212#       Copyright (C) 2004,2005,2006 Joshua Kantor <kantor.jm@gmail.com>
    313#  Distributed under the terms of the GNU General Public License (GPL)