Nigel Rivett

5 Reputation

One Badge

0 years, 108 days

MaplePrimes Activity


These are questions asked by

My first day attempting Maple so probably something simple about environment variables.

I'm trying to use Digits in an expression to set and use the preceision. It seems to set the value if used in a procedure but seems to update the variable after the execution of multiple commands executed together - also setting a variable from Digits, updating it, then using that in evalf doesn't help.

Digits := 1

Digits := Digits + 1; Digets; 1.0/3;

Gives 1 digit, Setting of Digits takes affect after the evaluation.

f := proc() Digits + 1; 1.0/3; end proc

f();

2 digits - so the setting of Digits takes effect before the evaluation. Looks like the procedure is executed as separate commands.

So repeated executes of 

f(); Digits++;

Will increment the precision as will

f := proc() Digits++; print(evalf[Digits](1.0/3)); return Digits; end proc; Digits := f();

Also

a := 1; a := a + 1; evalf[a](1.0/3);

Gives 2 digits

a := Digits + 1; evalf[a](1.0/3);

Gives 1 digit.

a := eval(Digits + 1); evalf[a](1.0/3);

Gives 1 digit.

Page 1 of 1