Harry Garst

239 Reputation

5 Badges

18 years, 349 days

MaplePrimes Activity


These are questions asked by Harry Garst

I hoped that Maple would return the value of 1 in all commands (see below). However, introducing a scaling parameter, sigma, yields the unevaluated expression. Why? I still think it should evaluate to the value of 1.

 

kind regards,

Harry (not a mathematician, but a psychologist)

 

 

 

integral.mw

 

After reading 

http://math.stackexchange.com/questions/674535/avoid-dividing-by-zero-with-just-variables-and-basic-operators 

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

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

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

Thus instead of

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?

My first attempt in Edge and Chrome was not promising.

Harry Garst

4 5 6 7 8 9 10 Page 6 of 10