Next topic

mmf.math.special

This Page

mmf.math.ode.test_deqΒΆ

Consider a first-order ODE:

u' = u'(x) = f(x, u(x))

and a transformation to a new set of variables y, v(y) defined by

x(y) = X(y, v(y)) \
u(y) = U(y, v(y))

Taking the differentials we obtain a set of linear equations:

dx = X0(y, v)*dy + X1(y, v)*dv
du = U0(y, v)*dy + U1(y, v)*dv

from which we can isolate

v' = (X0*u' - U0)/(X1*u' - U1)

which may be fully expressed in terms of y and v via the relations.

For a system of first-order equations (and any system can be reduced to this) we have

U'(x) = F(x, U(x))

and a transformation to a new set of variables y, v_i(y) defined by

x = x(y, V)\
U = U(y, V)

Taking the differentials we obtain a set of linear equations:

dx = x0*dy + D*dV
du = U0(y, v)*dy + J*dV

from which we may isolate

We obtain the transformed equations:

from sympy import *

m = 2 for _i in xrange(m+1):

var(‘u%i’ % _i) var(‘v%i’ % _i)

x, y, f = var([‘x’,’y’,’f’]) X, U = var([‘X’,’U’]) X1, U1 = var([‘X1’,’U1’]) X2, U2 = var([‘X2’,’U2’])

eq1 = u(x).diff(x,x) - f(x, u(x), u(x).diff(x)) trans = {x: X(y(x), v(y(x))), u(x): U(y(x), v(y(x)))}

sy = {y:y(x), v:v(y(x))} sx = {u:u(x)} simp = {

u(x).diff(x):u1, u(x).diff(x,x):u2, v(y).diff(y).subs(sy):v1, v(y).diff(y,y).subs(sy):v2, X(y,v).diff(y).subs(sy):X1, X(y,v).diff(v).subs(sy):X2, U(y,v).diff(y).subs(sy):U1, U(y,v).diff(v).subs(sy):U2}

{y(x).diff(x):solve(trans[x].diff(x) - 1, y(x).diff(x))[0]} {u1:trans[u(x)].diff(x).subs({v1:v(y).diff(y).subs({y:y(x)})})}

eq1 = u(x).diff(x, x) - (exp(u(x)*x)*u(x).diff(x))