Skip to main content
14-Alexandrite
June 30, 2025
Solved

Odesolve problem

  • June 30, 2025
  • 2 replies
  • 838 views
After several attempts I can't understand what is not working, please can you look at the attached sheet
 
XDN_0-1751291708858.png

 

 
Best answer by Werner_E

I had a quick look at your first sheet now. In contrast to the second sheet, the units are correct here, but you used a wrong syntax for "odesolve" (look it up in the help).

If we fix this we still get a very strange error message as of Odesolve having less than 2 arguments, which definitely is not true.

Looks like a bad bug in Prime. Reason are the inline evaluations of a an b in the solve block!

There are two workarounds:

1) (preferred solution) define the constants outside and in front of the solve block. They have no direct relation to the Solve block, so they don't belong there anyway:

Werner_E_0-1751300690144.png

 

2) Omit the inline assignment to avoid running into the Prime bug. You may evaluate a and b for reference in separate regions

Werner_E_2-1751300866328.png

 

Incidentally, it has always been a good idea to avoid inline evaluations in Mathcad and to display the result of a calculation in a separate region. It usually works well, but it can also cause unexpected problems (especially in connection with matrices or, as is now the case here in the Solve Block).

2 replies

XDN14-AlexandriteAuthor
14-Alexandrite
June 30, 2025

i rewrite ... but's it's wrong

XDN_0-1751295030632.png

Mathcad say :"unknow error"

i update my sheet here

25-Diamond I
June 30, 2025

I can spot three errors in your last sheet:

 

1) wrong units. if you want omega to have the unit rad/s^2 as your initial condition indicates, then omega' is rad/s^3. 

Now you try to add a*omega with unit rad^2/s^3 and b with unit rad/s^2. This cant work.
You have to fix this unit problem. I did it by assigning omega in the initial condition to rad/s. Its up to you if you also use just the unit 1/s for a. "rad" basically is just one, so rad^2 and rad makes no difference for Prime.

 

2) wrong syntax. odesolve returns an interpolated function and you must assign the result a function name without the argument

 

3) wrong argument. You tried to evaluate omega(3s) but your solve block only solves for omega in the range from 0.2639 s to 0.5 s. 3s is outside this range. But you sure can evaluate omega(0.3 s).

Werner_E_1-1751298244306.png

It looks like a bug in Prime that we get an error message when we try to change the unit for omega to something else like rad/s.

Reason is the range of invalid arguments at the start where omega can not be evaluated.

If we use only valid values for the range variable, we also are allowed to change the unit at the ordinate axis. Its also a good idea to use variables for start and end value of t and to position the definition of the constants a and b outside and in front of the solve block:

Werner_E_3-1751301937636.png

 

 

Prime 11 sheet attached

Werner_E25-Diamond IAnswer
25-Diamond I
June 30, 2025

I had a quick look at your first sheet now. In contrast to the second sheet, the units are correct here, but you used a wrong syntax for "odesolve" (look it up in the help).

If we fix this we still get a very strange error message as of Odesolve having less than 2 arguments, which definitely is not true.

Looks like a bad bug in Prime. Reason are the inline evaluations of a an b in the solve block!

There are two workarounds:

1) (preferred solution) define the constants outside and in front of the solve block. They have no direct relation to the Solve block, so they don't belong there anyway:

Werner_E_0-1751300690144.png

 

2) Omit the inline assignment to avoid running into the Prime bug. You may evaluate a and b for reference in separate regions

Werner_E_2-1751300866328.png

 

Incidentally, it has always been a good idea to avoid inline evaluations in Mathcad and to display the result of a calculation in a separate region. It usually works well, but it can also cause unexpected problems (especially in connection with matrices or, as is now the case here in the Solve Block).

XDN14-AlexandriteAuthor
14-Alexandrite
July 1, 2025

Thank you Werner, as always you are incredibly efficient.🤗

 

I was really disoriented by this Prime message about the number of arguments...

25-Diamond I
July 1, 2025

@XDN wrote:

Thank you Werner, as always you are incredibly efficient.🤗

 

I was really disoriented by this Prime message about the number of arguments...


Its definitely a bug and you may consider reporting it to PTC support.

I broke it down and EVERY inline evaluation in the solve block provokes this error, even if the variable in question is not used anywhere else.

Werner_E_0-1751359624375.png

The bug seems to be specific to "Odesolve", I could not provoke it in a solve block with "find".