Re: Checking conditions in MuPAD
- From: Raymond Manzoni <raymond.manzoni@xxxxxxxxxx>
- Date: Mon, 18 Jul 2005 11:41:23 +0200
swagat wrote:
Hi all!
I am new to this group and also new to "MuPAD". First of all, i would like to thank MuPAD group for making this software freely available.
Please help me with this simple problem. I want to evaluate conditions something like
if (a>0) and (b>0), is (a+b)>0 end_if
But MuPAD gives me following error.
Error: Can't evaluate to boolean [bool]
Hi,
I get rather 'then expected' for quite understandable reasons! :-) (is() is a function and requires parenthesis too around (a+b) > 0)
if (a>0) and (b>0) then is(a+b > 0) end_if returns ~ your error :'Can't evaluate to boolean [_less]'
This error usually means that at least one of your variables can't be evaluated when needed. Here 'a' and 'b' are undefined.
Let's do a function of a and b : f:= (a,b) -> if (a>0) and (b>0) then is(a+b > 0) end_if
then you'll get :
> f(1,1)
TRUE
> f(1,0)
NIL
( since the 'else' case is not handled )The question is how can i check whether a given expression is true or false.
when i try bool((a+b)>0), i get following error message:
Error: Can't evaluate to boolean [_less]
The test is fine but a context is needed : g:= (a,b) -> bool(a+b>0) for example works
Wishing you a fine continuation!
Raymond
Regards, Swagat
I had to repost this (bad character) sorry... .
- Follow-Ups:
- Re: Checking conditions in MuPAD
- From: swagat
- Re: Checking conditions in MuPAD
- From: swagat
- Re: Checking conditions in MuPAD
- References:
- Checking conditions in MuPAD
- From: swagat
- Checking conditions in MuPAD
- Prev by Date: Checking conditions in MuPAD
- Next by Date: Re: Checking conditions in MuPAD
- Previous by thread: Checking conditions in MuPAD
- Next by thread: Re: Checking conditions in MuPAD
- Index(es):