cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Highlighted
Newbie

## solving differential equations

Solving Torricelli's Law for the flow out of a cylindrical tank through a round hole is pretty straight forward. It can be done by direct integration. However, when trying to solve it numerically with rkfixed or odesolve I ran into some unexpected problems.

rkfixed gave the message: D(t,h) must be real ! odesolve would not not converge to the efflux time corresponding to h = o. With the substitution u = sq. root h, it was smooth sailing to use either program. Is this a tolerence issue? Something else? It it a pretty straight forward linear 1st degree differential equation after all!

WSU1963

Tags (2)
7 REPLIES 7

## Re: solving differential equations

I think your problem is that your equation may be trying to reach ln(0) which is not possible. When you changed to the sq root of h, it is trying to reach 0, which it can do. If I'm not correct, then supply the differential equation that you are trying to solve.

## Re: solving differential equations

And where the ODE itself?

## Re: solving differential equations

No problem!

(I didn't try for Odesolve)

Nice work Fred

Wayne

## Re: solving differential equations

Fred,

If you extend the problem beyond the empty time (1015 s), the integration fails, both for rkfixed and Rkadapt. The fix is to limit the value of h to a positive value.

The snip below shows the failure of rkfixed without the h limit and a solution with the limit. Since the time to empty is usually not known, this eliminates trial and error. This may explain the error Donald was getting.

## Re: solving differential equations

Limit h to positive or the radical to real: