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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Translate the entire conversation x

Odesolve problem

XDN
14-Alexandrite
14-Alexandrite

Odesolve problem

After several attempts I can't understand what is not working, please can you look at the attached sheet
 
XDN_0-1751291708858.png

 

 
ACCEPTED SOLUTION

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

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).

View solution in original post

7 REPLIES 7
XDN
14-Alexandrite
14-Alexandrite
(To:XDN)

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

XDN_0-1751295030632.png

Mathcad say :"unknow error"

i update my sheet here

Werner_E
25-Diamond I
(To:XDN)

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

ttokoro
21-Topaz I
(To:XDN)

image.pngimage.pngimage.png

Werner_E
25-Diamond I
(To:ttokoro)

Yeah, I forgot about Prime's new ability to solve simple ODEs symbolically as well.

When using the symbolic solver I would prefer to do it without specific numbers first and use the pure symbolic solution.

Its now easy to compare with different constants a, b or a different initial condition.

Of course something similar could also be done using a parametrized solve block, but the symbolic solution of this ODE is so simple that its easy to use it.

Werner_E_0-1751329870012.png

 

The symbolic result also clearly shows the limit b/a for t going up to infinity. Unfortunately Prime's symbolics seems not to be capable enough to see that, too 😞

Werner_E_2-1751331111401.png

 

Old Mathcad 15 does a much better job here

Werner_E_1-1751331051619.png

but then, MC15 can't solve ODEs symbolically (at least not out-of-the-box) 😉

 

Prime 11 sheet attached

 

Werner_E
25-Diamond I
(To:XDN)

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).

XDN
14-Alexandrite
14-Alexandrite
(To:Werner_E)

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

 

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

Werner_E
25-Diamond I
(To:XDN)


@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".

 

Announcements


Top Tags