Explicación teorema del coseno

1556 days ago by JSM_ehg

 
       


TEORÍA TEOREMA DEL COSENO

Los Elementos de Euclides,que datan del siglo III a. C., contienen ya una aproximación geométrica de la generalización del teorema de Pitágoras: las proposiciones 12 y 13 del libro II, tratan separadamente el caso de un triángulo obtusángulo y el de un triángulo acutángulo. La formulación de la época es arcaica ya que la ausencia de funciones trigonométricas y del álgebra obligó a razonar en términos de diferencias de áreas.2 Por eso, la proposición 12 utiliza estos términos:

 

«En los triángulos obtusángulos, el cuadrado del lado opuesto al ángulo obtuso es mayor que los cuadrados de los lados que comprenden el ángulo obtuso en dos veces el rectángulo comprendido por un lado de los del ángulo obtuso sobre el que cae la perpendicular y la recta exterior cortada por la perpendicular, hasta el ángulo obtuso.»

Euclides, Elementos.3

Siendo ABC el triángulo, cuyo ángulo obtuso está en C, y BH la altura respecto del vértice B (cf. Fig. 2 contigua), la notación moderna permite formular el enunciado así:

Fig. 2 - Triángulo ABC con altura BH.

AB^2 = CA^2 + CB^2 + 2\ CA\ CH

Faltaba esperar la trigonometría árabe-musulmana de la Edad Media para ver al teorema evolucionar a su forma y en su alcance: el astrónomo y matemático al-Battani4 generalizó el resultado de Euclides en la geometría esférica a principios del siglo X, lo que permitió efectuar los cálculos de la distancia angular entre el Sol y la Tierra.5 6 Fue durante el mismo período cuando se establecieron las primeras tablas trigonométricas, para las funciones seno y coseno. Eso permitió a Ghiyath al-Kashi,7 matemático de la escuela de Samarcanda, de poner el teorema bajo una forma utilizable para la triangulación durante el siglo XV. La propiedad fue popularizada en occidente por François Viète quien, al parecer, lo redescubrió independientemente.8

Fue a finales del siglo XVII cuando la notación algebraica moderna, aunada a la notación moderna de las funciones trigonométricas introducida por Euler en su libro Introductio in analysin infinitorum, permitieron escribir el teorema bajo su forma actual, extendiéndose el nombre de teorema (o ley) del coseno.9

 

 

 
       
desolve? 
       

File: /usr/local/sage-5.9/local/lib/python2.7/site-packages/sage/calculus/desolvers.py

Type: <type ‘function’>

Definition: desolve(de, dvar, ics=None, ivar=None, show_method=False, contrib_ode=False)

Docstring:

Solves a 1st or 2nd order linear ODE via maxima. Including IVP and BVP.

Use desolve? <tab> if the output in truncated in notebook.

