Muhammad Usman

220 Reputation

5 Badges

9 years, 255 days
Beijing, China

MaplePrimes Activity


These are replies submitted by Muhammad Usman

@tomleslie thanks. I fix my problem by doing some change in your above shared file (genMAt2). Now I want to know the solution of one more querry. 

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 combination 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.

Q2.mw

@tomleslie Thanks for your answer. The above reply of my post is not appropriate. In my previous question using some polynomials you generated a square matrix using collocation points but here I need to collocate a vector to generate a square matrix. Let me try to explain what I want to do. Consider the following code for any values of M1, M2 and M3

restart; with(LinearAlgebra); M1 := 3; M2 := 3; M3 := 3;
rho[1] := 1; rho[2] := 1; rho[3] := 1; alpha[1] := 0; alpha[2] := 0; alpha[3] := 0;
X := Vector(M1, proc (n) options operator, arrow; x^(n-1) end proc);
Y := Vector(M2, proc (n) options operator, arrow; y^(n-1) end proc);
Z := Vector(M3, proc (n) options operator, arrow; t^(n-1) end proc);
KroneckerProduct(X, Y); XYZ := KroneckerProduct(%, Z);
IntX := Vector(M1, proc (n) options operator, arrow; x^(n-alpha[1]*rho[1])*Beta(1-alpha[1], n/rho[1])/rho[1] end proc);
IntY := Vector(M2, proc (n) options operator, arrow; y^(n-alpha[2]*rho[2])*Beta(1-alpha[2], n/rho[2])/rho[2] end proc);
IntZ := Vector(M3, proc (n) options operator, arrow; t^(n-alpha[3]*rho[3])*Beta(1-alpha[3], n/rho[3])/rho[3] end proc); KroneckerProduct(X, Y);
IntXYZ1 := convert(KroneckerProduct(%, IntZ), Vector);KroneckerProduct(IntX, IntY);
IntXYZ2 := convert(KroneckerProduct(%, Z), Vector);

Here,  I want to collocate Vector IntXYZ1 and IntXYZ2 as highlighted by red color and generate squares matrices corresponds to IntXYZ1 and IntXYZ2, in such a way that the first M1M2 + 2(M3-1)M2 + 2(M3-1)(M1-2) rows of desired squares matrices are zero and other rows are obtained by collocating the vectors IntXYZ1/IntXYZ2 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 in above for M1=M2=M3=3. 

In your response your wrote a general expression (t^p)*((1/2)^q)*((1/2)^r)/p to generate the other nonzero rows rather than collocating the vectors IntXYZ1/IntXYZ2. Hope you understand what I want to do. I am waiting for your response. Thanks

@Kitonum Thanks for your answer. Need some further modification of above matrix and want to construct the matrix as given in attached file for any values of M1 and M2. Let me explain it.

It is the matrix formulation for M1=M2=4 like this way

A=b

where A is formulated as,

  1. First four rows (highlighted as red) are generated by collocating G’s at t=0 and x=0,1/3,2/3 and 1. For any values of M1 and M2, first M1 rows should generated by collocating G’s at t=0 and x=0,1/M1-1,2/M1-1,…,1.
  2. Next, three rows (highlighted as green) are generated by collocating G’s at x=0 and t=1/3,2/3 and 1. For any values of M1 and M2, next M2-1 rows should generated by collocating G’s at x=0 and t=1/M2-1,2/M2-1,…,1.
  3. Next, three rows (highlighted as blue) are generated by collocating G’s at x=1 and t=1/3,2/3 and 1. For any values of M1 and M2, next M2-1 rows should generated by collocating G’s at x=1 and t=1/M2-1,2/M2-1,…,1.
  4. Finally, the last six rows (highlighted as black) are generated by collocating G’s at x=1/3,2/3 and t=1/3,2/3 and 1. For any values of M1 and M2, next M1M2-M1-2*M2+2 rows should generated by collocating G’s at x=1/M1-1,2/M1-1,…,M1-2/M1-1 and t=1/M2-1,2/M2-1,…,1.

In the similar way, b also generated with the help of functions phi(x), f1(x), f2(x) and g(x,t)

Take phi(x)=sin(x), f1=exp(-t), f2=sin(1)exp(-t) and g(x,t)=sin(x)exp(-2t)+sin(x)

 

Further how we can split A matrix into 3 matrices with same dimension M1M2 y M1M2 as:

A1+A2+A3=A

where A1 has red highlighted portion and rest rows are zero

A2 has green and blue highlighted portions and rest rows are zero

and A3 has black highlighted portion and other rows are zero.

Same procedure for spliting vector f=f1+f2+f3

@Thomas Richard Thanks for your answer. Sorry there were a little mistak in above PDEs the corrected PDEs are

PDE1 := diff(u(y, t), t)+diff(u(y, t), t, t) = diff(u(y, t), y, y)-u(y, t);
PDE2 := v(y, t)+diff(v(y, t), t) = diff(u(y, t), y);
ICandBC := {u(0, t) = 0, u(3, t) = 0, u(y, 0) = 0, v(y, 0) = 0, (D[2](u))(y, 0) = 0};
pds := pdsolve({PDE1, PDE2}, ICandBC, numeric)

Again I got some error given bellow

Error, (in pdsolve/numeric/par_hyp) input system is too far from a 'standard' form (see ?pdsolve,numeric for more detail)

@tomleslie dear In the attachment I wrote the same code as given in above. But in the attached file I used summation form instead of computing integrals which definitely reduces the computational time. My question is can we write our required matrix F in “proc” which reduces more computational time? If yes please help me. I am waiting for your kind response.

nonlinear.mw

@tomleslie that one have some error I just come to know. The above one is new I need help about it

@Preben Alsholm thanks a lot for couple of positive response. Your last response is fruitful for me. But it still take a lot of time in evolution. Can you reduce it computation time. Your positive response is highly appreciable. 

@Preben Alsholm please see the the following file

hELP.mw

@Preben Alsholm thank you for your response. I also have set of numeric values for the above integration. 

x = i/(1.*M1), y = j/(1.*M2) for i=1..M1 and j=1..M2

Now how to evalute it? I tried but got error.

@Preben Alsholm thank you for your answer. Can we integrat it via some numerical method and how?

@Preben Alsholm thanks for your response. I made a little mistake in my asked question. The function U should be the following one

U := q^6*sin(p);

instead of U := y^6*sin(x);

Now please guide me. Thanks

@tomleslie Thanks for your response. In the above code, integration part take alot of timw when NN=4. I need to run it for higher values like NN=7,8,9. Please Let me know how we can reduce computational time here?

@Christian Wolinski thanks for your positive response. I have another problem regarding above querry suppose,

Sol := {u[1, 1, 1, 1] = 0.33004814594903018204e-1, u[1, 1, 2, 1] = 0.67470784550800487342e-1, u[1, 2, 1, 1] = 0.67470784550800487340e-1, u[1, 2, 2, 1] = .13881687114056674193, u[2, 1, 1, 1] = 0.63417136832119584739e-1, u[2, 1, 2, 1] = .13209553008466760265, u[2, 2, 1, 1] = .13209553008466760265, u[2, 2, 2, 1] = .27601195211329433114}

is a set of points if apply your command like

for i while i <= nops(Sol) do (proc (x, y) assign(x, y) end proc)(op(op(i, Sol))) end do

fail to see the value of u[2, 2, 2, 1]; 

File is also attached for more justification

Help.mw

@acer thanks for your positive response!

1 2 3 4 5 6 7 Page 2 of 9