From: Rorie Thomson on
Thanks, the BC now works fine, and my file is 'working'. However, there is an error appearing when i run.

??? Error using ==> bvp4c
Unable to solve the collocation equations -- a singular Jacobian encountered

Error in ==> constants_defined at 23
sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)

So, i gather that everything is fine, other than my guess. From what i can make out, my guess must be incorrect and so, is throwing MATLAB off the correct path?

I know what the approximate curve should look like, and i also know some values at certain points. But this is not helping MATLAB apparently. I have a file with for loops stating that when x= something, then my y matrix (with my T, y, dyds and x) equals something. Under each part i have y=[T y dyds x] (with numerical figures obviously). Is it possible to, for example, say that T is unknown, but y dyds and x are all known? Or, is there something else you can suggest to help get around the jacobian error?

Many thanks

Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <197082822.23761.1262766853621.JavaMail.root(a)gallium.mathforum.org>...
> > 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
> >
From: Torsten Hennig on
> Thanks, the BC now works fine, and my file is
> 'working'. However, there is an error appearing when
> i run.
>
> ??? Error using ==> bvp4c
> Unable to solve the collocation equations -- a
> singular Jacobian encountered
>
> Error in ==> constants_defined at 23
> sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)
>
> So, i gather that everything is fine, other than my
> guess. From what i can make out, my guess must be
> incorrect and so, is throwing MATLAB off the correct
> path?
>

I don't think that the difficulties encountered
with the singular Jacobian stem from your initial
guess.
If the code is not that long, you should post it
here so that we could look over it.

Best wishes
Torsten.


> I know what the approximate curve should look like,
> and i also know some values at certain points. But
> this is not helping MATLAB apparently. I have a file
> with for loops stating that when x= something, then
> my y matrix (with my T, y, dyds and x) equals
> something. Under each part i have y=[T y dyds x]
> (with numerical figures obviously). Is it possible
> to, for example, say that T is unknown, but y dyds
> and x are all known? Or, is there something else you
> can suggest to help get around the jacobian error?
>
> Many thanks
>
> Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote
> in message
> <197082822.23761.1262766853621.JavaMail.root(a)gallium.m
> athforum.org>...
> > > 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
> > >
From: Rorie Thomson on
Ok, it is within 3 files.

function constants_defined

%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

global S0 V0 s0

%_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_%
%SOLINIT for guess of plot
s=linspace(0,1,100);
solinit = bvpinit(s,'guess');
%_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_%
%BVP4C Runner using ODE file, Boundary conditions and guess
sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)
x = sol.x;
y = sol.y;
plot(x,y)
%_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_%
%Set up Boundary Conditions
function res = ZeroHarmBC(ya,yb)
res = [ ya(2) - 0
ya(3) - 1
ya(4) - 0
yb(2)- 0.05];

Next file is

function y = guess(x)
if x<0.05
y=[0.0036687 0 1 0];
else if x<0.15
y=[0.0036687 0.1 0 0];
else if x<0.25
y=[0.0036687 0.17071 0 0.07071];
else if x<0.35
y=[0.0036687 0.17071 0.7071 0.17071];
else if x<0.45
y=[0.0036687 0.1 0 0.2414];
else
y=[0.0036687 0.05 0 0.8414];
end
end
end
end
end

Next file is

function dyds=ZeroHarmODE(s,y)

global S0 V0 s0
s0=0.05;
S0=1;
V0=0;

% After manipulation, a vector y=[T0, y0, dy/ds, x0]
% is created and can be plugged into the equations as
%follows

%dyds=[dy1/ds, dy2/ds, dy3/ds, dy4/ds]

%dy1/ds = y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(3)-2*pi*y(1)*V0
%dy2/ds = y(3)
%dy3/ds =
%-8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2*y(2))-((2*pi*
%y(2)*S0*dxds)/y1)-((2*pi*y(2)*V0*y(3))/y1)
%dy4/ds=sqrt(1-4*pi^2*y(2)^2-y(3)^2)

%But dy4/ds could become negitive, creating negative numbers. so an 'if
%loop' is required to stop it going negative

if 1-4*pi^2*y(2)^2-y(3)^2 <1e-12
dxds=0;
else
dxds=sqrt(1-4*pi^2*y(2)^2-y(3)^2);
end

if s<s0
dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(3)-2*pi*y(1)*V0;
y(3);
-8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2*y(2))-((2*pi*y(2)*S0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))/y(1));
dxds];
else
dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(3)-2*pi*y(1)*V0;
y(3);
-8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2*y(2))-((2*pi*y(2)*0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))/y(1));
dxds];
end

