Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
When I ran the conversion tool it converted mathcad15 statement
to Prime 9 Statement
which only works if a precede it with an additional variable definition
where NPS1 is already defined.
Any ideas why this additional variable statement is required for Prime9 but not Mathcad15?
Solved! Go to Solution.
What you are trying to do is equivalent to:
At the time of creation of the vector, it's element values are unknown.
I guess Prime was built as an even more lazy machine than Mathcad, although, in Mathcad this doesn't work either:
Success!
Luc
What you are trying to do is equivalent to:
At the time of creation of the vector, it's element values are unknown.
I guess Prime was built as an even more lazy machine than Mathcad, although, in Mathcad this doesn't work either:
Success!
Luc
Hello Luc, thanks for the review and explanation. It makes sense to me that the vector creation was the issue. They must of handled it differently in MC15 with the if/otherwise statement. When Prime 9 did the conversion it changed this throughout the program to the new if/else format.
If I recall correctly, Mathcad 15 first checks the condition and then calculates the appropriate fork. The other fork is not handled at all and thus the error didn't happen. Prime checks both forks and sees the error.
@JKT wrote:
...
Prime checks both forks and sees the error.
Correct! On contrary to Mathcad, Prime does not use short-circuit evaluation (-> Short-circuit evaluation - Wikipedia).
Neither for boolean expressions nor for if-statements.
Here are two different ways to create the desired vector (I assume n to be a range running from 0 to N).
Even though the second approach is much shorter I would prefer the first one for better clarity and 'cause it does not need a range n to be defined (its replaced by the explicit internal for-loop). This for-loop allows the very same if-statement to work without an error on contrary to the usage of the range variable n (which is kind of an implicit loop).