## 235 Reputation

11 years, 75 days
Beijing, China

## Collocating a vector to make a square ma...

Maple 2015

Dear Users!

Hope everyone fine here. I want to collocate Vector IntXYZ1 and IntXYZ2 present in file Q1 in such a way that the first M1M2 + 2(M3-1)M2 + 2(M3-1)(M1-2) rows are zero and other rows are collocated at x=(i-1)/(M1-1), y=(j-1)/(M2-1), t=(k-1)/(M3-1) for i = 2,3,…,M1-1, j = 2,3,…,M2-1, k = 2,3,…,M3 as given as XX (of order 27 by 27 with first 25 rows are zero) for M1=M2=M3=3

I am waiting for positive response to fix this issue. Thanks in advance

Q1.mw

## Some queries in matrix evaluation ...

Maple

Dear Users!

Hope everyone fine here. I have following three quires that need to be fix.

1. I want to collocate Vector IntXYZ1 and IntXYZ2 present in file Q1 in such a way that the first M1M2 + 2(M3-1)M2 + 2(M3-1)(M1-2) rows are zero and other rows are collocated at x=(i-1)/(M1-1), y=(j-1)/(M2-1), t=(k-1)/(M3-1) for i = 2,3,…,M1-1, j = 2,3,…,M2-1, k = 2,3,…,M3 as given as XX (of order 27 by 27 with first 25 rows are zero) for M1=M2=M3=3

2. Next, in file Q2 we have a Vector b with some entries which are actually the values of chi[1, 1, 1], chi[1, 1, 2],...,chi[2, 2, 2] in such a following way

(Vector(8, {(1) = chi[1, 1, 1], (2) = chi[1, 1, 2], (3) = chi[1, 2, 1], (4) = chi[1, 2, 2], (5) = chi[2, 1, 1], (6) = chi[2, 1, 2], (7) = chi[2, 2, 1], (8) = chi[2, 2, 2]})) = (Matrix(8, 1, {(1, 1) = 0, (2, 1) = 0, (3, 1) = 0, (4, 1) = 0, (5, 1) = 1.000000000, (6, 1) = 1.000000000, (7, 1) = 1.000000000, (8, 1) = .3678794412}))

Matrix B given in file Q2 have entires which are the linear cobiniation of chi[1, 1, 1], chi[1, 1, 2],...,chi[2, 2, 2]. I want to evaluate matrix B at the values of chi[1, 1, 1], chi[1, 1, 2],...,chi[2, 2, 2] which are obtained in vector b.

3. I want to recall a vector B in file Q3 at highlighted portion and B matrix is present in Q4. Which is the command to recall or export a matrix which contain in some other file like in file Q4.

I shall be very grateful for your support.

## Transformation of a vector...

Maple 2015

Dear Users!
Hope everyone fine here. I have a vector V and want a new vector after transformation like

V := Vector(5, {(1) = 2, (2) = 3, (3) = -1, (4) = 9, (5) = 7});

after square transformation of V I got a new vector W like bellow

W := Vector(5, {(1) = 4, (2) = 9, (3) = 1, (4) = 81, (5) = 49});

and similarly sin transformation of V give the following matrix as

U := Vector(5, {(1) = sin(2), (2) = sin(3), (3) = sin(-1), (4) = sin(9), (5) = sin(7)});

## Construction of a square matrix using 2-...

Maple 15

Dear Users!
First, I define the following polynomial as:

restart; with(LinearAlgebra); nu := 1/2; M1 := 3; M2 := 3; #(any value of M1 and M2)
for k1 from 0 while k1 <= M1-1 do for k2 from 0 while k2 <= M2-1 do
SGP[M2*k1+k2+1] := simplify(sum((-1)^(k1-i1)*GAMMA(k1+i1+2*nu)*GAMMA(nu+1/2)*x^i1*(sum((-1)^(k2-i2)*GAMMA(k2+i2+2*nu)*GAMMA(nu+1/2)*t^i2/(GAMMA(i2+nu+1/2)*factorial(k2-i2)*factorial(i2)*GAMMA(2*nu)), i2 = 0 .. k2))/(GAMMA(i1+nu+1/2)*factorial(k1-i1)*factorial(i1)*GAMMA(2*nu)), i1 = 0 .. k1))
end do end do;
Lambda := `<,>`(seq(SGP[i], i = 1 .. M1*M2));