INPUT:

  • de - an expression or equation representing the ODE
  • dvar - the dependent variable (hereafter called y)
  • ics - (optional) the initial or boundary conditions
    • for a first-order equation, specify the initial x and y
    • for a second-order equation, specify the initial x, y, and dy/dx, i.e. write [x_0, y(x_0), y'(x_0)]
    • for a second-order boundary solution, specify initial and final x and y boundary conditions, i.e. write [x_0, y(x_0), x_1, y(x_1)].
    • gives an error if the solution is not SymbolicEquation (as happens for example for Clairaut equation)
  • ivar - (optional) the independent variable (hereafter called x), which must be specified if there is more than one independent variable in the equation.
  • show_method - (optional) if true, then Sage returns pair [solution, method], where method is the string describing method which has been used to get solution (Maxima uses the following order for first order equations: linear, separable, exact (including exact with integrating factor), homogeneous, bernoulli, generalized homogeneous) - use carefully in class, see below for the example of the equation which is separable but this property is not recognized by Maxima and equation is solved as exact.
  • contrib_ode - (optional) if true, desolve allows to solve clairaut, lagrange, riccati and some other equations. May take a long time and thus turned off by default. Initial conditions can be used only if the result is one SymbolicEquation (does not contain singular solution, for example)

OUTPUT:

In most cases returns SymbolicEquation which defines the solution implicitly. If the result is in the form y(x)=... (happens for linear eqs.), returns the right-hand side only. The possible constant solutions of separable ODE’s are omitted.

EXAMPLES:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve(diff(y,x) + y - 1, y)
(c + e^x)*e^(-x)
sage: f = desolve(diff(y,x) + y - 1, y, ics=[10,2]); f
(e^10 + e^x)*e^(-x)
sage: plot(f)

We can also solve second-order differential equations.:

sage: x = var('x')
sage: y = function('y', x)
sage: de = diff(y,x,2) - y == x
sage: desolve(de, y)
k1*e^x + k2*e^(-x) - x
sage: f = desolve(de, y, [10,2,1]); f
-x + 5*e^(-x + 10) + 7*e^(x - 10)
sage: f(x=10)
2
sage: diff(f,x)(x=10)
1
sage: de = diff(y,x,2) + y == 0
sage: desolve(de, y)
k1*sin(x) + k2*cos(x)
sage: desolve(de, y, [0,1,pi/2,4])
4*sin(x) + cos(x)
sage: desolve(y*diff(y,x)+sin(x)==0,y)
-1/2*y(x)^2 == c - cos(x)

Clairot equation: general and singular solutions:

sage: desolve(diff(y,x)^2+x*diff(y,x)-y==0,y,contrib_ode=True,show_method=True)
[[y(x) == c^2 + c*x, y(x) == -1/4*x^2], 'clairault']

For equations involving more variables we specify independent variable:

sage: a,b,c,n=var('a b c n')
sage: desolve(x^2*diff(y,x)==a+b*x^n+c*x^2*y^2,y,ivar=x,contrib_ode=True)
[[y(x) == 0, (b*x^(n - 2) + a/x^2)*c^2*u == 0]]
sage: desolve(x^2*diff(y,x)==a+b*x^n+c*x^2*y^2,y,ivar=x,contrib_ode=True,show_method=True)
[[[y(x) == 0, (b*x^(n - 2) + a/x^2)*c^2*u == 0]], 'riccati']

Higher orded, not involving independent variable:

sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y).expand()
1/6*y(x)^3 + k1*y(x) == k2 + x
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,1,3]).expand()
1/6*y(x)^3 - 5/3*y(x) == x - 3/2
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,1,3],show_method=True)
[1/6*y(x)^3 - 5/3*y(x) == x - 3/2, 'freeofx']

Separable equations - Sage returns solution in implicit form:

sage: desolve(diff(y,x)*sin(y) == cos(x),y)
-cos(y(x)) == c + sin(x)
sage: desolve(diff(y,x)*sin(y) == cos(x),y,show_method=True)
[-cos(y(x)) == c + sin(x), 'separable']
sage: desolve(diff(y,x)*sin(y) == cos(x),y,[pi/2,1])
-cos(y(x)) == sin(x) - cos(1) - 1

Linear equation - Sage returns the expression on the right hand side only:

sage: desolve(diff(y,x)+(y) == cos(x),y)
1/2*((sin(x) + cos(x))*e^x + 2*c)*e^(-x)
sage: desolve(diff(y,x)+(y) == cos(x),y,show_method=True)
[1/2*((sin(x) + cos(x))*e^x + 2*c)*e^(-x), 'linear']
sage: desolve(diff(y,x)+(y) == cos(x),y,[0,1])
1/2*(e^x*sin(x) + e^x*cos(x) + 1)*e^(-x)

This ODE with separated variables is solved as exact. Explanation - factor does not split e^{x-y} in Maxima into e^{x}e^{y}:

sage: desolve(diff(y,x)==exp(x-y),y,show_method=True)
[-e^x + e^y(x) == c, 'exact']

You can solve Bessel equations. You can also use initial conditions, but you cannot put (sometimes desired) initial condition at x=0, since this point is singlar point of the equation. Anyway, if the solution should be bounded at x=0, then k2=0.:

