On 04/13/2012 01:26 PM, Ning Guo wrote:
> I'm using rk to solve a differential equation set. The script is
> attached. There is a piecewise function I wrote in two ways: q(s) and
> qq(s), where q(s) is simplified from pp(s) so actually they are
> equivalent. But when I use them in the differential equation, one
> (q(s)) is solvable and the other (qq(s)) is not which results in a
> following error:
>
> expt: undefined: 0 to a negative exponent.
>
> Besides, the solved results are also not good (not smooth solution).
> What causes these problems? Thanks.
Hi,
I'm not fully convinced that q(s) and qq(s) are equivalent but I have
not looked at them carefully.
It is also hard to tell whether they are smooth functions, since the
involve numerical integrations using quad-qags.
Have you made a plot2d of q(s) and qq(s)? A numerical problem with one
of the functions and the equivalence and smoothness of them will be
easier to check with plot2d, before using rk.
Cheers,
Jaime