then, I want to define a square matrix A of order M1M2 by M1M2 after collocating SGP[k](x,y) at x=(i-1)/(M1-1) and y=(j-1)/(M2-1) for i=1,2,3,...M1, j=1,2,3,...M2.

For example, for M1=2 and M3=3 this matrix A is given as:

A:=Matrix(6, 6, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (2, 1) = SGP[1](0, 1), (2, 2) = SGP[2](0, 1), (2, 3) = SGP[3](0, 1), (2, 4) = SGP[4](0, 1), (2, 5) = SGP[5](0, 1), (2, 6) = SGP[6](0, 1), (3, 1) = SGP[1](1/2, 0), (3, 2) = SGP[2](1/2, 0), (3, 3) = SGP[3](1/2, 0), (3, 4) = SGP[4](1/2, 0), (3, 5) = SGP[5](1/2, 0), (3, 6) = SGP[6](1/2, 0), (4, 1) = SGP[1](1/2, 1), (4, 2) = SGP[2](1/2, 1), (4, 3) = SGP[3](1/2, 1), (4, 4) = SGP[4](1/2, 1), (4, 5) = SGP[5](1/2, 1), (4, 6) = SGP[6](1/2, 1), (5, 1) = SGP[1](1, 0), (5, 2) = SGP[2](1, 0), (5, 3) = SGP[3](1, 0), (5, 4) = SGP[4](1, 0), (5, 5) = SGP[5](1, 0), (5, 6) = SGP[6](1, 0), (6, 1) = SGP[1](1, 1), (6, 2) = SGP[2](1, 1), (6, 3) = SGP[3](1, 1), (6, 4) = SGP[4](1, 1), (6, 5) = SGP[5](1, 1), (6, 6) = SGP[6](1, 1)});

for M1=3 and M=2 the matrix A is given as:

A:=Matrix(6, 6, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (2, 1) = SGP[1](0, 1/2), (2, 2) = SGP[2](0, 1/2), (2, 3) = SGP[3](0, 1/2), (2, 4) = SGP[4](0, 1/2), (2, 5) = SGP[5](0, 1/2), (2, 6) = SGP[6](0, 1/2), (3, 1) = SGP[1](0, 1), (3, 2) = SGP[2](0, 1), (3, 3) = SGP[3](0, 1), (3, 4) = SGP[4](0, 1), (3, 5) = SGP[5](0, 1), (3, 6) = SGP[6](0, 1), (4, 1) = SGP[1](1, 0), (4, 2) = SGP[2](1, 0), (4, 3) = SGP[3](1, 0), (4, 4) = SGP[4](1, 0), (4, 5) = SGP[5](1, 0), (4, 6) = SGP[6](1, 0), (5, 1) = SGP[1](1, 1/2), (5, 2) = SGP[2](1, 1/2), (5, 3) = SGP[3](1, 1/2), (5, 4) = SGP[4](1, 1/2), (5, 5) = SGP[5](1, 1/2), (5, 6) = SGP[6](1, 1/2), (6, 1) = SGP[1](1, 1), (6, 2) = SGP[2](1, 1), (6, 3) = SGP[3](1, 1), (6, 4) = SGP[4](1, 1), (6, 5) = SGP[5](1, 1), (6, 6) = SGP[6](1, 1)});

and for M1=M2=3 the matrix A should be the following form:

A:=Matrix(9, 9, {(1, 1) = SGP[1](0, 0), (1, 2) = SGP[2](0, 0), (1, 3) = SGP[3](0, 0), (1, 4) = SGP[4](0, 0), (1, 5) = SGP[5](0, 0), (1, 6) = SGP[6](0, 0), (1, 7) = SGP[7](0, 0), (1, 8) = SGP[8](0, 0), (1, 9) = SGP[9](0, 0), (2, 1) = SGP[1](0, 1/2), (2, 2) = SGP[2](0, 1/2), (2, 3) = SGP[3](0, 1/2), (2, 4) = SGP[4](0, 1/2), (2, 5) = SGP[5](0, 1/2), (2, 6) = SGP[6](0, 1/2), (2, 7) = SGP[7](0, 1/2), (2, 8) = SGP[8](0, 1/2), (2, 9) = SGP[9](0, 1/2), (3, 1) = SGP[1](0, 1), (3, 2) = SGP[2](0, 1), (3, 3) = SGP[3](0, 1), (3, 4) = SGP[4](0, 1), (3, 5) = SGP[5](0, 1), (3, 6) = SGP[6](0, 1), (3, 7) = SGP[7](0, 1), (3, 8) = SGP[8](0, 1), (3, 9) = SGP[9](0, 1), (4, 1) = SGP[1](1/2, 0), (4, 2) = SGP[2](1/2, 0), (4, 3) = SGP[3](1/2, 0), (4, 4) = SGP[4](1/2, 0), (4, 5) = SGP[5](1/2, 0), (4, 6) = SGP[6](1/2, 0), (4, 7) = SGP[7](1/2, 0), (4, 8) = SGP[8](1/2, 0), (4, 9) = SGP[9](1/2, 0), (5, 1) = SGP[1](1/2, 1/2), (5, 2) = SGP[2](1/2, 1/2), (5, 3) = SGP[3](1/2, 1/2), (5, 4) = SGP[4](1/2, 1/2), (5, 5) = SGP[5](1/2, 1/2), (5, 6) = SGP[6](1/2, 1/2), (5, 7) = SGP[7](1/2, 1/2), (5, 8) = SGP[8](1/2, 1/2), (5, 9) = SGP[9](1/2, 1/2), (6, 1) = SGP[1](1/2, 1), (6, 2) = SGP[2](1/2, 1), (6, 3) = SGP[3](1/2, 1), (6, 4) = SGP[4](1/2, 1), (6, 5) = SGP[5](1/2, 1), (6, 6) = SGP[6](1/2, 1), (6, 7) = SGP[7](1/2, 1), (6, 8) = SGP[8](1/2, 1), (6, 9) = SGP[9](1/2, 1), (7, 1) = SGP[1](1, 0), (7, 2) = SGP[2](1, 0), (7, 3) = SGP[3](1, 0), (7, 4) = SGP[4](1, 0), (7, 5) = SGP[5](1, 0), (7, 6) = SGP[6](1, 0), (7, 7) = SGP[7](1, 0), (7, 8) = SGP[8](1, 0), (7, 9) = SGP[9](1, 0), (8, 1) = SGP[1](1, 1/2), (8, 2) = SGP[2](1, 1/2), (8, 3) = SGP[3](1, 1/2), (8, 4) = SGP[4](1, 1/2), (8, 5) = SGP[5](1, 1/2), (8, 6) = SGP[6](1, 1/2), (8, 7) = SGP[7](1, 1/2), (8, 8) = SGP[8](1, 1/2), (8, 9) = SGP[9](1, 1/2), (9, 1) = SGP[1](1, 1), (9, 2) = SGP[2](1, 1), (9, 3) = SGP[3](1, 1), (9, 4) = SGP[4](1, 1), (9, 5) = SGP[5](1, 1), (9, 6) = SGP[6](1, 1), (9, 7) = SGP[7](1, 1), (9, 8) = SGP[8](1, 1), (9, 9) = SGP[9](1, 1)});

Please help to define general matrix A for any values of M1 and M2. I will be very grateful for you.

## Need to reduce the Jacobian matrix const...

Maple 2015