sage: desolve(x^2*diff(y,x,x)+x*diff(y,x)+(x^2-4)*y==0,y)
k1*bessel_j(2, x) + k2*bessel_y(2, x)

Difficult ODE produces error:

sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y) # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."

Difficult ODE produces error - moreover, takes a long time

sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y,contrib_ode=True) # not tested

Some more types od ODE’s:

sage: desolve(x*diff(y,x)^2-(1+x*y)*diff(y,x)+y==0,y,contrib_ode=True,show_method=True)
[[y(x) == c + log(x), y(x) == c*e^x], 'factor']
sage: desolve(diff(y,x)==(x+y)^2,y,contrib_ode=True,show_method=True)
[[[x == c - arctan(sqrt(t)), y(x) == -x - sqrt(t)], [x == c + arctan(sqrt(t)), y(x) == -x + sqrt(t)]], 'lagrange']

These two examples produce error (as expected, Maxima 5.18 cannot solve equations from initial conditions). Current Maxima 5.18 returns false answer in this case!:

sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,2]).expand() # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,2],show_method=True) # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."

Second order linear ODE:

sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y)
(k2*x + k1)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,show_method=True)
[(k2*x + k1)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,1])
1/2*(7*x + 6)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,1],show_method=True)
[1/2*(7*x + 6)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,pi/2,2])
3*((e^(1/2*pi) - 2)*x/pi + 1)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,pi/2,2],show_method=True)
[3*((e^(1/2*pi) - 2)*x/pi + 1)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y)
(k2*x + k1)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,show_method=True)
[(k2*x + k1)*e^(-x), 'constcoeff']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,1])
(4*x + 3)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,1],show_method=True)
[(4*x + 3)*e^(-x), 'constcoeff']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,pi/2,2])
(2*(2*e^(1/2*pi) - 3)*x/pi + 3)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,pi/2,2],show_method=True)
[(2*(2*e^(1/2*pi) - 3)*x/pi + 3)*e^(-x), 'constcoeff']

TESTS:

Trac #9961 fixed (allow assumptions on the dependent variable in desolve):

sage: y=function('y',x); assume(x>0); assume(y>0)
sage: sage.calculus.calculus.maxima('domain:real')  # needed since Maxima 5.26.0 to get the answer as below
real
sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y, contrib_ode=True)
[x - arcsinh(y(x)/x) == c]

Trac #10682 updated Maxima to 5.26, and it started to show a different solution in the complex domain for the ODE above:

sage: sage.calculus.calculus.maxima('domain:complex')  # back to the default complex domain
complex
sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y, contrib_ode=True)
[1/2*(2*x^2*sqrt(x^(-2)) - 2*x*sqrt(x^(-2))*arcsinh(y(x)/sqrt(x^2))
- 2*x*sqrt(x^(-2))*arcsinh(y(x)^2/(sqrt(y(x)^2)*x))
+ log(4*(2*x^2*sqrt((x^2*y(x)^2 + y(x)^4)/x^2)*sqrt(x^(-2)) + x^2 + 2*y(x)^2)/x^2))/(x*sqrt(x^(-2))) == c]

Trac #6479 fixed:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve( diff(y,x,x) == 0, y, [0,0,1])
x
sage: desolve( diff(y,x,x) == 0, y, [0,1,1])
x + 1

Trac #9835 fixed:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve(diff(y,x,2)+y*(1-y^2)==0,y,[0,-1,1,1])
Traceback (click to the left of this block for traceback)
...
                                
                            

File: /usr/local/sage-5.9/local/lib/python2.7/site-packages/sage/calculus/desolvers.py

Type: <type ‘function’>

Definition: desolve(de, dvar, ics=None, ivar=None, show_method=False, contrib_ode=False)

Docstring:

Solves a 1st or 2nd order linear ODE via maxima. Including IVP and BVP.

Use desolve? <tab> if the output in truncated in notebook.

INPUT:

  • de - an expression or equation representing the ODE
  • dvar - the dependent variable (hereafter called y)
  • ics - (optional) the initial or boundary conditions
    • for a first-order equation, specify the initial x and y
    • for a second-order equation, specify the initial x, y, and dy/dx, i.e. write [x_0, y(x_0), y'(x_0)]
    • for a second-order boundary solution, specify initial and final x and y boundary conditions, i.e. write [x_0, y(x_0), x_1, y(x_1)].
    • gives an error if the solution is not SymbolicEquation (as happens for example for Clairaut equation)
  • ivar - (optional) the independent variable (hereafter called x), which must be specified if there is more than one independent variable in the equation.
  • show_method - (optional) if true, then Sage returns pair [solution, method], where method is the string describing method which has been used to get solution (Maxima uses the following order for first order equations: linear, separable, exact (including exact with integrating factor), homogeneous, bernoulli, generalized homogeneous) - use carefully in class, see below for the example of the equation which is separable but this property is not recognized by Maxima and equation is solved as exact.
  • contrib_ode - (optional) if true, desolve allows to solve clairaut, lagrange, riccati and some other equations. May take a long time and thus turned off by default. Initial conditions can be used only if the result is one SymbolicEquation (does not contain singular solution, for example)

OUTPUT:

In most cases returns SymbolicEquation which defines the solution implicitly. If the result is in the form y(x)=... (happens for linear eqs.), returns the right-hand side only. The possible constant solutions of separable ODE’s are omitted.

EXAMPLES:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve(diff(y,x) + y - 1, y)
(c + e^x)*e^(-x)
sage: f = desolve(diff(y,x) + y - 1, y, ics=[10,2]); f
(e^10 + e^x)*e^(-x)
sage: plot(f)

We can also solve second-order differential equations.:

sage: x = var('x')
sage: y = function('y', x)
sage: de = diff(y,x,2) - y == x
sage: desolve(de, y)
k1*e^x + k2*e^(-x) - x
sage: f = desolve(de, y, [10,2,1]); f
-x + 5*e^(-x + 10) + 7*e^(x - 10)
sage: f(x=10)
2
sage: diff(f,x)(x=10)
1
sage: de = diff(y,x,2) + y == 0
sage: desolve(de, y)
k1*sin(x) + k2*cos(x)
sage: desolve(de, y, [0,1,pi/2,4])
4*sin(x) + cos(x)
sage: desolve(y*diff(y,x)+sin(x)==0,y)
-1/2*y(x)^2 == c - cos(x)

Clairot equation: general and singular solutions:

sage: desolve(diff(y,x)^2+x*diff(y,x)-y==0,y,contrib_ode=True,show_method=True)
[[y(x) == c^2 + c*x, y(x) == -1/4*x^2], 'clairault']

For equations involving more variables we specify independent variable:

sage: a,b,c,n=var('a b c n')
sage: desolve(x^2*diff(y,x)==a+b*x^n+c*x^2*y^2,y,ivar=x,contrib_ode=True)
[[y(x) == 0, (b*x^(n - 2) + a/x^2)*c^2*u == 0]]
sage: desolve(x^2*diff(y,x)==a+b*x^n+c*x^2*y^2,y,ivar=x,contrib_ode=True,show_method=True)
[[[y(x) == 0, (b*x^(n - 2) + a/x^2)*c^2*u == 0]], 'riccati']

Higher orded, not involving independent variable:

sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y).expand()
1/6*y(x)^3 + k1*y(x) == k2 + x
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,1,3]).expand()
1/6*y(x)^3 - 5/3*y(x) == x - 3/2
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,1,3],show_method=True)
[1/6*y(x)^3 - 5/3*y(x) == x - 3/2, 'freeofx']

Separable equations - Sage returns solution in implicit form:

sage: desolve(diff(y,x)*sin(y) == cos(x),y)
-cos(y(x)) == c + sin(x)
sage: desolve(diff(y,x)*sin(y) == cos(x),y,show_method=True)
[-cos(y(x)) == c + sin(x), 'separable']
sage: desolve(diff(y,x)*sin(y) == cos(x),y,[pi/2,1])
-cos(y(x)) == sin(x) - cos(1) - 1

