# Thread: Maple: Only getting partial plot. Something wrong with function I guess!

1. ## Maple: Only getting partial plot. Something wrong with function I guess!

Hello =)
I have the following code:
> fracy := proc (d, r) if r < d then 1 else 1-arccos(sqrt(r^2-d^2))/pi end if end proc;

> plot('fracy(x, 1)', x = 0 .. 2);

But this plots only x=1..2, not x=0..1
It only does part of the plot!
I needed to use to ' ' else it would complain that it cannot evaluate the if.

Thanks,
Remy.

2. Originally Posted by steenreem Hello =)
I have the following code:
> fracy := proc (d, r) if r < d then 1 else 1-arccos(sqrt(r^2-d^2))/pi end if end proc;

> plot('fracy(x, 1)', x = 0 .. 2);

But this plots only x=1..2, not x=0..1
It only does part of the plot!
I needed to use to ' ' else it would complain that it cannot evaluate the if.

Thanks,
Remy.
It worked for me. See Attachment.

3. Originally Posted by steenreem Hello =)
I have the following code:
> fracy := proc (d, r) if r < d then 1 else 1-arccos(sqrt(r^2-d^2))/pi end if end proc;

> plot('fracy(x, 1)', x = 0 .. 2);

But this plots only x=1..2, not x=0..1
It only does part of the plot!
I needed to use to ' ' else it would complain that it cannot evaluate the if.

Thanks,
Remy.
Two things
(1) Are you using pi or Pi. It makes a difference.
(2) You can use the piecewise function command

fracy:=(d,r)->piecewise(r<d,1,1-arccos(sqrt(r^2-d^2))/Pi);
plot(fracy(x, 1), x = 0 .. 2);

which gives Chris's picture.

#### Search Tags

function, guess, maple, partial, plot, wrong 