Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
EDIT: IMMEDIATELY AFTER POSTING, I SEE THAT THIS MAY BE A PRIME 10 BUG - CAN SOMEONE PLEASE CONFIRM?
I am attempting to solve for a single variable (vf) by creating an equation that has the root function on the RHS of the equation. Rather than try to explain with words, here's a picture of the problematic function.
I am passing multiple variables to the function that are defined above: Testhp is a variable defined with units of power, Fan is a matrix formed from a READEXCEL function, and the values are unitless until later extracted by column and appended with appropriate unit values within the worksheet, D is a variable defined in units of length, fluid is a string passed to a Mathcad wrapper that is used in an included worksheet, t is a variable defined in units of temperature and p is a variable defined in units of force per length squared.
I find it odd that there is no error reported by the equation above the equation reporting an error, but the moment I attempt to use it as a function, I see the error reported in red. I can use each function contained in the root function separately as seen below the equation. Because of this, I am at a loss to understand why Mathcad is telling me about compatible units. Is it a problem with passing variables into the root function? I'd love to be able to post this worksheet, however, I'd have to find someone with Refprop installed and using the Mathcad wrapper since it is integral to the worksheet functionality.
Solved! Go to Solution.
I got it Werner. The root function would not work with the limits specified in the function arguments (i.e., using all four of the inputs for the complete root function). Once I placed a guess value above the root function, it immediately returned the proper value. It didn't like having to handle units in the guess values within the root function itself. Not sure whether I've ever run into this previously, but don't question what works, right? I used your first suggestion for the creation of FlorateVec(). Definitely cleaner and more importantly, adaptable for the future.
I like how you refer to the "real" Mathcad. I often feel that way, but I can see that Prime is moving in the right direction, however, too slowly for my taste. The real Mathcad was virtually complete with few limitations, but this new stuff is written in .NET, so should allow for more flexibility and greater function library choices. I recall being able to do traces in programs and all kinds of error tracing in 15. It was very useful for days like this.
I sincerely appreciate your help. As usual, Mathcad requires a great deal of patience to get past its idiosyncrasies.
Its hard to debug just a picture but on first sight i could not spot any error concerning the units.
The function fan_op(...) is called with an array as argument "Fan". Is an array what this function expects as this argument and is it supposed to return a single scalar power value?
So I am just poking in the dark. You may try to define a function
and see what you get when you evaluate
or maybe replace the 0cfm by 10 cfm.
You may also try Primes error tracing to see where exactly the error occurs.
Thank you for taking a look Werner. Agreed on this being difficult to debug without the full picture. I've included the file and the spreadsheet for the fan data. Perhaps you can make heads or tails out of it. You will not see anything related to the fluid properties information correctly since I doubt you have my exact same Refprop setup (if you have it at all). I used your suggestion in a program to simplify the function for the root function. NO joy. Same results in terms of "These matrices must have compatible units". And finally, as far as the answer to your question "Is an array what this function (fan_op(...)) expects as this argument and is it supposed to return a single scalar power value?", is yes - at least I hope so. I've learned over the years that I am typically just missing something that is blatantly obvious. Hopefully, this is the case.
As for error tracing, I did not realize that Prime had this functionality. I thought it was lost at Mathcad 15. Where can I find info on this? I used it often in the past.
Again, thank for your time!
Bob
Werner,
I thank you for the info about error tracing. I think I may have narrowed down the issue. It looks like I am having trouble with a dot product result. I am thinking it is an obvious thing, like I mentioned is typical for my troubles, but I never saw the problem until using error tracing.
So I guess you found out yourself how to trace errors in Prime.
I found it not as useful ar the option in real Mathcad, but sure better than what we had in the first Prime versions (nothing).
And no, I don't have Refprop installed, so your sheet fails and while I had a look at it I could not spot the culprit of the error.
I had noticed (has nothing to do with the problem you experience) that you defined the order of the polynomial in the variable "Order", but your function "FlorateVec" does not make use of it.
So I would suggest that you replace it for one of the following two variants:
Let us know when you found the root of the "root" problem 😉
I got it Werner. The root function would not work with the limits specified in the function arguments (i.e., using all four of the inputs for the complete root function). Once I placed a guess value above the root function, it immediately returned the proper value. It didn't like having to handle units in the guess values within the root function itself. Not sure whether I've ever run into this previously, but don't question what works, right? I used your first suggestion for the creation of FlorateVec(). Definitely cleaner and more importantly, adaptable for the future.
I like how you refer to the "real" Mathcad. I often feel that way, but I can see that Prime is moving in the right direction, however, too slowly for my taste. The real Mathcad was virtually complete with few limitations, but this new stuff is written in .NET, so should allow for more flexibility and greater function library choices. I recall being able to do traces in programs and all kinds of error tracing in 15. It was very useful for days like this.
I sincerely appreciate your help. As usual, Mathcad requires a great deal of patience to get past its idiosyncrasies.
Strange, I never had trouble using units in the "root" function.
The root function with four arguments fails if the function values at the two limits have the same sign, but then the error message would clearly say so.
The error message you got is rather misleading.
Nonetheless , good you found a solution.
Old Mathcad sure needed a new code basis, but after seeing what PTC had done and does with Mathcad, I wished another company would have bought the software. The glacier speed of development, version 10 still not up to real Mathcad in terms of functionality, speed and usability is just a shame.