Linear equation - Sage returns the expression on the right hand side only:

sage: desolve(diff(y,x)+(y) == cos(x),y)
1/2*((sin(x) + cos(x))*e^x + 2*c)*e^(-x)
sage: desolve(diff(y,x)+(y) == cos(x),y,show_method=True)
[1/2*((sin(x) + cos(x))*e^x + 2*c)*e^(-x), 'linear']
sage: desolve(diff(y,x)+(y) == cos(x),y,[0,1])
1/2*(e^x*sin(x) + e^x*cos(x) + 1)*e^(-x)

This ODE with separated variables is solved as exact. Explanation - factor does not split e^{x-y} in Maxima into e^{x}e^{y}:

sage: desolve(diff(y,x)==exp(x-y),y,show_method=True)
[-e^x + e^y(x) == c, 'exact']

You can solve Bessel equations. You can also use initial conditions, but you cannot put (sometimes desired) initial condition at x=0, since this point is singlar point of the equation. Anyway, if the solution should be bounded at x=0, then k2=0.:

sage: desolve(x^2*diff(y,x,x)+x*diff(y,x)+(x^2-4)*y==0,y)
k1*bessel_j(2, x) + k2*bessel_y(2, x)

Difficult ODE produces error:

sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y) # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."

Difficult ODE produces error - moreover, takes a long time

sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y,contrib_ode=True) # not tested

Some more types od ODE’s:

sage: desolve(x*diff(y,x)^2-(1+x*y)*diff(y,x)+y==0,y,contrib_ode=True,show_method=True)
[[y(x) == c + log(x), y(x) == c*e^x], 'factor']
sage: desolve(diff(y,x)==(x+y)^2,y,contrib_ode=True,show_method=True)
[[[x == c - arctan(sqrt(t)), y(x) == -x - sqrt(t)], [x == c + arctan(sqrt(t)), y(x) == -x + sqrt(t)]], 'lagrange']

These two examples produce error (as expected, Maxima 5.18 cannot solve equations from initial conditions). Current Maxima 5.18 returns false answer in this case!:

sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,2]).expand() # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."
sage: desolve(diff(y,x,2)+y*(diff(y,x,1))^3==0,y,[0,1,2],show_method=True) # not tested
Traceback (click to the left for traceback)
...
NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."

Second order linear ODE:

sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y)
(k2*x + k1)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,show_method=True)
[(k2*x + k1)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,1])
1/2*(7*x + 6)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,1],show_method=True)
[1/2*(7*x + 6)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,pi/2,2])
3*((e^(1/2*pi) - 2)*x/pi + 1)*e^(-x) + 1/2*sin(x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == cos(x),y,[0,3,pi/2,2],show_method=True)
[3*((e^(1/2*pi) - 2)*x/pi + 1)*e^(-x) + 1/2*sin(x), 'variationofparameters']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y)
(k2*x + k1)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,show_method=True)
[(k2*x + k1)*e^(-x), 'constcoeff']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,1])
(4*x + 3)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,1],show_method=True)
[(4*x + 3)*e^(-x), 'constcoeff']
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,pi/2,2])
(2*(2*e^(1/2*pi) - 3)*x/pi + 3)*e^(-x)
sage: desolve(diff(y,x,2)+2*diff(y,x)+y == 0,y,[0,3,pi/2,2],show_method=True)
[(2*(2*e^(1/2*pi) - 3)*x/pi + 3)*e^(-x), 'constcoeff']

TESTS:

Trac #9961 fixed (allow assumptions on the dependent variable in desolve):

sage: y=function('y',x); assume(x>0); assume(y>0)
sage: sage.calculus.calculus.maxima('domain:real')  # needed since Maxima 5.26.0 to get the answer as below
real
sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y, contrib_ode=True)
[x - arcsinh(y(x)/x) == c]

Trac #10682 updated Maxima to 5.26, and it started to show a different solution in the complex domain for the ODE above:

