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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Translate the entire conversation x

Strange behavior with vec() vs Range in Formulas and Graphs in Mathcad Prime 11

Bill_Capehart
5-Regular Member

Strange behavior with vec() vs Range in Formulas and Graphs in Mathcad Prime 11

Hello All:  

I have encountered some strange behavior with the new "vec()" function in Mathcad Prime 11.  An example of this is shown in the screen capture below.   In trying to plot a complex function (the volume of a sideways cylindrical tank), the old way with a "range" for the h in this example gives the correct results (determined independently of Mathcad). 

However, the h created by the vec() function yields very different results in this instance.  I tried other simpler formulas [e.g, sqrt(2*R*h-h2)] and the results were satisfactory and both results matched.  But as I started fleshing out the equation with more terms, the behavior diverged as per the example below.   The other terms, when isolated, produce satisfactory results.  Only the term shown below in V2(h) presents strange behavior.  More still, expressing V2(h) differently (e.g., algebraically rewriting the expression will create still different but, likewise, still wrong results!
Example of difference between range and vec() fields in a complicated math functionExample of difference between range and vec() fields in a complicated math function
Has anyone seen any similar behavior or can otherwise shed light on what is happening?

Cheer and Thanks
Bill Capehart
ACCEPTED SOLUTION

Accepted Solutions

How about attaching the Prime worksheet?

 

The phenomenon isn't strange. You forgot to vectorise the expression:

LucMeekes_0-1769032886943.png

Certain mathematical operations are automatically vectorised. V2 isn't one of those. But with the acos added (V1) that part is vectorised. Observe the difference between:

LucMeekes_1-1769033199610.png

LucMeekes_2-1769033207216.png

And compare that to using the range:

LucMeekes_0-1769033409585.png

 

 

 

Success!
Luc

View solution in original post

2 REPLIES 2

How about attaching the Prime worksheet?

 

The phenomenon isn't strange. You forgot to vectorise the expression:

LucMeekes_0-1769032886943.png

Certain mathematical operations are automatically vectorised. V2 isn't one of those. But with the acos added (V1) that part is vectorised. Observe the difference between:

LucMeekes_1-1769033199610.png

LucMeekes_2-1769033207216.png

And compare that to using the range:

LucMeekes_0-1769033409585.png

 

 

 

Success!
Luc

Bill_Capehart
5-Regular Member
(To:LucMeekes)

Thanks Much.  

https://community.ptc.com/t5/forums/v5/forumtopicpage.markmessageasacceptedsolutionsecondarybutton/message-uid/1051860?t:ac=board-id/PTCMathcad/message-id/220324&t:cp=solutions/contributions/acceptedsolutionsactions

I started making a more documented sheet as per your request and saw that it was indeed trying to dot-product the term that was not behaving as expected, but I had not played with the "vectorize" function in all the years I've used Mathcad.  

 

As best practice, should this be employed whenever we pass an array to a generic function?

 

Bill.

Announcements

Top Tags