Items tagged with linearalgebra linearalgebra Tagged Items Feed

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?

hi all.

I have wrore the following program for optimization with bernstein and block pulse hybrid functions.

the program have some errors which i can't understand.

Bernestien1.mws

restart:

alias(C=binomial):
with(LinearAlgebra):
macro(LA= LinearAlgebra):


HybrFunc:=proc(N, M,  tj)               # N=Number of subintervals,  M=Number of functions in subintervals
 
local B, n, m;

global b;

for n from 1 to N do
for m from 0 to M-1 do

B := (i,m,t) -> C(m,i)*(1-t)^(m-i)*t^i:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, B(m,2,N*t-(n-1)*tj), 0), t):
 od:od:


Array(1..N, 0..M-1, (n,m)->b[n,m](t)):

#convert(%,vector);
end proc:

HybrFunc(3, 3, 1);




                                       # End Of Definition
 
g2(t):=t;            #*exp(t-1):                      # Any other function can be replaced here
    

g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3);
Optimization[Minimize](sqrt(int((g2(t)-g1(t))^2, t=0.. 1)));
assign(op(%[2]));
plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);

Array(1 .. 3, 0 .. 2, {(1, 0) = piecewise(0 <= t and t < 1/3, (1-3*t)^2, 0), (1, 1) = piecewise(0 <= t and t < 1/3, (6*(1-3*t))*t, 0), (1, 2) = piecewise(0 <= t and t < 1/3, 9*t^2, 0), (2, 0) = piecewise(1/3 <= t and t < 2/3, (2-3*t)^2, 0), (2, 1) = piecewise(1/3 <= t and t < 2/3, (2*(2-3*t))*(3*t-1), 0), (2, 2) = piecewise(1/3 <= t and t < 2/3, (3*t-1)^2, 0), (3, 0) = piecewise(2/3 <= t and t < 1, (3-3*t)^2, 0), (3, 1) = piecewise(2/3 <= t and t < 1, (2*(3-3*t))*(3*t-2), 0), (3, 2) = piecewise(2/3 <= t and t < 1, (3*t-2)^2, 0)}, datatype = anything, storage = rectangular, order = Fortran_order)

g2(t) := t

"g1(t):=c[1,0] ({[[(1-3 t)^2,0<=t and t<1/3],[0,otherwise]])+c[1,1] ({[[6 (1-3 t) t,0<=t and t<1/3],[0,otherwise]])+c[1,2] ({[[9 t^2,0<=t and t<1/3],[0,otherwise]])+c[2,0] ({[[(2-3 t)^2,1/3<=t and t<2/3],[0,otherwise]])+c[2,1] ({[[2 (2-3 t) (3 t-1),1/3<=t and t<2/3],[0,otherwise]])+c[2,2] ({[[(3 t-1)^2,1/3<=t and t<2/3],[0,otherwise]])+c[3,0] ({[[(3-3 t)^2,2/3<=t and t<1],[0,otherwise]])+c[3,1] ({[[2 (3-3 t) (3 t-2),2/3<=t and t<1],[0,otherwise]])+c[3,2] ({[[(3 t-2)^2,2/3<=t and t<1],[0,otherwise]])"

Error, (in Optimization:-NLPSolve) complex value encountered

Error, invalid left hand side in assignment

(1)



Download Bernestien1.mws

 I'll be so grateful if any one can help me.

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

i googled nullspace from ReducedRowEchelonForm

but when calculate it, ReducedRowEchelonForm do not contain the eigenvector in nullspace

how to calculate nullspace by hand?

 

i find that in maple 12 and maple 15 null space are different , however the common thing is that they are different from eigenvector by one of column multiply -1

is multiplication to one of column is due to rank=2 < 3, 3-2 = 1, so that random choose a column to multiply -1?

 

then i use elementary transformation, still can not get a rref which is like eigenvector, where is wrong?

sys1:=NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]); sys1 := Matrix([[sys1[1,1], sys1[1,2], sys1[1,3]], [sys1[2,1]-sys1[2,1]/sys1[1,1]*sys1[1,1], sys1[2,2]-sys1[2,1]/sys1[1,1]*sys1[1,2], sys1[2,3]-sys1[2,1]/sys1[1,1]*sys1[1,3]], [sys1[3,1], sys1[3,2], sys1[3,3]]]);

