dsolve ignore the initial conditions

35 views
Skip to first unread message

amsympy

unread,
Sep 1, 2015, 7:22:45 PM9/1/15
to sympy

I wrote the following problem to solve the Euler-Lagrange equation using dsolve. But sympy dot not provide me the particular solution of the Euler-equation, that is, with or without the initial conditions (ics), sympy give me the same result (the general solution). It seems that sympy does not take into account the ics provided.

The program:
=========

# -*- coding: utf-8 -*-

from sympy import Symbol, Function, diff
from sympy.calculus.euler import euler_equations
from sympy.solvers.ode import dsolve
from sympy import init_printing

init_printing()

x = Function('x')

t = Symbol('t')

# Integrand
L = 1 + diff(x(t),t)**2


# Euler-Lagrange equation
eq = euler_equations(L, x(t), t)


# Genral solution (without ics)

dsolve(eq[0],x(t))


# Particular solution (the initial conditions (ics) are specified)

s = dsolve(eq[0], x(t), ics = {x(0): 1, x(1): 2})

Reply all
Reply to author
Forward
0 new messages