From: Rorie Thomson on
I have 3 nonlinear equations which i need to solve simultaneously using bvp4c.

My equations are as follows

%Equations
% (1) (dT/ds)-T*((8*(pi^2)*y)/(1-4*(pi^2)))*(dy/ds)+2*pi*y*V=0
% (2) (dy/ds)-y_prime=0
% (3) T*(dy_prime/s)+(dT/ds)+(dT/ds)*(dy/ds)-T*4*(pi^2)*y+2*pi*y*S*(dx/ds)+2*pi*y*V*(dy/ds)=0
% (4) (dx/ds)^2+(dy/ds)^2+4*(pi^2)*(y^2)=1
%%%%%%%%%%%%%%%%%

The help i have been given so far and have worked out is that it 'should' be possible, i need to solve using bvp4c for each iteration and solve the 4x4 non linear system while using fsolve some how to work out my vaules for dT/ds, dx/ds, dy/ds and dy_prime/ds. Thing is I have no idea how to do this.

do i need to run 4 bvp4c files for each part? I can only find bvp4c examples for equations with one differential in them, not 4 like i have. I understand i can use MATLAB to fsolve, but i do this after i have used bvp4c, correct?

I have seen that when using bvp4c for a problem such as y''+y=0, i would solve for y'=... and work from there using that equation in the bvp4c solver. I am unsure how i should solve my problem for use in the bvp4c solver (or 4 of them depending ) i have multiple differentials in each equation

Thanks!
From: Torsten Hennig on
> I have 3 nonlinear equations which i need to solve
> simultaneously using bvp4c.
>
> My equations are as follows
>
> %Equations
> % (1)
> (dT/ds)-T*((8*(pi^2)*y)/(1-4*(pi^2)))*(dy/ds)+2*pi*y*V
> =0
> % (2) (dy/ds)-y_prime=0
> % (3)
> T*(dy_prime/s)+(dT/ds)+(dT/ds)*(dy/ds)-T*4*(pi^2)*y+2*
> pi*y*S*(dx/ds)+2*pi*y*V*(dy/ds)=0
> % (4) (dx/ds)^2+(dy/ds)^2+4*(pi^2)*(y^2)=1
> %%%%%%%%%%%%%%%%%
>
> The help i have been given so far and have worked out
> is that it 'should' be possible, i need to solve
> using bvp4c for each iteration and solve the 4x4 non
> linear system while using fsolve some how to work out
> my vaules for dT/ds, dx/ds, dy/ds and dy_prime/ds.
> Thing is I have no idea how to do this.
>
> do i need to run 4 bvp4c files for each part? I can
> only find bvp4c examples for equations with one
> differential in them, not 4 like i have. I understand
> i can use MATLAB to fsolve, but i do this after i
> have used bvp4c, correct?
>
> I have seen that when using bvp4c for a problem such
> as y''+y=0, i would solve for y'=... and work from
> there using that equation in the bvp4c solver. I am
> unsure how i should solve my problem for use in the
> bvp4c solver (or 4 of them depending ) i have
> multiple differentials in each equation
>
> Thanks!

To use bvp4c, you have to supply dy/dx in a separate
function (in the examples under

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/bvp4c.html

this function is called dydx).
That's where you have to call fsolve to solve for
dT/ds, dy/ds, dy_prime/ds and dx/ds given T, y, yprime
and x.

By the way: What are the boundary condition for your
system of ODEs ?

