Rewrite code from Matlab to Maple.

zakyn's picture

Hello,

I want to rewrite the following Matlab code to Maple

sum(Yp.*X(:,2))

and

si2(:,1)=1/2*(Y1(:,1)-Y2(:,1)).^2;

Could you help me please?

Thanks

Vladimir

Comments

matlab to maple

For the first I think you want

LinearAlgebra:-DotProduct(Yp,X[1..-1,2],conjugate=false);

But I don't know whether Matlab routinely uses the conjugate. If so, then you could use the simpler (notationally):

Yp . X[1..-1,2];

In the second case I think you want

si2[1..-1,1] := 1/2*map(x->x^2, Y1[1..-1,1]-Y2[1..-1,1]);

Haven't actually tested these, so...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}