emma hassan

45 Reputation

9 Badges

12 years, 175 days

MaplePrimes Activity


These are replies submitted by emma hassan

@Kitonum 

thanx for helping me in creating matrix but what if i want solution of above scheme when boundary conditions are u(0,t)=u(1,t)=0 and initial condition is u(x,0)=e-x . Now here i dont need matrix i just need solution..please help.. here am attaching my code if you think its not correct please make it correct for me...thanx 

restart

with(LinearAlgebra)

with(Student[NumericalAnalysis])

m := 3

n := 3

FX := 1

FT := 0.5e-1

k := FT/n

h := FX/m

r := k/h^2

NULL

solve((1-3*r)*U[i-1, j+1]-(2*(2-3*r))*U[i, j+1]+(1-3*r)*U[i+1, j+1] = (1+3*r)*U[i-1, j]-(2*(2+3*r))*U[i, j]+(1+3*r)*U[i+1, j], U[i+1, j+1])

f := proc (i, j) options operator, arrow; (1+3*r)*U[i-1, j]/(1-3*r)-(4+6*r)*U[i, j]/(1-3*r)+(1+3*r)*U[i+1, j]/(1-3*r)+(-1)*(1-3*r)*U[i-1, j+1]/(1-3*r)+(4-6*r)*U[i, j+1]/(1-3*r) end proc

U[i, j] := 0

for i from 0 while i <= m-1 do u[i, 0] := evalf(sin(i*h)) end do

 

for i from 2 to m-1 do for j from 2 to n-1 do U[i+1, j+1] := f(i, j) end do end do

 

@Kitonum 

thanx for helping me in creating matrix but what if i want solution of above scheme when boundary conditions are u(0,t)=u(1,t)=0 and initial condition is u(x,0)=e-x . Now here i dont need matrix i just need solution..please help.. here am attaching my code if you think its not correct please make it correct for me...thanx 

restart

with(LinearAlgebra)

with(Student[NumericalAnalysis])

m := 3

n := 3

FX := 1

FT := 0.5e-1

k := FT/n

h := FX/m

r := k/h^2

NULL

solve((1-3*r)*U[i-1, j+1]-(2*(2-3*r))*U[i, j+1]+(1-3*r)*U[i+1, j+1] = (1+3*r)*U[i-1, j]-(2*(2+3*r))*U[i, j]+(1+3*r)*U[i+1, j], U[i+1, j+1])

f := proc (i, j) options operator, arrow; (1+3*r)*U[i-1, j]/(1-3*r)-(4+6*r)*U[i, j]/(1-3*r)+(1+3*r)*U[i+1, j]/(1-3*r)+(-1)*(1-3*r)*U[i-1, j+1]/(1-3*r)+(4-6*r)*U[i, j+1]/(1-3*r) end proc

U[i, j] := 0

for i from 0 while i <= m-1 do u[i, 0] := evalf(sin(i*h)) end do

 

for i from 2 to m-1 do for j from 2 to n-1 do U[i+1, j+1] := f(i, j) end do end do

 

n:=nops(L1);

for i from 1 to n do

U[1, i]:=L1[i]; U[2, i]:=L2[i]; U[i, 1]:=M1[i]; U[i, 2]:=M2[i];

od;

i got it what you want to say..but can you just explain me above mention codes...i am not able to understand why you have written them...

what is meant by nops and why just it takes n=1 always and loop which u ran...

n:=nops(L1);

for i from 1 to n do

U[1, i]:=L1[i]; U[2, i]:=L2[i]; U[i, 1]:=M1[i]; U[i, 2]:=M2[i];

od;

i got it what you want to say..but can you just explain me above mention codes...i am not able to understand why you have written them...

what is meant by nops and why just it takes n=1 always and loop which u ran...

Am sorry for writing here improperly the code but in actual i havent done that mistake which ur highlighting in your answer..i just pasted my code here wrong but maple sheet the loop commands are not coming with #. So if you ignored this mistake can you correct this for me...please will b kooking forward for your this help..thanks

Am sorry for writing here improperly the code but in actual i havent done that mistake which ur highlighting in your answer..i just pasted my code here wrong but maple sheet the loop commands are not coming with #. So if you ignored this mistake can you correct this for me...please will b kooking forward for your this help..thanks

friends please help me..i need it urgently please...

:D ya sorry without h...
i searched alot and got some results which was complicated to understand... so please can i have simple code for this because according to that code i have to alter it for cubic spline

:D ya sorry without h...
i searched alot and got some results which was complicated to understand... so please can i have simple code for this because according to that code i have to alter it for cubic spline

5 6 7 Page 7 of 7