Items tagged with linearalgebra linearalgebra Tagged Items Feed

hello everybody!

I want to create a random symmetric matrix which have det=2. I just made it like this, no better than those ones. Thanks!

Doixung := proc (n)

local A, i, j; A := Matrix(n);

n := LinearAlgebra[Dimension](A);

for i to n do A[i, i] := RandomTools[Generate](integer(range = 1 .. 20))

   end do;

for i to n do

     for j to n do

           while j < i do A[i, j] := RandomTools[Generate](integer(range = 1 .. 20)) end do;

           while i < j do A[i, j] := A[j, i] end do

     end do

end do;

print(A) end proc

Hello everbody!


uses LA=LinearAlgebra;  

local      i,k,n:= LA:-RowDimension(A),    

        x:= Vector(LA:-RowDimensions(A)),    

        p:= Vector(LA:-RowDimensions(A));  


 while  k<=n do      

       for i to n while i<>j do          

          x[i]:=1/(A[i,i])*(-add(A[i,j]*p[j],j=1..n)+b[i]);       end do;      

        if abs(x-p)<epsilon do return x; end if;    



 end do;  


end proc:

assume there is vector a,b,c and d which are real number or floating number

how to express a in linear combination of b ,c and d

in another words, how to find coefficient m1, m2, m3

in a = m1*b + m2*c + m3*d

 can LinearSolve do this?



Hello every one. I writed:

for i from 2 by 1 to nops(M) do
for j from 2 by 1 to i

end do;
end do;
But I don't know wrong in my code. That is Neville algorithm

can you help me? sorry, my English is not very good

I want to make a package that I have created work with the LinearAlgebra package that comes with Maple. My package loads into a worksheet fine, but when I try to use one of my procedures, most of which depend upon procedures in the Linear Algebra package, the executable part of my procedure from my package is simply echoed to the screen and not executed. If I then copy the echoed part to a command prompt then it executes fine. How do I make my package use the commands in the Linear Algebra package?

Trying to get this function to work in Maple 18 


I am trying to creat a way to solve matrix differential equations step by step.


How to generate all basis of a set? (rather an the one basis that basis generates)

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.


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?


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.


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:



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.

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,



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


1 2 3 4 5 6 Page 1 of 6