sys1 := Matrix([[sys1[1,1], sys1[1,2], sys1[1,3]], [sys1[2,1], sys1[2,2], sys1[2,3]], [sys1[3,1]-sys1[3,1]/sys1[1,1]*sys1[1,1], sys1[3,2]-sys1[3,1]/sys1[1,1]*sys1[1,2], sys1[3,3]-sys1[3,1]/sys1[1,1]*sys1[1,3]]]);

sys1 := Matrix([[sys1[1,1]/sys1[1,1], sys1[1,2]/sys1[1,1], sys1[1,3]/sys1[1,1]], [sys1[2,1], sys1[2,2], sys1[2,3]], [sys1[3,1], sys1[3,2], sys1[3,3]]]);

sys1 := Matrix([[sys1[1,1], sys1[1,2], sys1[1,3]], [sys1[2,1], sys1[2,2], sys1[2,3]], [sys1[3,1]-sys1[3,2]/sys1[2,2]*sys1[2,1], sys1[3,2]-sys1[3,2]/sys1[2,2]*sys1[2,2], sys1[3,3]-sys1[3,2]/sys1[2,2]*sys1[2,3]]]);

sys1 := Matrix([[sys1[1,1], sys1[1,2], sys1[1,3]], [sys1[2,1]/sys1[2,2], sys1[2,2]/sys1[2,2], sys1[2,3]/sys1[2,2]], [sys1[3,1], sys1[3,2], sys1[3,3]]]);

 

http://rosettacode.org/wiki/Reduced_row_echelon_form#C.23

change c# code from integer to double, it return only an identity matrix. same as maple, how eigenvector come from rref?

 

when compare maple with sympy in python27,

sympy even do not have solution in nullspace!!!

from sympy import *
InputMatrix3 = Matrix([[31.25,30.8,30.5],[30.8,30.5,0],[30.5,0,0]])
NewInput3 := InputMatrix3.T*InputMatrix3
NewInput3.nullspace()

 

InputMatrix3 := Matrix([[31.25,30.8,30.5],[30.8,30.5,0],[30.5,0,0]]);
NewInput3 := MatrixMatrixMultiply(Transpose(InputMatrix3), InputMatrix3);
Old_Asso_eigenvector := Eigenvectors(NewInput3);
FirstEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[3]; # find back eigenvalue from eigenvector
SecondEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[2]; # find back eigenvalue from eigenvector
ThirdEigenValue := solve(Determinant(NewInput3-Matrix([[lambda1, 0, 0], [0, lambda1, 0], [0, 0, lambda1]])), lambda1)[1]; # find back eigenvalue from eigenvector
sys1:=NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]);
sys2:=NewInput3-Matrix([[SecondEigenValue, 0, 0], [0, SecondEigenValue, 0], [0, 0, SecondEigenValue]]);
sys3:=NewInput3-Matrix([[ThirdEigenValue, 0, 0], [0, ThirdEigenValue, 0], [0, 0, ThirdEigenValue]]);
sys1b:=MatrixMatrixMultiply(NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]),Matrix([[x],[y],[z]]));
sys2b:=MatrixMatrixMultiply(NewInput3-Matrix([[SecondEigenValue, 0, 0], [0, SecondEigenValue, 0], [0, 0, SecondEigenValue]]),Matrix([[x],[y],[z]]));
sys3b:=MatrixMatrixMultiply(NewInput3-Matrix([[ThirdEigenValue, 0, 0], [0, ThirdEigenValue, 0], [0, 0, ThirdEigenValue]]),Matrix([[x],[y],[z]]));

sys1:=NewInput3-Matrix([[FirstEigenValue, 0, 0], [0, FirstEigenValue, 0], [0, 0, FirstEigenValue]]);
sys2:=NewInput3-Matrix([[SecondEigenValue, 0, 0], [0, SecondEigenValue, 0], [0, 0, SecondEigenValue]]);
sys3:=NewInput3-Matrix([[ThirdEigenValue, 0, 0], [0, ThirdEigenValue, 0], [0, 0, ThirdEigenValue]]);
ReducedRowEchelonForm(sys1);
NullSpace(sys1);
NullSpace(sys2);
NullSpace(sys3);

 

convert(50, base, 12);

this can change base for integer, however can not change decimal

assume i change decimal to fraction first and then apply convert base to 12 to numer and denom, and divide again to get decimal

it may get a decimal based on base 12

however, how to make this base 12 operation apply in linear algebra calculation

1 2 3 4 5 Page 1 of 5