axiom-math
[Top][All Lists]
Advanced

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

Re: [Axiom-math] correction


From: William Sit
Subject: Re: [Axiom-math] correction
Date: Sat, 20 Sep 2003 11:16:50 -0400

root wrote:
> 
> *,
> 
> A correction on the footnote in the last reply...
> I used the example of matrix subtraction and made the claim that
> engineering systems would give an integer zero as the result.
> This is not correct. The point of the incorrect example was
> that type information is not carried in these system.
> Please ignore the example.
> 
> Tim Daly
> address@hidden
> address@hidden
> 

 In the 3M's, the difference of two equal matrices is the zero matrix. However,
a brief investigation seems to indicate that type information in Maple or
Mathematica is carried only to a limited extent, and not as formally or robustly
as in Axiom. Matlab has types (classes), apparently based on C++ or Java
constructs.

In Mathematica: Head[ ] does not always give types; and there are only a few
specific routines to test types.

In[1]:=
a := x^2 + 1

In[2]:=
b := x^2

In[3]:=
c := a - b

In[4]:=
PolynomialQ[c]

Out[4]=
True

In[5]:=
IntegerQ[c]

Out[5]=
True

In[6]:=
Head[c]

Out[6]=
Integer

Maple has a type function with two arguments to test the type of a variable, but
only if you already know what type to test against. Similar to Mathematica, the
difference of two similarly typed objects may have multiple other types and need
not have the type of the operands.

> a:=x^2+1;

                                   2
                             a := x  + 1

> b:=x^2;

                                     2
                               b := x

> c:=a-b;

                                  1

> type(c,integer);

                                 true

> type(c,polynom);

                                 true

> a:=1/2;
                               a := 1/2

> type(a,fraction);

                                 true

> b:=1/2;

                               b := 1/2

> c:=a-b;

                                c := 0

> type(c,fraction);

                                false

> type(c,integer);

                                 true




In Matlab, the type is called class and seems to be retained.
>> sym x
 
ans =
 
x
 
>> a = x^2 + 1
 
a =
 
x^2+1
 
>> b = x^2+1

 
b =
 
x^2
 
>> c = a-b
 
c =
 
1
 
>> class(c)

ans =

sym




William
-- 
William Sit
Department of Mathematics..............Email: address@hidden
City College of New York..........................Tel: 212-650-5179
Convent Ave at West 138th Street..................Fax: 212-862-0004
New York, NY 10031.....Asian Symposium on Computer Mathematics 2003
USA..........................http://www.mmrc.iss.ac.cn/~ascm/ascm03




reply via email to

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