Best wishes
Torsten.
From: Torsten Hennig on
> > I have 3 nonlinear equations which i need to solve
> > simultaneously using bvp4c.
> >
> > My equations are as follows
> >
> > %Equations
> > % (1)
> >
> (dT/ds)-T*((8*(pi^2)*y)/(1-4*(pi^2)))*(dy/ds)+2*pi*y*V
>
> > =0
> > % (2) (dy/ds)-y_prime=0
> > % (3)
> >
> T*(dy_prime/s)+(dT/ds)+(dT/ds)*(dy/ds)-T*4*(pi^2)*y+2*
>
> > pi*y*S*(dx/ds)+2*pi*y*V*(dy/ds)=0
> > % (4) (dx/ds)^2+(dy/ds)^2+4*(pi^2)*(y^2)=1
> > %%%%%%%%%%%%%%%%%
> >
> > The help i have been given so far and have worked
> out
> > is that it 'should' be possible, i need to solve
> > using bvp4c for each iteration and solve the 4x4
> non
> > linear system while using fsolve some how to work
> out
> > my vaules for dT/ds, dx/ds, dy/ds and dy_prime/ds.
> > Thing is I have no idea how to do this.
> >
> > do i need to run 4 bvp4c files for each part? I
> can
> > only find bvp4c examples for equations with one
> > differential in them, not 4 like i have. I
> understand
> > i can use MATLAB to fsolve, but i do this after i
> > have used bvp4c, correct?
> >
> > I have seen that when using bvp4c for a problem
> such
> > as y''+y=0, i would solve for y'=... and work from
> > there using that equation in the bvp4c solver. I
> am
> > unsure how i should solve my problem for use in
> the
> > bvp4c solver (or 4 of them depending ) i have
> > multiple differentials in each equation
> >
> > Thanks!
>
> To use bvp4c, you have to supply dy/dx in a separate
> function (in the examples under
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/
> ref/bvp4c.html
>
> this function is called dydx).
> That's where you have to call fsolve to solve for
> dT/ds, dy/ds, dy_prime/ds and dx/ds given T, y,
> yprime
> and x.
>
> By the way: What are the boundary condition for your
> system of ODEs ?
>
> Best wishes
> Torsten.

By the way : in your case, dydx is not a scalar, but a
vector of length 4, e.g. if you use the ordering above,
dy(1)/dx ~ dT/ds
dy(2)/dx ~ dy/ds
dy(3)/dx ~ dy_prime/ds
dy(4)/dx ~ dx/ds.
So you don't have to call bvp4c four times, but you solve
simultaneously for y(1), y(2), y(3) and y(4).

Best wishes
Torsten.
From: Rorie Thomson on
Thanks, Torsten. I have now managed to set up my ODE side of things. I am struggling a bit with the BC and guess part though.

when i am constructing solinit function, and build up my res[ ] with my different points (y(1) to y(4)), how do i fill in things i do not know? for example, if i have y(1)=T, y(2)=y, y(3)=dy/ds and y(4)=x, i have BC that state y=0, x=0, dy/ds=1, but i do not know T. So far i have res = [?; y(2)-1 ; y(3)-1; y(4)-0]

Also, i am confused with the set up of it - all the help guides say to use ya and yb, but i do not have these....

an example i found is as follows

function res = ex1bc(ya,yb)
% as y(1) = u, y(2) = v, y(3) = w, y(4) = z, y(5) = y.
res = [ ya(1) - 1
ya(2) - 1
ya(3) - 1
ya(4) + 10
yb(3) - yb(5)];
why do we use ya and yb, and how does this relate to my case?

My final question relates to the guess, similarly to above, when i create my function vector, how do i only put in guess' for some bits but not all. In my guess, am i stating that when when y(1)= what ever, y(2) will equal something else stated and so on? Similar to the BC except MATLAB will not always work exactly to this as it is only a guess? If so, can i put in a couple guess'?

