Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
I have an old Mathcad file (14) I convert it to Prime 9 but the code does not work. Please help
Solved! Go to Solution.
There are many differences between Mathcad and Prime and in most cases Primes is not an improvement.
Prime does not allow for shortcut evaluation of branches which is the reason why the creation of the vector depsj fails.
Prime tries to evaluate the else branch even when q=qalt is true (the very first time) and so tries to access depsj which at that time still does not exist.
You may call it bad programming style to rely on shortcut evaluations, but it sure is convenient 😉
Solution is to define a vector depsj right in front of that program. I did it by assigning a dummy value like NaN for the first vector element and so creating a 1x1 vector. The value itself does not matter as it will be immediately overwritten by the correct 6x1 vector anyway.
The plots at the end use a title label which is not supported by Primes native plots. You will have to use a manually placed text region as a substitute. Furthermore Primes plots do not offer the option to add grid lines. Workarounds to create grids as part of the plots where posted here in the forum now and then.
Or you recreate the plots with the chart component. It supports amongst other features labels and grid lines, but unfortunately has its own serious disadvantages, too.But you may give it a try.
Mathcad:
Prime:
here it says depsj is not defined and it seems to be the problem
There are many differences between Mathcad and Prime and in most cases Primes is not an improvement.
Prime does not allow for shortcut evaluation of branches which is the reason why the creation of the vector depsj fails.
Prime tries to evaluate the else branch even when q=qalt is true (the very first time) and so tries to access depsj which at that time still does not exist.
You may call it bad programming style to rely on shortcut evaluations, but it sure is convenient 😉
Solution is to define a vector depsj right in front of that program. I did it by assigning a dummy value like NaN for the first vector element and so creating a 1x1 vector. The value itself does not matter as it will be immediately overwritten by the correct 6x1 vector anyway.
The plots at the end use a title label which is not supported by Primes native plots. You will have to use a manually placed text region as a substitute. Furthermore Primes plots do not offer the option to add grid lines. Workarounds to create grids as part of the plots where posted here in the forum now and then.
Or you recreate the plots with the chart component. It supports amongst other features labels and grid lines, but unfortunately has its own serious disadvantages, too.But you may give it a try.
Mathcad:
Prime: