Thread Subject: Solving a system of differential equations

Subject: Solving a system of differential equations

From: Ben

Date: 20 Nov, 2009 18:58:04

Message: 1 of 3

Hello all, first time poster here and as a caveat I have never used Matlab seriously before.
I have a set of vector differential equations (I have written them in LaTex):

(\partial_t - i x) \textbf{b} = -\frac{3}{2 \bar{\omega}_A} b_x \hat{y} + i \textbf{u}

 (\partial_t - i x) \textbf{u} = \frac{2}{\bar{\omega}_A} u_y \hat{x} - \frac{1}{2 \bar{\omega}_A} u_x \hat{y} - \frac{3}{2 \bar{\omega}_A} \partial_x Q \hat{x} - i Q \hat{y} - i \frac{1}{\kappa} Q \hat{z} + i \textbf{b}

\frac{3}{2} \partial_x u_x + i \bar{\omega}_A u_y + \frac{i \bar{\omega}_A}{\kappa} u_z = 0

\textbf{u} and \texbf{b} are vectors in three dimensions and so this is actually a collection of 9 coupled equations. The last vector equation is not directly needed to solve the equations however so we are back to 6 equations.

The omega and kappa are parameters;
i is the imaginary number;
\hat{x}, \hat{y} and \hat{z} are unit vectors
x is the coordinate x

The variable Q can be found by taking the divergence of the second set of equations and solving the helholtz equation to get:
Q = \int_x^{\infty} (-\frac{2}{3} u_y - i \frac{2}{9 k} \bar{\omega}_A u_x){e^{ k (x-x')}} +\int_{-\infty}^x (\frac{2}{3} u_y - i \frac{2}{9 k} \bar{\omega}_A u_x){e^{ -k (x-x')}}

Finally my initial conditions are:
b_x = a gaussian centered at x=0 with FWHM of ~10 or
b_x(0,x) = exp((-ln(2)*x^2)/100 )
b_y(0,x) = 0
b_z(0,x) = 3*i*kappa/omega/2 * d(b_x(0,x))/dx
u_x(0,x)=u_y(0,x)=u_z(0,x)=0

(sorry for lapsing into coding format here)

My question is: Can Matlab solve this?
I've tried Maple and coding my own version of Runge-Kutta with some success though not to the extent I'd like. The ideal situation would be to have Matlab solve these and give the same solution as my code does as a double check.
I'm not too worried that this might take several hours.

Thanks for the help everyone.

Subject: Solving a system of differential equations

From: Torsten Hennig

Date: 21 Nov, 2009 11:32:49

Message: 2 of 3

> Hello all, first time poster here and as a caveat I
> have never used Matlab seriously before.
> I have a set of vector differential equations (I have
> written them in LaTex):
>
> (\partial_t - i x) \textbf{b} = -\frac{3}{2
> \bar{\omega}_A} b_x \hat{y} + i \textbf{u}
>
> (\partial_t - i x) \textbf{u} =
> = \frac{2}{\bar{\omega}_A} u_y \hat{x} - \frac{1}{2
> \bar{\omega}_A} u_x \hat{y} - \frac{3}{2
> \bar{\omega}_A} \partial_x Q \hat{x} - i Q \hat{y} -
> i \frac{1}{\kappa} Q \hat{z} + i \textbf{b}
>
> \frac{3}{2} \partial_x u_x + i \bar{\omega}_A u_y +
> \frac{i \bar{\omega}_A}{\kappa} u_z = 0
>
> \textbf{u} and \texbf{b} are vectors in three
> dimensions and so this is actually a collection of 9
> coupled equations. The last vector equation is not
> directly needed to solve the equations however so we
> are back to 6 equations.
>
> The omega and kappa are parameters;
> i is the imaginary number;
> \hat{x}, \hat{y} and \hat{z} are unit vectors
> x is the coordinate x
>
> The variable Q can be found by taking the divergence
> of the second set of equations and solving the
> helholtz equation to get:
> Q = \int_x^{\infty} (-\frac{2}{3} u_y - i \frac{2}{9
> k} \bar{\omega}_A u_x){e^{ k (x-x')}}
> +\int_{-\infty}^x (\frac{2}{3} u_y - i \frac{2}{9 k}
> \bar{\omega}_A u_x){e^{ -k (x-x')}}
>
> Finally my initial conditions are:
> b_x = a gaussian centered at x=0 with FWHM of ~10 or
> b_x(0,x) = exp((-ln(2)*x^2)/100 )
> b_y(0,x) = 0
> b_z(0,x) = 3*i*kappa/omega/2 * d(b_x(0,x))/dx
> u_x(0,x)=u_y(0,x)=u_z(0,x)=0
>
> (sorry for lapsing into coding format here)
>
> My question is: Can Matlab solve this?
> I've tried Maple and coding my own version of
> Runge-Kutta with some success though not to the
> extent I'd like. The ideal situation would be to
> have Matlab solve these and give the same solution as
> my code does as a double check.
> I'm not too worried that this might take several
> hours.
>
> Thanks for the help everyone.

Please write out formulas in ASCII, not in TEX.
It enormously improves readability.

Best wishes
Torsten.

Subject: Solving a system of differential equations

From: Ben

Date: 21 Nov, 2009 13:06:04

Message: 3 of 3

Sorry, I had them all written in a pdf so I was being lazy and copy and pasting.
Here they are in a hopefully more readable form:

d/dt bx - i*x*bx = i*ux
d/dt by - i*x*by = 3*bx/(2*omega) + i*uy
d/dt bz - i*x*bz = i*uz

d/dt ux - i*x*ux = 2*uy/omega - 3/(2*omega) * d/dx Q +i*bx
d/dt uy - i*x*uy = -1/(2*omega) * ux - i*Q + i*by
d/dt uz - i*x*uz = -i/kappa * Q + i*bz

with Q = int_x^{\infty} (-2/3 * u_y - i*2*omega*ux/9k)*{e^{ k (x-x')}}
 +int_{-\infty}^x (2/3 * u_y - i*2*omega*ux/9k)*e^{ -k (x-x')}

The initial conditions are the same and I forgot to mention what k is.
k = (2*omega/3)*sqrt(1+1/kappa^2)

I hope this helps.


> Please write out formulas in ASCII, not in TEX.
> It enormously improves readability.
>
> Best wishes
> Torsten.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com