Skip to main content
12-Amethyst
November 7, 2016
Solved

Function returning two vectors, but with different units

  • November 7, 2016
  • 1 reply
  • 1404 views

Hi everybody,

I am trying to build a function that should give back two vectors (and that is not the problem), only those vectors have different units.

The only way I can imagine is to adimensionalize the vectors, using UnitsOf (or SIUnitsOf) and the assemble them in the array of vectors that I want to get back.

Somehow this it is cumbersome and error prone, since outside the function I will have to multiply back the variables by their units.

Unbenannt.JPG

Thanks a lot

Best regards

Claudio

Best answer by StuartBruff

Hi Claudio,

Unfortunately, Mathcad 15 doesn't allow mixed units in an array, and adimensionalizing them is (almost) the only way to get round the problem ... When I say almost, you could try returning both vectors in the units of one of the items and then correcting the units on the other one (at least, it reduces your error probability by 50% !).

This is one of the few aspects in which Prime is better than M15, as Prime can handle mixed-unit (well, mixed-dimension, technically) arrays.

Stuart

1 reply

23-Emerald V
November 7, 2016

Hi Claudio,

Unfortunately, Mathcad 15 doesn't allow mixed units in an array, and adimensionalizing them is (almost) the only way to get round the problem ... When I say almost, you could try returning both vectors in the units of one of the items and then correcting the units on the other one (at least, it reduces your error probability by 50% !).

This is one of the few aspects in which Prime is better than M15, as Prime can handle mixed-unit (well, mixed-dimension, technically) arrays.

Stuart