Question: Carrying units within a procedure

To all,

I am trying to plot a procedure phi(beta, x) which uses dimensional units (length).  The code listed below returns an error message regarding "invalid units".  I have redefined the standard units to report length in inches, but I don't see why this should prevent me from plotting the procedure over a range of x (the procedure works when the arguments are specified discretely.  Thank you for your assistance.

Define constant beta:

beta := Units[Standard][`^`](Units[Standard][`*`](Units[Standard][`*`](3, Units[Standard][`+`](1, Units[Standard][`-`](Units[Standard][`^`](mu, 2)))), Units[Standard][`/`](Units[Standard][`*`](Units[Standard][`^`](h, 2), Units[Standard][`^`](c, 2)))), Units[Standard][`/`](4))

Define procedure phi:

phi := proc (beta, x)::Units[Standard][`*`](Units[Standard][`*`](returnType, Units[Standard][`^`](exp(1), Units[Standard][`-`](Units[Standard][`*`](beta, x)))), Units[Standard][`+`](cos(Units[Standard][`*`](beta, x)), sin(Units[Standard][`*`](beta, x)))); end proc

Now when I try to plot phi(beta, x) over the range of x=0..7, I get the following error message:

plot(phi(beta, x), x = 0 .. 7)

Error, (in Units:-Standard:-^) invalid units

But when I evaluate phi for some specific values of beta and x, I get a correct solution:

> evalf(phi(.1, 2));0.9650673385

Thank you for your assistance.


Please Wait...