234 Reputation

18 years, 75 days

0^0 = 1 (in general: a^0 = 1)...

Maple

I tried to check this 'trick' in maple, but see what happens in Maple 2015:

what is the correct solution for 0^0?

Here the code for those who hate typing:

x := 0; 0^(x^2);
0
1
for x from -1 to 1 do print(x, evalf(0^(x^2), 20)) end do;
-1, 0.
0, 1.
1, 0.
for x from -1 by .1 to 1 do print(x, evalf(0^(x^2), 20)) end do;
-1, 0.
-0.9, 0.
-0.8, 0.
-0.7, 0.
-0.6, 0.
-0.5, 0.
-0.4, 0.
-0.3, 0.
-0.2, 0.
-0.1, 0.
0., Float(undefined)
0.1, 0.
0.2, 0.
0.3, 0.

Harry

elementwise tilde operator in proc...

Maple

The following code works fine:

restart;
with(LinearAlgebra): with(MTM): with(StringTools): MultivariateNormalSample := proc (Sigma, V, N) local d; d := LinearAlgebra:-Dimension(V); LinearAlgebra:-LUDecomposition(Matrix(Sigma, datatype = float[8]), 'method' = 'Cholesky') . ArrayTools:-Alias(Statistics:-Sample(Normal(0, 1), d*N), [d, N])+ArrayTools:-Replicate(Vector[column](V, datatype = float[8]), 1, N) end proc: S := MultivariateNormalSample(`<,>`(`<|>`(1, 2), `<|>`(2, 5)), `<,>`(2, 3), 100):
W := ~int8(~round(S)):
K := convert(W, string):
K := Drop(K, 17):
K := Select(IsDigit, K):
M := seq(PadRight(K[i], 2), i = 1 .. Length(K)):
Z := M[1]:
for i from 2 to Length(K) do Z := cat(Z, M[i]); if `mod`(i, 2) = 0 then Z := cat(Z, "\n") end if end do:
Z;

but if I make a proc out of it then it breaks down on the line:

W := ~int8(~round(S)):

There seems to be an issue with the elementwise tilde operator.

restart;
Generate:=proc()
local MultivariateNormalSample,S,W,K,M,Z,i;
with(LinearAlgebra): with(MTM): with(StringTools):
MultivariateNormalSample := proc (Sigma, V, N) local d; d := LinearAlgebra:-Dimension(V); LinearAlgebra:-LUDecomposition(Matrix(Sigma, datatype = float[8]), 'method' = 'Cholesky') . ArrayTools:-Alias(Statistics:-Sample(Normal(0, 1), d*N), [d, N])+ArrayTools:-Replicate(Vector[column](V, datatype = float[8]), 1, N) end proc: S := MultivariateNormalSample(`<,>`(`<|>`(1, 2), `<|>`(2, 5)), `<,>`(2, 3), 100):
W := ~int8(~round(S)):
K := convert(W, string):
K := Drop(K, 17):
K := Select(IsDigit, K):
M := seq(PadRight(K[i], 2), i = 1 .. Length(K)):
Z := M[1]:
for i from 2 to Length(K) do Z := cat(Z, M[i]); if `mod`(i, 2) = 0 then Z := cat(Z, "\n") end if end do:
return Z:
end proc;Generate();

I seem to have missed something. Any ideas?

Harry

display only content of a matrix ...

How can I display in Maple T.A. the content of a matrix as pure text?

matrix([[1, 2], [3, 4]])

1 2

3 4

Is there a solution without using Mathml and hopefully without using StringTools?

And can I assign the rectangular text display to a variable (including line feeds)?

Harry

Does Maple TA work in Windows 10?...

Does Maple TA work in Windows 10?

My first attempt in Edge and Chrome was not promising.

Harry Garst

math question from nonmathematician...

Maple

Maple responds with FALSE, but for which real number is the statement false?

restart; assume(x, 'real');

verify(abs(x), sqrt(x^2), {'equal'});

kind regards,

Harry Garst

 4 5 6 7 8 9 10 Page 6 of 10
﻿