Dear Users!
Hope everyone fine here. I tried (as given bellow) to find the solution of nonlinear system of PDEs via FDM. To solve system of nonlinear equations I used newton raphson method and for higher value of like Mx > 8 the matrix G and G1 (mentioned as red) take alot of time. Can anyone help me to reduce the computational time? Becuase I have to evealuate the solution for Mx = 50.

restart; Digits := 30; with(LinearAlgebra);
T := 1; L := 3; N := 30; Mx := 5; `&Delta;x` := L/(1.*Mx); `&Delta;t` := T/(1.*N);
for i from 0 while i <= Mx do
u[i, 0] := 0.; u[i, -1] := u[i, 1]; tau[i, 0] := 0.; theta[i, 0] := 0.; theta[i, -1] := theta[i, 1]
end do;
for n from 0 while n <= N do u[0, n] := 0.; u[Mx, n] := 0.; theta[0, n] := 1.; theta[Mx, n] := 0.
end do;
for n from 0 while n <= N-1 do
print("Simulation in proccess at time-level n", n+1);
for i while i <= Mx-1 do
Ru[i, n] := simplify((u[i+1, n+1]-u[i+1, n])/`&Delta;t`+(u[i+1, n+1]-2*u[i+1, n]+u[i+1, n-1])/`&Delta;t`^2-(u[i+1, n+1]-2*u[i, n+1]+u[i-1, n+1])/`&Delta;x`^2+25.*(u[i+1, n+1]+(u[i+1, n+1]-u[i+1, n])/`&Delta;t`)-1.5*(theta[i, n]+(theta[i, n+1]-theta[i, n])/`&Delta;t`));
`R&theta;`[i, n] := simplify((theta[i+1, n+1]-theta[i+1, n])/`&Delta;t`+(theta[i+1, n+1]-2*theta[i+1, n]+theta[i+1, n-1])/`&Delta;t`^2-(theta[i+1, n+1]-2*theta[i, n+1]+theta[i-1, n+1])/((15.)*`&Delta;x`^2)-((u[i, n+1]-u[i-1, n+1])/`&Delta;x`)^2/(3.)) end do;
for i while i <= Mx-1 do
`R&tau;`[i, n] := simplify(tau[i+1, n+1]+(tau[i+1, n+1]-tau[i+1, n])/`&Delta;t`-1.5^(-1/4)*(u[i+1, n+1]-u[i, n+1])/`&Delta;x`)
end do;
Sys := `<,>`(seq(Ru[i, n], i = 1 .. Mx-1), seq(`R&tau;`[i, n], i = 1 .. Mx-1), seq(`R&theta;`[i, n], i = 1 .. Mx-1));
V := `<,>`(seq(u[i, n+1], i = 1 .. Mx-1), seq(theta[i, n+1], i = 1 .. Mx-1), seq(tau[i, n+1], i = 2 .. Mx));
G := Matrix(3*(Mx-1), proc (i, j) options operator, arrow; diff(Sys[i], V[j]) end proc); G1 := MatrixInverse(G);
X[n, 0] := Vector(1 .. 3*(Mx-1), 1);
for k1 from 0 to r do
X[n, k1+1] := eval(V-G1 . Sys, Equate(V, X[n, k1]))
end do;
Sol[n] := Equate(V, X[n, r+1]); assign(op(Sol[n]));
if n > 0 then
U := eval(`<,>`(seq(u[i1, n+1], i1 = 1 .. Mx)-seq(u[i1, n], i1 = 1 .. Mx))); Noru[n+1] := Norm(%, 2); print("L[&infin;] norm of &tau;(x,y,t) at time level = ", %);
Theta := eval(`<,>`(seq(theta[i1, n+1], i1 = 0 .. Mx)-seq(theta[i1, n], i1 = 0 .. Mx))); `Nor&theta;`[n+1] := Norm(%, 2); print("L[&infin;] norm of &theta;(x,y,t) at time level = ", %) else print("n < 0")
end if end do

Special request to:
@acer @Carl Love @Kitonum @Preben Alsholm

 5 6 7 8 9 10 11 Last Page 7 of 37
﻿