vv

13118 Reputation

20 Badges

9 years, 72 days

MaplePrimes Activity


These are questions asked by vv

A fact that seems to be not documented. Probably it should be obvious.

 

Digits := d0
evalf[d](expr);

 

The toplevel float sub-expressions in expr  are computed with Digits=d0 but in procedures Digits is set to d.
Notice that the actual float parameters of the toplevel procedures are evalf-ed with Digits=d0.

 

restart;

g:=proc() convert(1/3., string) end:
h:=proc() 1/3. end:

Digits:=3;
evalf[10]([
  1/3. = h(),
  convert(1/3.,string) = g(),  
  fsolve(3*x=1) = add([1/3]),
  fsolve(x/3=1/9.) # 1/9. being at top level is evalf-ed with Digits=3
])

3

 

[.333 = .3333333333, ".333" = ".3333333333", .3333333333 = .3333333333, .3330000000]

(1)

 

k:=proc(x) convert(x,string) end:

kernelopts(floatPi);

true

(2)

4.+Pi;

7.14

(3)

evalf(k(1/3.+Pi));
# floatPi seems to be ignored inside actual parameters

".333+Pi"

(4)

evalf(k(4+evalf(Pi)));

"7.14"

(5)

evalf(k(4+Pi));
# 4 not being float (or "infected" by a float) is not evalf-ed

"4+Pi"

(6)

 

### (this is documented)

`evalf/h` := proc() 7.777 end:

evalf(h(1/3));

.333

(7)

evalf('h'(1/3));

7.777

(8)

 

 

Download digits.mw

(edited)

restart;
unames();  # first call ok
unames();  # second call


Error, invalid input: Typeset:-Kernel expects an equation for keyword parameter numericformatting

Error, unexpected result from Typesetting

 

RootOf has the option index=real[i]  for the i-th real root:

evalf([seq(RootOf(x*(x^2-1)*(x^2-4)+1/100, x, index=real[i]), i=1..5)]);
     [-2.000416306, -0.9983310082, -0.002500019532, 1.001664362, 1.999582971]

This option does not seem to be documented. Why? Or, is it?

 


 

alias in rtables does not work when typesetting=extended (default in Maple 2017)

restart;

alias(alpha=RootOf(z^3+z+1,z));

alpha

(1)

L:=simplify([seq(alpha^k,k=0..5)]);

[1, alpha, alpha^2, -alpha-1, -alpha*(alpha+1), -alpha^2+alpha+1]

(2)

V:=convert(L,Vector);

_rtable[18446744074335181870]

(3)

interface(typesetting=standard);

extended

(4)

V;

7275930162710271107275012117273962706

(5)

 

unames()   produces an error  in extended typsetting mode (the default in Maple 2017)  after any output.

#interface(typesetting=standard);

restart;

interface(typesetting=extended);

extended

(1)

unames();

Error, invalid input: Typeset:-Kernel expects an equation for keyword parameter numericformatting

 

` `

 

Error, unexpected result from Typesetting

 

 

First 6 7 8 9 10 11 12 Page 8 of 12