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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

The charts look different in Mathcad 14 and Mathcad Prime 3.0.

Nykus
5-Regular Member

The charts look different in Mathcad 14 and Mathcad Prime 3.0.

Hello.

I have a problem with charts.

 

Everything works fine in Mathcad 14 but in Prime 3.0 i have an error like below:Mathcad Prime 3.0Mathcad Prime 3.0

 

Mathcad 14Mathcad 14

Is this a problem with if-else instruction or something? 

Can you help me?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:Nykus)

It may have to do with the if-else instruction and the min/max functions used there, but the main problem lies in the numeric methods used internally for the calculation of the integral.
PTC has massively changed the numeric algorithms used in Prime and praised the new ones as being much better. Perhaps this is not the case in all cases. As you can see in the following picture (right side) the integral does not converge for some arguments x.c like 0.49 or 0.51). Thats the reason for the gaps in the plot and the error you get when you try to create the vector.

If this happened in real Mathcad you could right click the integral and give another algorithm a try (which is not necessary in case of your integral because "autoselect" did a good job).

Werner_E_1-1599726300834.png

 

But in Prime we have no choice. If the algorithm does not work - bad luck.

Werner_E_2-1599726345314.png

There is one way you can get the sheet to work OK in Prime, too, but its risky. You can play with the setting of the system variable TOL (you may change it in the "calculation" ribbon menu or simply assign it a value at the top of the worksheet like a normal variable). The default setting is 10^-3. If you change it to a ridiculously large value like 0.3 your sheet seems to work OK (at least in Prime 6) but you have to decide for yourself how much you trust the results now. At least I won't expect high precision. Note the difference of the results for the argument 0.51 if you compare the picture of Mathcad and the one of Prime.

 

Werner_E_0-1599726723023.png

BTW, if you set TOL to a lower value (like 10^-9) in real Mathcad, the integral fails now an then, too, and you see some gaps in the plot.

 

Another way to deal with the problem of the vector creation failing could be to write a wrapper function which uses the "try" command (in real mathcad its "on error") to return NaN if the calculation fails. That way the vector can be created, but it will contain a couple of NaNs. If thats a solution for you depends on what you would like to use the vector for. If its just needed to export the results to Excel, the described method should work OK. Of course you could also chose to return a string like "error" instead of NaN or anything else you think is appropriate.

Werner_E_0-1599727315593.png

 

 

 

 

 

 

 

View solution in original post

5 REPLIES 5
Werner_E
24-Ruby V
(To:Nykus)

It may have to do with the if-else instruction and the min/max functions used there, but the main problem lies in the numeric methods used internally for the calculation of the integral.
PTC has massively changed the numeric algorithms used in Prime and praised the new ones as being much better. Perhaps this is not the case in all cases. As you can see in the following picture (right side) the integral does not converge for some arguments x.c like 0.49 or 0.51). Thats the reason for the gaps in the plot and the error you get when you try to create the vector.

If this happened in real Mathcad you could right click the integral and give another algorithm a try (which is not necessary in case of your integral because "autoselect" did a good job).

Werner_E_1-1599726300834.png

 

But in Prime we have no choice. If the algorithm does not work - bad luck.

Werner_E_2-1599726345314.png

There is one way you can get the sheet to work OK in Prime, too, but its risky. You can play with the setting of the system variable TOL (you may change it in the "calculation" ribbon menu or simply assign it a value at the top of the worksheet like a normal variable). The default setting is 10^-3. If you change it to a ridiculously large value like 0.3 your sheet seems to work OK (at least in Prime 6) but you have to decide for yourself how much you trust the results now. At least I won't expect high precision. Note the difference of the results for the argument 0.51 if you compare the picture of Mathcad and the one of Prime.

 

Werner_E_0-1599726723023.png

BTW, if you set TOL to a lower value (like 10^-9) in real Mathcad, the integral fails now an then, too, and you see some gaps in the plot.

 

Another way to deal with the problem of the vector creation failing could be to write a wrapper function which uses the "try" command (in real mathcad its "on error") to return NaN if the calculation fails. That way the vector can be created, but it will contain a couple of NaNs. If thats a solution for you depends on what you would like to use the vector for. If its just needed to export the results to Excel, the described method should work OK. Of course you could also chose to return a string like "error" instead of NaN or anything else you think is appropriate.

Werner_E_0-1599727315593.png

 

 

 

 

 

 

 

Nykus
5-Regular Member
(To:Werner_E)

Thank you Werner_E!

 

I used a TOL variable equal 0.3 and it works. 

Perhaps the result is better than in real mathcad.

 I'm not sure why this is happening but most importantly it helped.

 

You're doing a great job.

Fred_Kohlhepp
23-Emerald I
(To:Nykus)

Perhaps the result is better than in real mathcad.

 

Given a choice between believing Prime or "real mathcad", most of us would believe "real mathcad" until it was proven wrong.

Werner_E
24-Ruby V
(To:Nykus)


Perhaps the result is better than in real mathcad.

 

Why do you think so?

I rewrote the function so the symbolic would accept it an these are the results I got:

Werner_E_0-1599759654869.png

I would say that real Mathcads results are pretty close compared to the results of Prime with that far too large tolerance value.

Nykus
5-Regular Member
(To:Werner_E)

My bad. You're right guys.

 

If i change the fy from 1 to 20 value. Ns for 0.5 should by equal to 0. In real mathcad it's true but in Prime 3.0 not. It's very small (9.704*10^-17) but not 0.

 

Top Tags