![]() If the dimensions of the rest are OK this will work. ![]() The rule is to make the second element (the coefficient of the linear element) show the reciproke of the unit you want to see for the result. If you want solutions with correct units, you will have to adapt the units in the vector accordingly (which does not feel natural on first sight). The obvious and most natural one is to strip all unitsĪnother approach is to make all elements the very same unitīoth ways above of course will give you a dimensionless solution. So you have a couple of choices to get polyroot to work. Polyroot(v) will always solve so that the scalar product of v with the vector of powers of x is dimensionless ![]() " no matter which of the first three elelements has the wrong unit (and disregarding the setting of ORIGIN).īut if you use polyroot with a vector of more than three elements and the wrong unit is in the fourth or higher element it will give you the appropriate element count (no matter what ORIGIN is set to, the first element is always "Element 0"). It will always tell you that "Element 2 of this vector must have units. The error message itself is a confusing (not necessarily wrong. So you found yet another function in Prime which still will not work as expected when used with units So you will never get an error that element 0 or element 1 should have a different dimension. You can provide ANY units for those first two values, but the third (and all following for polynomial of higher order) have to be consistent. Mathcad can't tell the desired unit of the resulting variable unless you provide units for the first two elements of the vector. If you supply km (or m, it doesn't matter) you get the correct result.Įven the eror message makes sense (though it wasn't helpful in your case). The correct unit for the coefficient of the linear element is length. In your first attempt you supplied no unit at all and in your second the wrong unit. And as Prime has dynamic unit checking you also have to supply the correct unit for a zero value. Polyroots() is fully unit aware and works intuitiv as expected - you just have to take care and use the correct units all over. Many have fixed or calculable starting points.Forget (most) of what I had written above. What makes you think it does? Not every iterative algorithm requires the specification of a guess value. It would be nicer if it would diagnose a zero leading coefficient and provide a proper error message, but error messages and diagnostics have never been Mathcad's strong point (quite the opposite).Īnd polyroots does not require a guess value (for either algorithm). Polyroots is quite well within its rights to fail if the provided vector does not properly represent a polynomial of the degree implied by the vector. Coeffs is properly returning the coefficients of the actual polynomial. By definition the leading term of a polynomial is non-zero. Zero terms, no matter how written, have no effect on an expression. Another poor choice (IMHO), and one that I always fix in my worksheets (it's in my template).Ĭoeffs is correct. Not everything that displays as zero is actually zero. I would guess that you had a poor choice (read default) of zero threshold, and so the very small value that is the correct root of the polynomial displays as zero. You didn't post the actual sheet, just a picture, so I can't do a full analysis of the issue. ![]() It may be a poor choice (I commented on that in the previous thread) but that is what is documented, so it is a "feature". Mathcad does not (the symbolic processor is a completely different beast).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |