Hb

10 Reputation

3 Badges

7 years, 166 days

MaplePrimes Activity


These are replies submitted by Hb

@Preben Alsholm Thanks a lot.

Now, the code runs and It is able to calculate and plot.

However, the calculation in Maple seems not correct!  For example, I gave center points as (x,y)=(0.11143,0.94020) in Gaussian function which must have a value 5 (Amplitute) i.e r(r,phi)=f(0.9415,1.4528)=5  (polar coordinates (r,phi)=(0.9415,1.4528)) and computed w(0.9415,1.4528,0)=3.561804477 i.e the solution at time=0. This must be the exactly same value with the gaussian function (initial value) f(0.9415,1.4528).

This might be because of the huge peak value in Gaussian function that numerical integration cannot handle. 

If I decrease sigma(x and y spreads of the blob) i.e no sharp peak, then f(r',phi')=w(r',phi',0).

Any idea(s) what kind of methods in Maple should be used for such huge gradients?

M := Matrix([[3.83170597020751, 7.01558666981561, 10.1734681350627, 13.3236919363142, 16.4706300508776], [1.84118378134065, 5.33144277352503, 8.53631636634628, 11.7060049025920, 14.8635886339090], [3.05423692822714, 6.70613319415845, 9.96946782308759, 13.1703708560161, 16.3475223183217], [4.20118894121052, 8.01523659837595, 11.3459243107430, 14.5858482861670, 17.7887478660664], [5.31755312608399, 9.28239628524161, 12.6819084426388, 15.9641070377315, 19.1960288000489], [6.41561637570024, 10.5198608737723, 13.9871886301403, 17.3128424878846, 20.5755145213868], [7.50126614468414, 11.7349359530427, 15.2681814610978, 18.6374430096662, 21.9317150178022], [8.57783648971407, 12.9323862370895, 16.5293658843669, 19.9418533665273, 23.2680529264575], [9.64742165199721, 14.1155189078946, 17.7740123669152, 21.2290626228531, 24.5871974863176], [10.7114339706999, 15.2867376673329, 19.0045935379460, 22.5013987267772, 25.8912772768391], [11.7708766749555, 16.4478527484865, 20.2230314126817, 23.7607158603274, 27.1820215271905]]):

c := 10:

A := 5:

w := proc (r, phi, t) local xi, eta; if not type([args], list(realcons)) then return 'procname(args)' end if; evalf(Int(f(xi, eta)*G(r, phi, xi, eta, t)*xi, [xi = 0 .. 1, eta = 0 .. 2*Pi])) end proc;

proc (r, phi, t) local xi, eta; if not type([args], list(realcons)) then return 'procname(args)' end if; evalf(Int(f(xi, eta)*G(r, phi, xi, eta, t)*xi, [xi = 0 .. 1, eta = 0 .. 2*Pi])) end proc

 

3.561804477

 

w(.9415, 1.4528, t)

 

 

``



Download replied_2d_soln.mw

 

@mehdi jafari Thanks a lot. I got the idea. I tried the following

f(x,y):=x+y:
c:=10^(-1): G(x,y,xi,eta,t):=(1+2*(sum((exp(-Pi^(2)*n^(2)*c*t))*cos(n*Pi*x)*cos(n*Pi*xi),n=1..10)))*(1+2*(sum((exp(-Pi^(2)*m^(2)*c*t))*cos(m*Pi*y)*cos(m*Pi*eta),m=1..10))):
w(x,y,t):=int(int(f(xi,eta)*G(x,y,xi,eta,t), eta=0..1), xi=0..1):
plot(w(.51086, .49427, t), t = 0 .. 1);
for t from 0 to 100 do w(.51086, .49427, 0.01*t) end do;

by doing that, i can get 101*2 matrix.

Thanks again.

 

I used for loop

for t from 0 to 100 do w(.51086, .49427, t), t*0.01) do

to get the y_coordinates. Hence I can write 101*2 Martix. 

@mehdi jafari thanks for your prompt comment. Here is the maple code;

f(x,y):=x+y:
c:=10^(-1): G(x,y,xi,eta,t):=(1+2*(sum((exp(-Pi^(2)*n^(2)*c*t))*cos(n*Pi*x)*cos(n*Pi*xi),n=1..10)))*(1+2*(sum((exp(-Pi^(2)*m^(2)*c*t))*cos(m*Pi*y)*cos(m*Pi*eta),m=1..10))):
w(x,y,t):=int(int(f(xi,eta)*G(x,y,xi,eta,t), eta=0..1), xi=0..1):
plot(w(.51086, .49427, t), t = 0 .. 1);
plottools:-getdata(%); M := %[-1]; ExportMatrix("new2.dat", M);

It gives me 200*2 matrix. For example; first 5 coordinates (x,y) is 

0.0000000000000000e+00 1.0054420984938566e+00
5.2576050251256284e-03 1.0053136811087655e+00
9.8322190452261315e-03 1.0052447682494321e+00
1.4976850954773869e-02 1.0051969485736694e+00
2.0155584824120606e-02 1.0051685044159542e+00

But I want to have the coordinates (x,y ) something like this

0.00   y0
0.01   y1
0.02   y2
...       ...
1.00   y101

For the above coordinates, I need 101*2 Matrix with spesific x coordinates.

 

 

 

I have realized that the command cannot be seen now. It might be better if I type here

plottools:-getdata(%); M := %[-1]; ExportMatrix("new2.dat", M)

 

Page 1 of 1