Items tagged with linearalgebra linearalgebra Tagged Items Feed

Dear all,

I have one probem in using Maple in comparison with Matlab.

Generally, when using Matlab, I write a long program with 500 lines (for example) and where I use some matricial calculations and other. When I want to repeat this program for some parameters (variables) many times, I transform the program to a procedure "Function" with just adding the command Function in the start of the program.

When using Maple, I have a difficulty to transform a long program which I want to repeat for some variables to a procedure "proc". The program uses packages like LinearAlgebra and other procedures.

Is there a simple way to transform a long Maple program to a procedure which should be repeated many times for some variables in Maple. 

I have especially problems with the commands local, global, use (for packages), etc.. and the warning related to the variables. It is not easy for a long program with many variables to write them in local or global variables.

Thank you.

Hey,

I wanted to calculate the eigenvalues and vectors of the following matrix:

A:=Matrix(6, 6, {(1, 2) = k_noho2*NO, (2, 2) = -k_noho2*NO, (2, 5) = k_ipro*O2, (2, 6) = k_hypro*O2, (3, 3) = -k_ro2no*NO, (4, 4) = -k_ro2no*NO, (5, 3) = .991*k_ro2no*NO, (5, 5) = -k_ipro*O2, (6, 4) = .977*k_ro2no*NO, (6, 6) = -k_hypro*O2}, datatype = anything, storage = rectangular, order = Fortran_order, shape = [])

There are no problems with calculating the eigenvalues, but when trying for Eigenvectors(A) it's telling me

Error, (in LinearAlgebra:-Eigenvectors) cannot determine if this expression is true or false: 0 < k_noho2*NO
So what's the problem here?

 

>restart:
>with(LinearAlgebra):
>with(Student[NumericalAnalysis]):
s := {E[1], E[2], E[3]};
v := {x[1], x[2], x[3]};
A := GenerateMatrix(s, v);
B := augment(A)
Then what i do that for any matric i can use same program.

Hello,

I'm trying to calculate the time fro my brachistochrone problem.  An object travels from A(0,a) to B(b,0)

a=7 and b=10

I've already found the parametric version:

