Pavel Oganesyan
Pavel Oganesyan

Reputation: 6924

Positive value for a symbol in Maple

I need to describe variable as positive. It used as a parameter in a piece-wise function, and it is positive by definition, but I don't know how to set it as unknown positive. I need something like unsigned in c++, but for Maple. Any advices?

Upd:

For example: I made some evaluation and got this as the result:

  piecewise(h <= 0, 0, 0 < h, (1/3)*h)  (1)

but by some reasons h > 0, so I want to simplify (1). How do I set this into Maple?

Upvotes: 0

Views: 539

Answers (2)

DrC
DrC

Reputation: 7698

To indicate to Maple the value is positive real, use

assume(h>0);

Upvotes: 1

acer
acer

Reputation: 7246

It's not really clear what you want, since you've described the issue in loose terms. What do you mean, in a technical Maple sense, by "describe" here? And "function"?

f:=proc(x::positive) if x>1 then y else z end if end proc:

f(4);
                           y

f(-4);
Error, invalid input: f expects its 1st argument, x, to be of type positive,
but received -4

In light of the update to the post: perhaps you want something like this,

f:=piecewise(h <= 0, 0, 0 < h, (1/3)*h):

simplify(f) assuming h>0;

                          1  
                          - h
                          3  

Upvotes: 3

Related Questions