Thanks again


Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <1225666681.12276.1262594352459.JavaMail.root(a)gallium.mathforum.org>...
> > > I have 3 nonlinear equations which i need to solve
> > > simultaneously using bvp4c.
> > >
> > > My equations are as follows
> > >
> > > %Equations
> > > % (1)
> > >
> > (dT/ds)-T*((8*(pi^2)*y)/(1-4*(pi^2)))*(dy/ds)+2*pi*y*V
> >
> > > =0
> > > % (2) (dy/ds)-y_prime=0
> > > % (3)
> > >
> > T*(dy_prime/s)+(dT/ds)+(dT/ds)*(dy/ds)-T*4*(pi^2)*y+2*
> >
> > > pi*y*S*(dx/ds)+2*pi*y*V*(dy/ds)=0
> > > % (4) (dx/ds)^2+(dy/ds)^2+4*(pi^2)*(y^2)=1
> > > %%%%%%%%%%%%%%%%%
> > >
> > > The help i have been given so far and have worked
> > out
> > > is that it 'should' be possible, i need to solve
> > > using bvp4c for each iteration and solve the 4x4
> > non
> > > linear system while using fsolve some how to work
> > out
> > > my vaules for dT/ds, dx/ds, dy/ds and dy_prime/ds.
> > > Thing is I have no idea how to do this.
> > >
> > > do i need to run 4 bvp4c files for each part? I
> > can
> > > only find bvp4c examples for equations with one
> > > differential in them, not 4 like i have. I
> > understand
> > > i can use MATLAB to fsolve, but i do this after i
> > > have used bvp4c, correct?
> > >
> > > I have seen that when using bvp4c for a problem
> > such
> > > as y''+y=0, i would solve for y'=... and work from
> > > there using that equation in the bvp4c solver. I
> > am
> > > unsure how i should solve my problem for use in
> > the
> > > bvp4c solver (or 4 of them depending ) i have
> > > multiple differentials in each equation
> > >
> > > Thanks!
> >
> > To use bvp4c, you have to supply dy/dx in a separate
> > function (in the examples under
> >
> > http://www.mathworks.com/access/helpdesk/help/techdoc/
> > ref/bvp4c.html
> >
> > this function is called dydx).
> > That's where you have to call fsolve to solve for
> > dT/ds, dy/ds, dy_prime/ds and dx/ds given T, y,
> > yprime
> > and x.
> >
> > By the way: What are the boundary condition for your
> > system of ODEs ?
> >
> > Best wishes
> > Torsten.
>
> By the way : in your case, dydx is not a scalar, but a
> vector of length 4, e.g. if you use the ordering above,
> dy(1)/dx ~ dT/ds
> dy(2)/dx ~ dy/ds
> dy(3)/dx ~ dy_prime/ds
> dy(4)/dx ~ dx/ds.
> So you don't have to call bvp4c four times, but you solve
> simultaneously for y(1), y(2), y(3) and y(4).
>
> Best wishes
> Torsten.
From: Torsten Hennig on
> Thanks, Torsten. I have now managed to set up my ODE
> side of things. I am struggling a bit with the BC
> and guess part though.
>
> when i am constructing solinit function, and build up
> my res[ ] with my different points (y(1) to y(4)),
> how do i fill in things i do not know? for example,
> if i have y(1)=T, y(2)=y, y(3)=dy/ds and y(4)=x, i
> have BC that state y=0, x=0, dy/ds=1, but i do not
> know T. So far i have res = [?; y(2)-1 ; y(3)-1;
> y(4)-0]
>

You need four boundary conditions to solve for
T, y, y_prime and x.
If [s_left;s_right] is the interval of integration,
boundary values for the variables can either be given
at s_left or s_right.
If e.g. T=1 at s_left, you have to specify ya(1)-1.0
in the res-vector, if T=1 at s_right, you have to
specify yb(1)-1.0 in the res-vector.

The guess for the variables you specify in the
solinit routine is arbitrary, but should take into
account the boundary values you specified for
the variables. If e.g. T=1 at s_left or s_right,
the easiest choice for y(1) in the solinit-routine
is T=1 on the _whole_ interval [s_left;s_right].

Hope this clarifies your questions.

Best wishes
Torsten.

> Also, i am confused with the set up of it - all the
> help guides say to use ya and yb, but i do not have
> these....
>
> an example i found is as follows
>
> function res = ex1bc(ya,yb)
> % as y(1) = u, y(2) = v, y(3) = w, y(4) = z, y(5)
> = y.
> res = [ ya(1) - 1
> ya(2) - 1
> ya(3) - 1
> ya(4) + 10
> yb(3) - yb(5)];
> why do we use ya and yb, and how does this relate to
> my case?
>
> My final question relates to the guess, similarly to
> above, when i create my function vector, how do i
> only put in guess' for some bits but not all. In my
> guess, am i stating that when when y(1)= what ever,
> y(2) will equal something else stated and so on?
> Similar to the BC except MATLAB will not always work
> k exactly to this as it is only a guess? If so, can
> i put in a couple guess'?
>
> Thanks again
>