nm

9718 Reputation

19 Badges

12 years, 61 days

MaplePrimes Activity


These are answers submitted by nm

Use 'NAG' output. The Matrix returned contains both L and U, but the L has an implicit 1`s on diagonal. Hence simply extract the L and U from NAG and add the diagonal of ones and transpose as needed. This gives the Crout decomposition. see Maple help for more information on NAG output

This below shows how to obtain cholesky, Dolittle and Crout LU decomposition of a Hermitian  positive-definite matrix

Cholesky

restart;
with(LinearAlgebra):
with(ArrayTools):
A :=<<2|-1|0>,<-1|2|-1>,<0|-1|2>>;


L,U:=LUDecomposition( A,method='Cholesky',output=['L','U'] );

Dolittle

V,LU:=LUDecomposition( A,output=['NAG'] ):
L:=LowerTriangle(LU,-1)+Diagonal(Vector(RowDimension(A),1));
U:=UpperTriangle(LU);

Crout

Uc:=Transpose(L);
Lc:=Transpose(U);

You should really add one or two more words saying what is it you want done with these symbols you typed.

I assuming for now you want to solve for x (an educated guess)

-----------------------------
restart;
eq1:= 4*(x-7) =6;
solve(eq1,x);
eq2:= (2*x+3)*(2*x^2-5*x-3)=0;
solve(eq2,x);
----------------------------

I can't read your code well, since it is not well formated and seems to have many synatx errors (may be it is the cut/paste that did that).

But the while loop is clearly not terminating.

Just look at the logic. It says WHILE P1<>q1 DO.... END DO, then inside the WHILE loop, there is nothing that would change this conditions. You seem to forgotten to assign P1 or q1 to something.

To use a WHILE loop, you need something inside the loop to cause the condition to change, else you'll get stick in an infinite loop.

In addition, it is "or" not "OR".  i.e. lower case. I do not see "OR" in maple help. How did you code run like this? Which Maple version are you using?

 

 

Iam sure there is a better way than this (I am newbie) using some build-in function, but how about this:

restart;
vars:={c1,c2,c3,c4,c5,c6,c7,c8,c9}:
e1 := c1 + 2*c2 + (c3+3*c4)*x*y + (c5+c6)*y^2 +(c8-2)*y^3*x^2 = 0:
e2 := (c4 + 2*c5 + c7)*x + (c9+ 2*c3+5*c4)*x^2 + (2*c7+5*c5+c6)*y^2*x^3 =0:
sys := map(coeffs,lhs~({e1,e2}),{x,y}) =~ 0:
print~(sys)[];

                         c1 + 2 c2 = 0
                         c3 + 3 c4 = 0
                          c5 + c6 = 0
                           c8 - 2 = 0
                       c4 + 2 c5 + c7 = 0
                      2 c7 + 5 c5 + c6 = 0
                      c9 + 2 c3 + 5 c4 = 0           

solve(sys,vars);

eq:= (x+y)^2+ 1/(x + y) ;
algsubs((x+y)=m,eq);
simplify(%);
subs(m=(x+y),%);

   


 

f:=x->min(x^2 +1, 2*x+3) ;
plot({f(x),diff(f(x),x)},x=-3..3); %should also add labels, legend, etc....

 

 

If the determinant of the vectors is not zero, then the vectors are L.I. So simply take the determinant.

with(LinearAlgebra):
A := `<|>`(`<,>`(-1, -3, -6), `<,>`(3, 5, 6), `<,>`(-3, -3, -4));
v,e := Eigenvectors(A);
Determinant(e);
   

       -1

Hence L.I.

 

You do need to eventually specify an actual u(t) function

 

restart;

ode:=diff(x(t),t$2)+4*diff(x(t),t)+3*x(t)=u(t);

dsolve({ode,x(0)=0,D(x)(0)=0},x(t));

 

First 14 15 16 Page 16 of 16