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


Groups > comp.soft-sys.math.maple > #245 > unrolled thread

Test for Matrix type

Started byRainer Rosenthal <r.rosenthal@web.de>
First post2011-09-23 11:42 +0200
Last post2011-09-23 16:46 +0200
Articles 5 — 3 participants

Back to article view | Back to comp.soft-sys.math.maple


Contents

  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

#245 — Test for Matrix type

FromRainer Rosenthal <r.rosenthal@web.de>
Date2011-09-23 11:42 +0200
SubjectTest for Matrix type
Message-ID<9e32joFto3U1@mid.individual.net>
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"?

Cheers,
Rainer

[toc] | [next] | [standalone]


#246

Fromrouben@shady.(none) (Rouben Rostamian)
Date2011-09-23 14:00 +0000
Message-ID<j5i3dm$qsf$1@news.albasani.net>
In reply to#245
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;

-- 
Rouben Rostamian

[toc] | [prev] | [next] | [standalone]


#248

FromJoe Riel <joer@san.rr.com>
Date2011-09-23 07:45 -0700
Message-ID<87fwjn2u82.fsf@san.rr.com>
In reply to#246
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

[toc] | [prev] | [next] | [standalone]


#250

FromRainer Rosenthal <r.rosenthal@web.de>
Date2011-09-23 17:03 +0200
Message-ID<9e3leiFr9dU1@mid.individual.net>
In reply to#248
On 23.09.2011 16:45, Joe Riel wrote:

> see ?type,Matrix

Many thanks. It took me a while to find the help path.
Now I think I've learned a bit more how to properly
use the help tree.

Cheers,
Rainer

[toc] | [prev] | [next] | [standalone]


#249

FromRainer Rosenthal <r.rosenthal@web.de>
Date2011-09-23 16:46 +0200
Message-ID<9e3kebFj1bU1@mid.individual.net>
In reply to#246
Am 23.09.2011 16:00, schrieb none Rouben Rostamian:
> In article <9e32joFto3U1@mid.individual.net>,
> Rainer Rosenthal  <r.rosenthal@web.de> wrote:

>> Is there a nice substitute for "MatrixType"?
> 
> Yes, try "Matrix", as in: ...
> 

Well, thank you very much. I'm stumped because NOW it
works. I thought I had tried before - ts, ts, ts ...

Cheers,
Rainer

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.maple


csiph-web