Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #248

Re: Test for Matrix type

From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Test for Matrix type
Date 2011-09-23 07:45 -0700
Organization A noiseless patient Spider
Message-ID <87fwjn2u82.fsf@san.rr.com> (permalink)
References <9e32joFto3U1@mid.individual.net> <j5i3dm$qsf$1@news.albasani.net>

Show all headers | View raw


rouben@shady.(none) (Rouben Rostamian) writes:

> In article <9e32joFto3U1@mid.individual.net>,
> Rainer Rosenthal  <r.rosenthal@web.de> wrote:
>>restart:
>>with(LinearAlgebra):
>>A := Matrix([[1,2],[3,4]]);
>>if type(A,integer) then
>>   print("I'd be suprised");
>>else
>>   print("I thought so.");
>>fi;
>>if type(A,MatrixType) then
>>   print("I'd be glad");
>>else
>>   print("Oops, why not?");
>>fi;
>>
>>Is there a nice substitute for "MatrixType"?
>
> Yes, try "Matrix", as in:
>
> if type(A,Matrix) then
>    print("I'd be glad");
> else
>    print("Oops, why not?");
> fi;

For the first conditional, use the following form (see ?type,Matrix):

if type(A,'Matrix(integer)') then
   print("I'd be suprised");
else
   print("I thought so.");
fi;
            "I'd be surprised"

-- 
Joe Riel

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Test for Matrix type Rainer Rosenthal <r.rosenthal@web.de> - 2011-09-23 11:42 +0200
  Re: Test for Matrix type rouben@shady.(none) (Rouben Rostamian) - 2011-09-23 14:00 +0000
    Re: Test for Matrix type Joe Riel <joer@san.rr.com> - 2011-09-23 07:45 -0700
      Re: Test for Matrix type Rainer Rosenthal <r.rosenthal@web.de> - 2011-09-23 17:03 +0200
    Re: Test for Matrix type Rainer Rosenthal <r.rosenthal@web.de> - 2011-09-23 16:46 +0200

csiph-web