[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Units in a calculus problem using Maple

From: William Sit
Subject: [Axiom-developer] Units in a calculus problem using Maple
Date: Wed, 05 Oct 2005 17:54:48 -0400

Dear CY:

I came across a problem in a calculus text that is an example of the kind of
care one has to be aware of in dealing with automatic dimensional analysis in

>From Goldstein, Lay, and Schneider: Calculus & Its Applications, 10th ed.,
Pearson Education Inc., 2004. p. 181, Problem 26:

A ship uses 5x^2 dollars of fuel per hour when traveling at a speed of x miles
per hour. The other expenses of operating the ship amount to $2000 per hour.
What speed minimizes the cost of a 500-mile trip? [Hint snipped]

Imagine trying to do this problem and declaring that x has the dimension of
velocity. To verify that the expression written down to give the cost as a
function of x is dimensionally correct, the computer would have to know a priori
that the "constant" 5 actually has a dimension. With the proposed design, which
allows a declaration of an expression to be of a certain dimension, this can be
deduced, and implicitly the dimension for 5 can be ignored. It would be more
natural if one works on the expression level and view 5x^2 by itself of
dimension dollars per hour, and to ignore the  than if one is required to
declare the correct dimension for the number 5.

Entering the expression for cost in terms of x with units (except for 5) in
Maple will give this error:

> restart:
> interface(warnlevel=0):
> interface(displayprecision=4):
> with(Units):
> with(Units[Natural]):

> myCost := 500 * miles/(x * miles /hour) *(2000 * dollars/hour + 5 * (x * 
> miles /hour)^2);

Error, (in Units:-Standard:-+) the units `USD/s` and `m^2/s^2` have incompatible

Doing this problem step by step works better in Maple:

> distance:= 500* miles;

                         distance := 500 [mi]

Amazing: why wasn't [mi] converted to [m]?

> velocity:= x * miles/hour;

                       velocity := ---- x [m/s]

> fixedCost:= 2000*dollars/hour;

                        fixedCost := 5/9 [---]
                                         [ s ]

> fuelRate:= 5*x^2*dollars/hour;

                                         2 [USD]
                      fuelRate := 1/720 x  [---]
                                           [ s ]

Note: NOT 5*velocity^2*dollars/hour;

> cost:=distance/velocity * (fixedCost + fuelRate);

                                  /       2 \
                                  |      x  |
                          1800000 |5/9 + ---|
                                  \      720/
                  cost := ------------------- [USD]

> a:=solve(diff(cost, x)=0,x);

                             a := 20, -20

> velocity;

                             ---- x [m/s]

> eval(velocity, x=a);

                              ---- [m/s]

> eval(cost, x=a);

                             100000 [USD]

So far, so good.
Why isn't x = -20 not substituted? (Maple's Unit internals expect only positive
And, watch this:

> x:=20 * miles/hour;

                           x := ---- [m/s]

> cost;

         281250000 //      1951609       2\            (-1)\
         --------- ||5/9 + -------- [m/s] | [USD] [m/s]    |
           1397    \\      17578125       /                /

Yuks! A student may be at a loss with this. So there seems to be two types of
symbols: one of which is the kind no units should be attached? That would seem
very inconsistent.

Will Axiom do better?  Several improvement suggestions for Maple:

(1) remove all those multiplication operators!
(2) allow a declaration for the units of x so it can be implicit
(3) keep the units as inputted as much as possible and get rid of those
conversion factors (unless specifically asked to make the conversion by the
(4) (not sure) allow automatic assignment of dimension/unit to numeric constants
to balance dimension in an expression (what physicists do) and give a warning


reply via email to

[Prev in Thread] Current Thread [Next in Thread]