x(t)=0.5c(t-sin(t) 

y(t)=a-0.5c(1-cos(t))

c= 7.039837581

I cant get it right in maple:

 

restart; a := 7; b := 10; g := 9.81; eq1 := .5*r*(u-sin(u)) = a; eq2 := a-.5*r*(1-cos(u)) = b; sol := fsolve({eq1, eq2}, {r, u}); r0, u0 := op(subs(sol, [r, u])); x := proc (u) options operator, arrow; .5*r0*(u-sin(u)) end proc; y := proc (u) options operator, arrow; a+(-1)*.5*r0*(1-cos(u)) end proc; plot([x(u), y(u), u = 0 .. u0]); Int(sqrt((diff(x(u), u))^2+(diff(y(u), u))^2)/sqrt(-2*g*y(u)), u = 0 .. u0); evalf(%)

                     

following commands on my computer got an error.

restart;
with(LinearAlgebra):
A:=Matrix([[1,3],[2,5]],datatype=float):
b:=Vector([1,1],datatype=float):
LinearSolve(A,b,method=hybrid);
Error, (in SWcallhybrid[1]) param 4 should be an rtable

any suggestion is appreciated.

win7, 12.02

I have a fairly old laptop, a Toshiba S10 Tecra, windows 7 64 bit and 4 Gb RAM.  It has an NVidia Quadro NVS 150m video card inside and according to NVidia CUDA capable of a compute level to 1.1 which is ok for float[4] but not float[8].  Inititiating the computecabability in maple does indeed bring a score level of 1.1.

Doing any LinearAlgebra matrix calculations with CUDA enabled is maybe 5x's slower than with it disabled.  I run into BLAS errors and screen blankouts at matrix values of 2000.  The video driver is the latest from Toshiba (2010) but not NVidia (2014) I suppose there would be an increased performace with newer drivers but if I'm going to run into the same issue of slower calculations with CUDA enabled there's no point in even testing the newer drivers on an otherwise fine running machine. 

Since it is a low end video card is CUDA even worthwhile, will I even notice a speed up with updated drivers?

Dear Maple Experts,

i am new to maple and I am trying to write a maple algorithm in order to calculate the GCD of two functions. 

I have defined the two functions and written the algorithm, but I get an error "Unable to Parse".

Here is my code:

restart; with(Algebraic); with(LinearAlgebra[Generic]); with(RegularChains); with(FastArithmeticTools); with(ChainTools); interface(rtablesize = 15);

f := (y^2-1)*((y+1)*x^4+(y^2-1)*x^3+(y^3-1)*x^2+(y^4-1)*x+y^5-1);

g := (y-1)*x^5+(y^2-1)*x^4+(y^3-1)*x^3+(y^4-1)*x^2+(y^5-1)*x+y^6-1;

SubRes:=proc(f,g,var): local  i,a, delta, beta, psi: if degree(f,var)<degree(g,var) then a[0]:=Algebraic:-PrimitivePart(g,var): a[1]:=Algebraic:-PrimitivePart(f,var): else a[0]=Algebraic:-PrimitivePart(f,var): a[1]:=Algebraic:-PrimitivePart(g,var): fi: delta[0]:=degree(a[0],var)-degree(a[1],var): beta[2]:=(-1)^((delta[0]+1)): psi[2]:=-1: i:=1: while a[i]<>0 do a[i+1]:=(prem(a[i-1], a[i], var))/(beta[i+1]): delta[i]:=degree(a[i],var)-degree(a[i+1], var): i:=i+1: psi[i+1]:=((-lcoeff(a[i-1],var))^((delta[i-2])))*((psi[i])^((1-delta[i-2]))): beta[i+1]:=-lcoeff(a[i-1],var)*(psi[i+1])^((delta[i-1])): od: print("Last Non-Zero Subresultant: ", sort(simplify(a[i-1])),y): return (Algebraic:-PrimitivePart(a[i-1],var)): end proc

and I get this error:

Error, unable to parse

Would you kindly help me to fix this issue?

Kind Regards,

Ash

 

Hi all,

I am stuck with the following problem:

convert(cos(alpha), exp); works fine for me.

Once I have the trigonometric functions in a matrix, it does not work any more:

In the latter line, A keeps the trigonometric functions. Why is this the case? Is there any way to force maple to keep the complex exponentials instead of trigonometric functions?

 

I am using LinearAlgebra and VectorCalculus.

 

Best Regards

Wassja

Hi all

Can anybody suggest an algorithm allowing to detect, that two matrices of the same size can be obtained each from other by permutations of rows and columns? Maybe, such an algorithm there exists in LinearAlgebra package?

Hi guys,

If I have a Hermitian 4x4 Matrix with elements that behave like complex numbers except that they do NOT commute. Is it possible to diagonalize this Matrix using Maple and the Eigenvectors - method of the LinearAlgebra package?

 

Cheers

NOh

 

 

P.S.: I am using Maple 18

is it possible to assume element of matrix 0 or 1

how to write?

after write this, is it possible to display possible matrices which each element is 0 or 1

with(LinearAlgebra):
GetRing := proc(sol)
ringequation := 0;
mono1 := 0;
for j from 1 to 3 do
mono1 := 1;
for i from 1 to nops(sol[1][j]) do
mono1 := mono1*op(i, sol[1][j]);
od:
ringequation := ringequation + mono1;
od:
return ringequation;
end proc;
M := Matrix([[a1,a2,a3],[a4,a5,a6],[a7,a8,a9]]);
sys := a*b+a = GetRing(MatrixMatrixMultiply(Matrix([[a,b,c]]), M));
solve(sys);

After I've set my infolevel and used the ProjectionPlot command, is there any way to force Maple to display the information using exact values, instead of decimal approximations? See the attached file for the additional information.


with(Student[LinearAlgebra]):

infolevel[Student[LinearAlgebra]] := 1:

ProjectionPlot(`<,>`(-2, 3, 2), `<,>`(7, -3, -4))

 

``


Download projection_plot.mw

How can I define general matrices in Maple and do symbolic manipulation - for example specifying a matirx M to be of dimension n x m where n and m are integers ?

with(LinearAlgebra):
a:=Vector([1,2]);
b:=Matrix([[1,2],[1,2]]);

Say if I need a^T * b * a, I will do this:

VectorMatrixMultiply(Transpose(a), b);
VectorMatrixMultiply(%, a);

But this seems too long for such a simple matrix (and vector) computation. I am sure there must be an short way.

What if I need more computation, like

 

a^T * b * c*d*f*g* a, where c,d,f,g are other 2x2 matrices.
 If I were to use the above command, that'll take a long time to input.

Thanks,

I have a matrix with repeated columns

with(LinearAlgebra):

Q := Matrix([1,1,1,0,0,0,-2,-1],[0,0,0,1,1,1,0,-3]);

I'd like to write a loop that defines u[1],...,u[n] to be the unique columns of Q. Is there a way to do this?

1 2 3 4 5 Page 1 of 5