nm

8552 Reputation

19 Badges

12 years, 355 days

MaplePrimes Activity


These are questions asked by nm

I needed to normalize the eigenvectors of a matrix. (I did not see an option to do this so far in LinearAlgebra). So I figured I just need to map LinearAlgebra:-VectorNorm(x,'Euclidean')  of each vector of the generated eigenvectors matrix,. Where here means the vector in the matrix. But do not see a way to do it. 

I ended up just using seq, which works fine. But was wondering if there is a way to do it? map function on each column (or each row) and have the result be matrix ofcourse. 

Will show my attempt using map, and then using seq

Sx:=1/sqrt(2)*Matrix([[0,1,0],[1,0,1],[0,1,0]]);
lam,v:=LinearAlgebra:-Eigenvectors(Sx);

Just doing the following does not work ofcourse

map( x->x/LinearAlgebra:-VectorNorm(x,'Euclidean'), v) 

So I used seq

Sx:=1/sqrt(2)*Matrix([[0,1,0],[1,0,1],[0,1,0]]);
lam,v:=LinearAlgebra:-Eigenvectors(Sx);
normalized:=[seq( v(..,i)/LinearAlgebra:-VectorNorm(v(..,i),'Euclidean'),i=1..LinearAlgebra:-RowDimension(v) )];

Will be nice if one can use map or variation of it, which works on either columns or rows at a time.

Maple 2021.2

 

Why is a row of a matrix has type Matrix, but a column of a Matrix has type Vector (column vector)

I expected a row of a matrix to also be a Vector (row vector).

restart;
A:=Matrix([[1,2],[3,4]]);
A(1,..);
whattype(%);

A(..,1);
whattype(%);

This might be by design or documented somewhere. But I find it not consistent.  Either both results should be Matrices, or both should be Vectors (the more logical way).

 

Maple 2020.2 on windows 10.

sometimes I have a need to do an assignment inside  operator call `if`(......) . but it is not possible it seems to do this in Maple.

This happens when I am using `if`(...) inside cat() to build a long string, and  depending on some condition, different string is build.  

This works fine in general, until I need to assign new value to a variable at the same time as I am building the string.

An example will make it more clear. Instead of the following

str:="A";
x:=10;

str:=cat(str,`if`(x=10," it was 10","it was not 10"));

if x=10 then
   x:=11;
else
   x:=9;
fi;                         

I'd like to do something like this (which does not work in Maple)

str:="A";
x:=10;
str:=cat(str,`if`(x=10,  x:=11;" it was 10" , x:=9; "it was not 10"))

Tried assign() also. Does not work.  I tried different variation on the above, none works. 

In Mathematica, the above is possible. But this is using standard `If`, which can be inlined

Is it possible to do something like this in Maple? 

The reason is that I do not have to do the checking twice: once to build the string, and once after that is done, in order to do the assignment. It is better if both are done in one place. The above is just an example. I could have more than one `if` inside as I am building the long string. 

Btw, how does one look up help on the operator if and not the statement if ? the help page for if does not talk about it or give any examples.

Maple 2020.2

command completion (when hitting the ESC key) in Maple could be made more useful. It does not seem to support type names for example.

What shows up on the command completion window are  possible commands that start with that partial text.

It does not list other known names by Maple, such as type names and other options.

This makes it hard to use in many places, where one have to remember type names exactly instead of the system helping them by listing all possible type names that start with that string.

Is there a way around this? Will Maple next version support smarter and more complete command completion menu?

 

 

This integral 

for n integer and n>=0

Maple finds it if I tell it this in the assumptions.  But if I remove the assumption that n>=0 and just keep the assumption that n is integer, it hangs. (at least I waited 5 minutes and gave up).

Is this something to be expected?  If I try the same thing in Mathematica, i.e. telling it n is an integer, but not that it is n>=0, it returns result  immediately, with condition that the result is valid for n>=0.

restart;
int(x^n*exp(-x),x=0..infinity) assuming n::integer

seems to hang.

In Mathematica:

My question is  if this behaviour of int hanging is to be expected, since it was not told than n>=0? Should it have returned result of n!  like Mathematica, with the assumption given in the result as well?

Since for n<0 the integral does not converge, and maple knows this

restart;
int(x^(-2)*exp(-x),x=0..infinity)

            infinity

May be this is just a design issue in int and it was stuck trying to evaluate the integral for negative integers, and could not determine if it converges or not?

Any thoughts?

Maple 2020.2

First 56 57 58 59 60 61 62 Last Page 58 of 164