Hope this makes sense.....


Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <2057684377.31037.1262860238495.JavaMail.root(a)gallium.mathforum.org>...
> > Thanks, the BC now works fine, and my file is
> > 'working'. However, there is an error appearing when
> > i run.
> >
> > ??? Error using ==> bvp4c
> > Unable to solve the collocation equations -- a
> > singular Jacobian encountered
> >
> > Error in ==> constants_defined at 23
> > sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)
> >
> > So, i gather that everything is fine, other than my
> > guess. From what i can make out, my guess must be
> > incorrect and so, is throwing MATLAB off the correct
> > path?
> >
>
> I don't think that the difficulties encountered
> with the singular Jacobian stem from your initial
> guess.
> If the code is not that long, you should post it
> here so that we could look over it.
>
> Best wishes
> Torsten.
>
>
> > I know what the approximate curve should look like,
> > and i also know some values at certain points. But
> > this is not helping MATLAB apparently. I have a file
> > with for loops stating that when x= something, then
> > my y matrix (with my T, y, dyds and x) equals
> > something. Under each part i have y=[T y dyds x]
> > (with numerical figures obviously). Is it possible
> > to, for example, say that T is unknown, but y dyds
> > and x are all known? Or, is there something else you
> > can suggest to help get around the jacobian error?
> >
> > Many thanks
> >
> > Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote
> > in message
> > <197082822.23761.1262766853621.JavaMail.root(a)gallium.m
> > athforum.org>...
> > > > 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
> > > >
From: Torsten Hennig on
> Ok, it is within 3 files.
>
> function constants_defined
>
> %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
>
> global S0 V0 s0
>
> %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> -_-_-_-_-_-_%
> %SOLINIT for guess of plot
> s=linspace(0,1,100);
> solinit = bvpinit(s,'guess');
> %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> -_-_-_-_-_-_%
> %BVP4C Runner using ODE file, Boundary conditions and
> guess
> sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)
> x = sol.x;
> y = sol.y;
> plot(x,y)
> %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> -_-_-_-_-_-_%
> %Set up Boundary Conditions
> function res = ZeroHarmBC(ya,yb)
> res = [ ya(2) - 0
> ya(3) - 1
> ya(4) - 0
> yb(2)- 0.05];
>
> Next file is
>
> function y = guess(x)
> if x<0.05
> y=[0.0036687 0 1 0];
> else if x<0.15
> y=[0.0036687 0.1 0 0];
> else if x<0.25
> y=[0.0036687 0.17071 0 0.07071];
> else if x<0.35
> y=[0.0036687 0.17071 0.7071 0.17071];
> else if x<0.45
> y=[0.0036687 0.1 0 0.2414];
> else
> y=[0.0036687 0.05 0 0.8414];
> end
> end
> end
> end
> end
>
> Next file is
>
> function dyds=ZeroHarmODE(s,y)
>
> global S0 V0 s0
> s0=0.05;
> S0=1;
> V0=0;
>
> % After manipulation, a vector y=[T0, y0, dy/ds, x0]
> % is created and can be plugged into the equations as
> %follows
>
> %dyds=[dy1/ds, dy2/ds, dy3/ds, dy4/ds]
>
> %dy1/ds =
> y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(3)-2*pi
> *y(1)*V0
> %dy2/ds = y(3)
> %dy3/ds =
> %-8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> *y(2))-((2*pi*
> %y(2)*S0*dxds)/y1)-((2*pi*y(2)*V0*y(3))/y1)
> %dy4/ds=sqrt(1-4*pi^2*y(2)^2-y(3)^2)
>
> %But dy4/ds could become negitive, creating negative
> numbers. so an 'if
> %loop' is required to stop it going negative
>
> if 1-4*pi^2*y(2)^2-y(3)^2 <1e-12
> dxds=0;
> else
> dxds=sqrt(1-4*pi^2*y(2)^2-y(3)^2);
> end
>
> if s<s0
>
>
>
> dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(
> 3)-2*pi*y(1)*V0;
> y(3);
>
>
>
> -8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> *y(2))-((2*pi*y(2)*S0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))
> /y(1));
> dxds];
> else
>
>
>
> dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(
> 3)-2*pi*y(1)*V0;
> y(3);
>
>
>
> -8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> *y(2))-((2*pi*y(2)*0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))/
> y(1));
> dxds];
> end
>
> Hope this makes sense.....
>

1. You don't prescribe any boundary condition for y(1).
This is not possible and is the source for the
error message of a singular Jacobian.
2. As an initial guess, _never_ choose
a discontinuous function. The solver has to calculate
first derivatives of this function !! So the initial
guess should at least be once continuously
differentiable.
3. There are inconsistencies between the equations
in the header of your file and their
implementation in the code.
You should again check your equations.

