```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Solving second order differential equations
Date: Thu, 25 Nov 2010 23:58:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <icmt6c\$36s\$1@fred.mathworks.com>
References: <icm404\$2pn\$1@fred.mathworks.com> <icm9ap\$5nr\$1@fred.mathworks.com> <icmmb3\$je7\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1290729484 3292 172.30.248.38 (25 Nov 2010 23:58:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Nov 2010 23:58:04 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:690103

"Sridatta Pasumarthy" <sridatta1988@gmail.com> wrote in message <icmmb3\$je7\$1@fred.mathworks.com>...
> Hi,
> f,g,h are not unknowns. i know the expressions for them. (they stand out for some forms of the electric and magnetic field components of an electromagnetic wave in a waveguide). fifth equation defines w in terms of x' , y' , z'. i don't think the first equation is needed for solving because it is related to the final answer i am supposed to find. i just gave it assuming that it might be of extra help. the principal problem constitutes final four equations.
- - - - - - - -
If you discard the first equation, then you can express this problem as a system of three second order differential equations in three unknown variables:

x'' = (c*g(z) * y') * (1 - x'^2 - y'^2 - z'^2)^2
y'' = (f(z) + g(z) * x' + j(z) * z') * (1 - x'^2 - y'^2 - z'^2)^2
z'' = (c*j(z) * y') * (1 - x'^2 - y'^2 - z'^2)^2

If you wish to solve it numerically for variables x, y, and z, you would express it with six equations.  Call p = x', q = y', and r = z'.

dp/dt = (c*g(z)*q) * (1-p^2-q^2-r^2)^2
dx/dt = p
dq/dt = (f(z)+g(z)*p+j(z)*r) * (1-p^2-q^2-r^2)^2
dy/dt = q
dr/dt = (c*j(z)*q) * (1-p^2-q^2-r^2)^2
dz/dt = r

See the documentation of the 'ode' functions for the details on this.

Notice that the variables x and y never appear in the earlier equations, so if you don't need them specifically, you could simple solve for p, q, and z using only four equations, leaving dx/dt and dy/dt out.

I see no particular reason why your original first equation should hold true as to the derivative of w as obtained from the fifth equation unless you were especially lucky in your defined functions, f, g, and j and constant c.

Roger Stafford
```