vv

13310 Reputation

20 Badges

9 years, 117 days

MaplePrimes Activity


These are questions asked by vv

The following example (from help, direct call, without with) does not work.

restart;
(Q[`0`],Q[`1`],Q[`+`],Q[`-`],Q[`*`],Q[`/`],Q[`=`]) := (0,1,`+`,`-`,`*`,`/`,`=`):
A := Matrix([[2,1,4,6],[3,2,1,7],[0,0,5,1],[0,0,3,8]]):
LinearAlgebra:-Generic:-Determinant[Q](A, ':-method' = ':-BerkowitzAlgorithm');

==> error, (in hasoption)

We must use:

LinearAlgebra:-Generic:-Determinant[Q](A, method=LinearAlgebra:-Generic:-BerkowitzAlgorithm); # 37

which I suppose is not intended!
That's because the keyword name in the code appears as 'BerkowitzAlgorithm' instead of ':-BerkowitzAlgorithm'
(The problem occurs because there is an export LinearAlgebra:-Generic:-BerkowitzAlgorithm). 
 

I seem to remember that the save command had a bug about truncating big integers, and it was solved.
But now (Maple 2020) it is present again.
I wonder whether it is present in Maple 2021 too.

restart;
fname:="d:/tmp/ftest.mpl":
f:=proc(n)
  local i,k;
  for i to n do f(i):=parse(cat("", seq(k mod 10, k=1..10*i))) od;
  f(n);
end:

f(80):
length(%);  # 800, ok
save f, fname;
f:='f':
#restart;
read fname:
f(80):
length(%);  # 100  ???

 

Two days ago I have answered a question about using numapprox:-infnorm for functions of several variables. The question is now deleted. Is it possible to find whether it was deleted by the author (even if she/he has used the "best answer" tag)?

The simple test procedure P constructs a large matrix.
Measuring the real time twice  (t1 and t2), t2 was by about 25% larger!
Now, if we remove the comment  before "Start",  t1 increases by 25% and t2 ~ t1.
So, the timing depends on whether some output is already on screen (standard interface).
Can you explain this?

restart;
P := proc(n,A)
  local i, j;
  for i from 1 to n do  for j from 1 to n do
    A[i,j]:=sin(arcsin(1/i-1/j+1/n))-1/i+1/j-1/n+i+j
  od od;
  NULL  #A;
end proc:

# "Start";
n := 300:
s := time[real]():
A:=Matrix(n,datatype=float[8]):
P(n,A):
t1:=time[real]()-s;

s := time[real]():
A:=Matrix(n,datatype=float[8]):
P(n,A):
t2:=time[real]()-s;
t2/t1;  # 1.24   WHY?

(For one of my programs, I found t2/t1 = 1.7)

 

During the computation of a series, I needed the value Psi(1/12)  of the digamma function at a rational point. 

simplify, convert/elementary or other usual convertions do not help.

But Maple knows the formula for Psi(r) when r is rational:

 

FunctionAdvisor(special_values, Psi)[24][1]: convert(%,`global`);

Psi(n+p/q) = q*(Sum(1/(k*q+p), k = 0 .. n-1))+2*(Sum(cos(2*Pi*p*k/q)*ln(sin(Pi*k/q)), k = 1 .. floor((1/2)*q+1/2)-1))-(1/2)*Pi*cot(Pi*p/q)-ln(2*q)-gamma

(1)

(simplify@value)(eval(%, [n=0, p=1, q=12]));

Psi(1/12) = ((2*3^(1/2)-6)*ln(2+3^(1/2))+(-Pi-2*gamma-6*ln(2)-3*ln(3))*3^(1/2)-Pi+2*gamma+6*ln(2)+3*ln(3))/(2*3^(1/2)-2)

(2)

evalf(%);

-12.44790533 = -12.44790533

(3)

The question is: why does not Maple use this formula when asked? Or, is there a convertion which I was missing?

 

1 2 3 4 5 6 7 Last Page 2 of 12