assma

75 Reputation

5 Badges

6 years, 193 days

MaplePrimes Activity


These are replies submitted by assma

@acer thank you very much, this method is good

v2 := proc (x, y) options operator, arrow; sin(x)*cos(y) end proc;
u2 := proc (x, y) options operator, arrow; 3*sin(x)-cos(y) end proc;
w2 := proc (x, y) options operator, arrow; unapply(diff(v2(x, y), x)-(diff(u2(x, y), y))) end proc;
L1 := proc (x, y) option inline; abs(w2(x, y)) end proc; CodeTools:-Usage(evalhf(add(add(abs(w2(x, y)), x = 0 .. 10), y = 0 .. 10)));
memory used=2.68KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns
                      93.6605340983011844
w22 := proc (x, y) options operator, arrow; abs(cos(x)*cos(y)-sin(y)) end proc;
L2 := proc (x, y) option inline; w22(x, y) end proc; CodeTools:-Usage(evalhf(add(add(w22(x, y), x = 0 .. 10), y = 0 .. 10)));
memory used=2.68KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns
                      93.6605340983011844

 

@tomleslie I am derived v2() for x , u2() for y and  calculate the total output of the difference between them, this is simple example, u2() and v2() are large functions. If  w2() is explicit function, there is no problem, but if w2()  non-explicit function, it is a problem occur as in the example below

 

v2 := proc (x, y) options operator, arrow; sin(x)*cos(y) end proc;
u2 := proc (x, y) options operator, arrow; 3*sin(x)-cos(y) end proc;

w2 := proc (x, y) options operator, arrow; diff(v2(x, y), x)-(diff(u2(x, y), y)) end proc;
L1 := proc (x, y) option inline; abs(w2(x, y)) end proc; CodeTools:-Usage(evalhf(add(add(abs(w2(i, j)), i = 0 .. 10), j = 0 .. 10)));
Error, (in CodeTools:-Usage) unable to evaluate built-in function `diff` in evalhf

w2 := proc (x, y) options operator, arrow; cos(x)*cos(y)-sin(y) end proc;
(x, y) -> cos(x) cos(y) - sin(y)
L1 := proc (x, y) option inline; abs(w2(x, y)) end proc; CodeTools:-Usage(evalhf(add(add(abs(w2(i, j)), i = 0 .. 10), j = 0 .. 10)));
memory used=3.04KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns
                      93.6605340983011844

@Rouben Rostamian  I work the search for analytical and numerical solutions of partial differential equations, so i need the calculation errors and time for comparison between the methods are used and determine the best method.

thank you very much.

@Rouben Rostamian  Ans.1-I need a time of implementation for all errors

Ans.2- In order to compare this time with this time it takes to implement the numerical solutions.

Ans.3- n*n grid ,because of the numerical solutions are implemented on a specific set of points in order to be a good comparison, use the same number of points 

Ans.4- L1 =DD^2*(sum(abs(error)))

L2=(DD^2*(Sum((error)^2))^0.5, where DD=2*pi/n  (two dimension)

Ans.5- x,y,z=[0,2*pi] , 

L1 := proc (x, y, z) options operator, arrow; DD^3*(sum(sum(sum(abs(wr(x, y, z)-w3(x, y, z)), k = 0 .. n), j = 0 .. n), i = 0 .. n)) end proc;
L2 := proc (x, y, z) options operator, arrow;( (DD^3*(sum(sum(sum((wr(x, y, z)-w3(x, y, z))^2, k = 0 .. n), j = 0 .. n), i = 0 .. n)))^0.5 end proc;  x=i*DD, y=j*DD, z=k*DD, DD=2*pi/n (three dimension)


 

 

 

 

 

 

@Rouben Rostamian  I need to calculate the errors with the time required for their implementation (CPU time) and compared with the errors resulting from the numerical solutions, requires the use of a limited number of points within the specified period 0<x,y,z<2*Pi
I have no experience to work on maple, so i need help from people with experience,
thank you very much.

@tomleslie thank you very mach

@Rouben Rostamian  thank you very much , but i need the calcuiation for some point in domian , for example n^2 point, h=6.28/n, and why the CPU time is chang 

err2 := abs(wr(x,y) - w3(x,y)):
range2 := x=0..2*Pi, y=0..2*Pi:

maximize(err2, range2):

CodeTools:-Usage(maximize(err2, range2))
Warning, inserted missing semicolon at end of statement
memory used=3.98MiB, alloc change=0 bytes, cpu time=140.00ms, real time=133.00ms, gc time=0ns
                          0.9801976728

 

err2 := abs(ur(x,y) - u3(x,y)):
range2 := x=0..2*Pi, y=0..2*Pi:

maximize(err2, range2):

CodeTools:-Usage(maximize(err2, range2))
Warning, inserted missing semicolon at end of statement
memory used=3.99MiB, alloc change=0 bytes, cpu time=124.00ms, real time=135.00ms, gc time=0ns
                          0.9801976728

and what it mean real time , gc time and alloc change?

how can calculate three error and CPU time for all?

@assma I need your help, how can calculate the three types of errors(L1,L2 and L infinity) with  CPU for all error . I am an interface problem in the CPU is changing all the time of implementation. I am using maple 18

@Rouben Rostamian  x=[0,6.28],y=[0,6.28],z=[0,6.28]

@Rouben Rostamian I PhD student, i use maple for a short period of time, and through previous question for average absolute error and CPU time , this formula was suggested and was good.Now this formula is good for two dimension. I need formula for three dimension

thanks for your help

@Rouben Rostamian  w3(x,y) is not finite difference formula, it is analytic approximate solution for vorticity function, i need compare this solution with other numerical solutions, therefor i calculate L infinity and CPU time for two and three dimension.

LL := proc (x, y) option inline; abs(wr(x, y)-w3(x, y)) end proc; CodeTools:-Usage(evalf(maximize(LL(DD*i, DD*j), i = 0 .. N, j = 0 .. N))); memory used=15.06MiB, alloc change=32.00MiB, cpu time=873.00ms, real time=1.09s, gc time=93.60ms 0.000003360000000 I used this formula in two dimension , but this formula did not work if wr(x,y,z)and w3(x,y,z) ( in three dimension), and i need to understand cpu time, real time, gc time.

@Rouben Rostamian  

Thank you, but how can find the L infinity error with CPU time.

@Rouben Rostamian 

Thank you very much, I need find L infinity error=max(abs(wr(x,y)-w3(x,y))), with CPU time ,wr is exact and w3 is approximate, in maple 18

wr(x,y) is exact solution and w3(x,y) is approximate value, how can find max(abs(wr(x,y)-w3(x,y))) if x=i*dx, y=j*dy and i,j=0,...,N         

1 2 3 4 Page 3 of 4