sage: sage.calculus.calculus.maxima('domain:complex')  # back to the default complex domain
complex
sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y, contrib_ode=True)
[1/2*(2*x^2*sqrt(x^(-2)) - 2*x*sqrt(x^(-2))*arcsinh(y(x)/sqrt(x^2))
- 2*x*sqrt(x^(-2))*arcsinh(y(x)^2/(sqrt(y(x)^2)*x))
+ log(4*(2*x^2*sqrt((x^2*y(x)^2 + y(x)^4)/x^2)*sqrt(x^(-2)) + x^2 + 2*y(x)^2)/x^2))/(x*sqrt(x^(-2))) == c]

Trac #6479 fixed:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve( diff(y,x,x) == 0, y, [0,0,1])
x
sage: desolve( diff(y,x,x) == 0, y, [0,1,1])
x + 1

Trac #9835 fixed:

sage: x = var('x')
sage: y = function('y', x)
sage: desolve(diff(y,x,2)+y*(1-y^2)==0,y,[0,-1,1,1])
Traceback (most recent call last):
...
NotImplementedError: Unable to use initial condition for this equation (freeofx).

Trac #8931 fixed:

sage: x=var('x'); f=function('f',x); k=var('k'); assume(k>0)
sage: desolve(diff(f,x,2)/f==k,f,ivar=x)
k1*e^(sqrt(k)*x) + k2*e^(-sqrt(k)*x)

AUTHORS:

  • David Joyner (1-2006)
  • Robert Bradshaw (10-2008)
  • Robert Marik (10-2009)
sage: x = var('x') sage: y = function('y', x) sage: desolve(diff(y,x) + y - 1, y) 
       
(c + e^x)*e^(-x)
(c + e^x)*e^(-x)
sage: f = desolve(diff(y,x) + y - 1, y, ics=[10,2]); f 
       
(e^10 + e^x)*e^(-x)
(e^10 + e^x)*e^(-x)
sage: plot(f,figsize=4) 
       
 
       
%hide t=var('t') y=function('y',t) def spring(lower,upper,position,width,n): part=(upper-lower)/n springgraph=line([(position,lower),(position,lower+part/2)])+line([(position,lower+part/2),(position+width/2,lower+part)]) radius=width/2 startx=position+radius starty=lower+part for i in range(1,n-1): if i%2==0: stopx=position+radius else: stopx=position-radius stopy=starty+part springgraph=springgraph+line([(startx,starty),(stopx,stopy)]) startx=stopx starty=stopy springgraph=springgraph+line([(startx,starty),(position,upper-part/2)])+line([(position,upper-part/2),(position,upper)]) springgraph=springgraph+polygon([(position-radius,lower),(position+radius,lower),(position+radius,lower-width),(position-radius,lower-width)]) return springgraph @interact(layout={'top': [['m','g','k'],['y0','y1'],['stop','force','f']]}) def SpringMass(m=('mass',input_box(1,width=10)),g=('damping coef.',input_box(0,width=10)),k=('spring const.',input_box(1,width=10)),stop=("Maximum t",input_box(4*pi,width=10)),force=checkbox(False, label='Use Forcing Term?'),f=("Forcing Term",input_box(sin(2*t),width=20)),y0=("y(0)",input_box(1,width=10)),y1=("y'(0)",input_box(0,width=10))): if force: DE1=m*diff(y,t,2)+g*diff(y,t)+k*y-f else: DE1=m*diff(y,t,2)+g*diff(y,t)+k*y soln=desolve(DE1,y,[0,y0,y1]) spring_frames=[] graph_frames=[] graph=plot(soln,(t,0,stop)) for i in srange(0,stop,0.025*stop): pointgraph=point((i,soln(t=i)),color="red", size=50) graph_frames.append(graph+pointgraph) spring_frames.append(spring(0+soln(t=i),2,-1,.1,10)) spring_anim=animate(spring_frames) graph_anim=animate(graph_frames) show(spring_anim+graph_anim,delay=15) 
       
mass  damping coef.  spring const. 
y(0)  y'(0) 
Maximum t  Use Forcing Term?  Forcing Term 

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