Best wishes
Torsten.
From: Rorie Thomson on
Thanks,

I have now fixed my equations so that they are correct...that is sure not going to help me!

I do not know a value for T0, or as it is written in my equations, y(1), which is why i did not put in a boundary condition for it. Is there not a way to avoid putting it in? What about the 'parameters' function...can i do something with that?

Thanks

Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <695573348.36021.1262935964212.JavaMail.root(a)gallium.mathforum.org>...
> > Ok, it is within 3 files.
> >
> > function constants_defined
> >
> > %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
> >
> > global S0 V0 s0
> >
> > %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > -_-_-_-_-_-_%
> > %SOLINIT for guess of plot
> > s=linspace(0,1,100);
> > solinit = bvpinit(s,'guess');
> > %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > -_-_-_-_-_-_%
> > %BVP4C Runner using ODE file, Boundary conditions and
> > guess
> > sol = bvp4c('ZeroHarmODE',@ZeroHarmBC,solinit)
> > x = sol.x;
> > y = sol.y;
> > plot(x,y)
> > %_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
> > -_-_-_-_-_-_%
> > %Set up Boundary Conditions
> > function res = ZeroHarmBC(ya,yb)
> > res = [ ya(2) - 0
> > ya(3) - 1
> > ya(4) - 0
> > yb(2)- 0.05];
> >
> > Next file is
> >
> > function y = guess(x)
> > if x<0.05
> > y=[0.0036687 0 1 0];
> > else if x<0.15
> > y=[0.0036687 0.1 0 0];
> > else if x<0.25
> > y=[0.0036687 0.17071 0 0.07071];
> > else if x<0.35
> > y=[0.0036687 0.17071 0.7071 0.17071];
> > else if x<0.45
> > y=[0.0036687 0.1 0 0.2414];
> > else
> > y=[0.0036687 0.05 0 0.8414];
> > end
> > end
> > end
> > end
> > end
> >
> > Next file is
> >
> > function dyds=ZeroHarmODE(s,y)
> >
> > global S0 V0 s0
> > s0=0.05;
> > S0=1;
> > V0=0;
> >
> > % After manipulation, a vector y=[T0, y0, dy/ds, x0]
> > % is created and can be plugged into the equations as
> > %follows
> >
> > %dyds=[dy1/ds, dy2/ds, dy3/ds, dy4/ds]
> >
> > %dy1/ds =
> > y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(3)-2*pi
> > *y(1)*V0
> > %dy2/ds = y(3)
> > %dy3/ds =
> > %-8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> > *y(2))-((2*pi*
> > %y(2)*S0*dxds)/y1)-((2*pi*y(2)*V0*y(3))/y1)
> > %dy4/ds=sqrt(1-4*pi^2*y(2)^2-y(3)^2)
> >
> > %But dy4/ds could become negitive, creating negative
> > numbers. so an 'if
> > %loop' is required to stop it going negative
> >
> > if 1-4*pi^2*y(2)^2-y(3)^2 <1e-12
> > dxds=0;
> > else
> > dxds=sqrt(1-4*pi^2*y(2)^2-y(3)^2);
> > end
> >
> > if s<s0
> >
> >
> >
> > dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(
> > 3)-2*pi*y(1)*V0;
> > y(3);
> >
> >
> >
> > -8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> > *y(2))-((2*pi*y(2)*S0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))
> > /y(1));
> > dxds];
> > else
> >
> >
> >
> > dyds=[y(1)*((8*(pi^2)*y(2))/(1-4*(pi^2)*(y(2)^2)))*y(
> > 3)-2*pi*y(1)*V0;
> > y(3);
> >
> >
> >
> > -8*pi^2*y(2)*y(3)^2/(1-4*pi^2*y(2)^2)+(2*pi*V0+4*pi^2
> > *y(2))-((2*pi*y(2)*0*dxds)/y(1))-((2*pi*y(2)*V0*y(3))/
> > y(1));
> > dxds];
> > end
> >
> > Hope this makes sense.....
> >
>
> 1. You don't prescribe any boundary condition for y(1).
> This is not possible and is the source for the
> error message of a singular Jacobian.
> 2. As an initial guess, _never_ choose
> a discontinuous function. The solver has to calculate
> first derivatives of this function !! So the initial
> guess should at least be once continuously
> differentiable.
> 3. There are inconsistencies between the equations
> in the header of your file and their
> implementation in the code.
> You should again check your equations.
>
> Best wishes
> Torsten.