Start a topic
With the exception of Windchill, The PTC Community is on read-only status until April 6 in preparation for moving our community to a new platform. Learn more here
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community is on temporary read only status in preparation for moving our community to a new platform. Learn more here

Translate the entire conversation x

Probem with ODE solvers with units

rgunwaldsen
15-Moonstone

Probem with ODE solvers with units

I normaly use odesolve in a solve block.

 

However, I.m struggling to learn how to use the other ODE solvers with units. I asked AI to provide an example. Sadly, the AI example also failed. Typical (cryptic error messages:

 

 
 

ODE errors.png

Mathcad Prime 11 file attached.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:rgunwaldsen)

I am not sure if these stand alone solvers are meant to work with units.

I experienced some discrepancies:

1) For rkfixed to work OK the matrix D must be made dimensionless, the initial conditions can be supplied with units

grafik.png

 

2) For RKadapt to work OK, the initial conditions must be dimensionless but D can be used as it is

grafik.png

 

In both cases s0 is (erroneously) dimensionless, but the results for s1 and s2 come out with the correct units when rkfixed is used.
Both functions don't seem to care about the units used in x.start and x.end. It doesn't matter if we apply units here or not.

Quite inconsistent. But as we don't know, if these functions are meant to be used with units (the help is not helpul, just talking about real values and scalars but isn't mentioning units) we can't say if we are experiencing bugs or just side effects because of incorrectly using the functions with units.

 

BTW, I found a 14 year old thread which also covers inconsistencies of the stand alone solvers when using units -> Units in the rkfixed function

 

And because you mentioned AI. I don't believe much in AI, and the accuracy of the answers you get from it is, at the very least, highly questionable. Nevertheless, here is the answer provided by Google's AI:

grafik.png

View solution in original post

3 REPLIES 3
Werner_E
25-Diamond I
(To:rgunwaldsen)

I am not sure if these stand alone solvers are meant to work with units.

I experienced some discrepancies:

1) For rkfixed to work OK the matrix D must be made dimensionless, the initial conditions can be supplied with units

grafik.png

 

2) For RKadapt to work OK, the initial conditions must be dimensionless but D can be used as it is

grafik.png

 

In both cases s0 is (erroneously) dimensionless, but the results for s1 and s2 come out with the correct units when rkfixed is used.
Both functions don't seem to care about the units used in x.start and x.end. It doesn't matter if we apply units here or not.

Quite inconsistent. But as we don't know, if these functions are meant to be used with units (the help is not helpul, just talking about real values and scalars but isn't mentioning units) we can't say if we are experiencing bugs or just side effects because of incorrectly using the functions with units.

 

BTW, I found a 14 year old thread which also covers inconsistencies of the stand alone solvers when using units -> Units in the rkfixed function

 

And because you mentioned AI. I don't believe much in AI, and the accuracy of the answers you get from it is, at the very least, highly questionable. Nevertheless, here is the answer provided by Google's AI:

grafik.png

Werner_E
25-Diamond I
(To:Werner_E)

In the thread I linked to above Viktor Korobov mentioned that Radau worked OK, so I gave it a try.

It looks like Radau can be used with units and the results come with correct units as well.

grafik.png

I asked Googles AI and the answer was the same as with rkfixed - "No, the radau function in Mathcad Prime cannot be used with units."

rgunwaldsen
15-Moonstone
(To:Werner_E)

Thanks Werner -- you da Man!

Announcements


Top Tags