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
- :
- Coupled differential equations issue

Options

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

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

Showing results for

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

11-06-2013
09:58 AM

11-06-2013
09:58 AM

Coupled differential equations issue

I Am having an issue with writing down coupled differential equations for radioactive decay! What is know is

dN/dt=-λN

so N=N0exp-λt

where λ=ln(2)/τ where τ is the half life of each element

I calculated all of the λ values and was then asked to write down the couples differential equations for the decay/creation of each element

dNn/dt=λn-1*Nn-1 -λnNn

NNot sure how to do this on MathCad!

They will be getting solved via rkfixed function but when I input the equations in the form above I get "a name is required here" error

There is an image below with my question sheet! Any help would be great

11 REPLIES 11

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

11-06-2013
10:46 AM

11-06-2013
10:46 AM

Re: Coupled differential equations issue

Maybe you would like to show what you have done so far by posting your Mahcad sheet.

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

11-06-2013
10:48 AM

11-06-2013
10:48 AM

Re: Coupled differential equations issue

HHow do I do that?

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

11-06-2013
10:55 AM

11-06-2013
10:55 AM

Re: Coupled differential equations issue

Alison McMillan wrote:

HHow do I do that?

The same way as you attached your pic.

But in a reply you have to switch to "advanced editor" first. You do so by clicking "Use advanced editor" at the upper right.

Now you have the option to attach files at the end.

There is no need to zip the files yourself as this will be done automatically.

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

11-06-2013
11:08 AM

11-06-2013
11:08 AM

Re: Coupled differential equations issue

That should be it:)

any help would be fantastic!

Im trying to write the equations in the form at the top of the sheet I posted so I can use the rkfixed function!

I am not very good with mathcad as im am just learning

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

11-06-2013
03:21 PM

11-06-2013
03:21 PM

Re: Coupled differential equations issue

The suggestion to use "rkfixed" in the text isn't a good one. If you use rkfixed, values will run out of range as of numerical inaccuracies because of the fixed step size. Values are getting higher than 10^307 (while actually an increase of atoms is not possible of course) and so rkfixed will throw an error. Rkadapt with its adaptive step size works well, though.

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

11-06-2013
04:34 PM

11-06-2013
04:34 PM

Re: Coupled differential equations issue

BBrilliant thanks for all your help!! Do you think I should perhaps remark that rkfixed will not work in this case?

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

11-06-2013
04:49 PM

11-06-2013
04:49 PM

Re: Coupled differential equations issue

Do you think I should perhaps remark that rkfixed will not work in this case?

Feel free to do so, but see for yourself what happens first.

change Rkadapt to rkfixed and you get an error. If you decrease the numper of points calculated significantly from 1000 to 37, you get a "solution" but its obviously wrong. Using max() you can see that the highest value calculated is around 10^303, so this algorithm is completely inappropriate for this set of DEs.

EDIT: See Alan's post on this topic, please. While Rkadapt may be the better choice, I was definitely wrong in writing that rkfixed is "completely inappropriate" here. The error was my way of using it. Do as Alan suggests and set the number of points to something like 10^4 and it works OK, too.

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

11-06-2013
05:16 PM

11-06-2013
05:16 PM

Re: Coupled differential equations issue

Werner Exinger wrote:

... If you use rkfixed, values will run out of range as of numerical inaccuracies because of the fixed step size.

Try using 10000 steps with rkfixed.

Alan

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

11-06-2013
05:34 PM

11-06-2013
05:34 PM

Re: Coupled differential equations issue

AlanStevens wrote:

Werner Exinger wrote:

... If you use rkfixed, values will run out of range as of numerical inaccuracies because of the fixed step size.

Try using 10000 steps with rkfixed.

Alan

Thanks! Of course you are right, the stepsize was too big. Nevertheless I think that Rkadapt is the better choice.

As I posted that "Fixed" worked OK using the solveblock just a moment before: I just checked and I had set (mistakenly) the Number of points to 10000 (wanted to type 1000) as you suggested. That was the reason it worked. Using NrPt:=1000 the solveblock consequently fails, too.

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

11-06-2013
05:28 PM

11-06-2013
05:28 PM

Re: Coupled differential equations issue

Mathcad offers a more natural way to write and solve differential equations, namely via a solve block and the function odesolve(). You can select the numeric algorithm used by right clicking the word Odesolve. Normally there should be no reason to change the default "Adams/BDF"- Interestingly enough even chosing "Fixed" gives a satisfacory result this time.

Again also this function unfortunately does not support units in Mathcad 15 and below. One of the few advantages of Prime is that you are allowed to use units with odesolve, too.

EDIT: Again, see Alans post. It should NOT be surprising that "Fixed" works here. The reason is that I had set the number of points to 10^4 in this sheet (without being aware of 😉

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

11-06-2013
06:23 PM

11-06-2013
06:23 PM

Re: Coupled differential equations issue

Thanks so much guys, you have been great help:)

I think I understand where I was going wrong! MathCad is extremely tedious at time especially for a beginner like me!

Thanks again much appreciated