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


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

Re: Test for Matrix type

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Test for Matrix type
Date Fri, 23 Sep 2011 07:45:17 -0700
Organization A noiseless patient Spider
Lines 39
Message-ID <87fwjn2u82.fsf@san.rr.com> (permalink)
References <9e32joFto3U1@mid.individual.net> <j5i3dm$qsf$1@news.albasani.net>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx04.eternal-september.org; posting-host="7daQ3AF9ALJlnU9jGWSG5Q"; logging-data="15449"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18j3HT9Shjuj7SvhPZfeZct"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock sha1:SHUybXfNdWg3I4mMGZ4GkUnSKbY= sha1:OpKhemy8h7HuhDOlqn2jo6Fdy84=
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.maple:248

Show key headers only | 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 | Unroll thread


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