Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Chemeng Problem: Floating Point Error Runge-Kutta ...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-04-2013
12:07 PM

04-04-2013
12:07 PM

Chemeng Problem: Floating Point Error Runge-Kutta 4th order

Hello! I am a newbie to this community . I would really appreciate any help with my problem.

First of all, i was asked to apply the Runge-Kutta 4th order method to solve this problem.

I managed to get something out of this, but when i change the value of the rate constant (k), for valutes >2, i get a floating point error.

My aim is to get 9 different k (rate constants), ranging from 1 to 10, in order to get (via the Runge-Kutta) the C values of my components (i have named them x and y) . Then the C-t curves will be compared with my experimental curve.

However, whenever the value of k is greater than 2, i get a floating point error . Any advice?

Any suggestions or corrections would really be appreciated.

I attach you the mathcad file:

Labels:

3 REPLIES 3

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-04-2013
12:41 PM

04-04-2013
12:41 PM

Re: Chemeng Problem: Floating Point Error Runge-Kutta 4th order

You algorithm doesn't seem to converge.

For k:=3 its the iteration step at i=48 which throws the error.

x.48=y.48=5.89*^10^291. Your functions f multiplies x and y and the result would exceed Mathcads limit of approx. 10^307, so you get the error.

You can insert a trace command in your program and toggle debug (menu/tools) to watch the variables in your program.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-04-2013
12:54 PM

04-04-2013
12:54 PM

Re: Chemeng Problem: Floating Point Error Runge-Kutta 4th order

Mathematic is not mathematic without animation

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

04-04-2013
04:35 PM

04-04-2013
04:35 PM

Re: Chemeng Problem: Floating Point Error Runge-Kutta 4th order

Well guys, thanks for the posts! I found the problem. It was a problem at the mass balances (should have a minus not a plus in front of k). The solutions i had with k=1 and k=2 were unrealistic in a chemical way (CNaOH was valued way greater than it should have been), σο i rechecked the problem.

Thanks for your help Werner! One word (not converge) gave me a serious hint!

Have a nice day!