## 115 Reputation

9 years, 107 days

## MaplePrimes Activity

### These are replies submitted by Ali Hassani

Thank you for answering my questions. My problem is complicated. I chose not to involve you in these complexities and therefore refrained from expressing them in my question. But let me briefly explain a little about it now. I have a system of partial differential equations with three differential equations in terms of the space variable x and the time variable t. Solving this set of equations by DTM leads to the following results for three unknown functions p(x,t), d(x,t) and u(x,t). Until the time t<0.65, the results of the DTM analytical solution match the numerical solution very well, but for times higher than 0.65, when the curves of these functions tend to relax, the solutions of the two methods differ greatly. It is obvious that a polynomial can never be used to describe a phenomenon that has an asymptote in sufficiently large times. Therefore, I tried to write the coefficients of different powers of x, i.e. the coefficients of x^0, x^1, etc., as exponential functions, but I failed to do so. The function in terms of time that I gave in my previous question was actually the coefficient of x^0 for the function u(x,t).

The functions are given below:

restart;

u:=unapply(0.02042784616*t + 0.5934518606*t^19 + 0.02399697711*t^2 + 0.02409685137*t^4 + 0.01484561579*t^5 - 0.004508537847*t^6 - 0.03553898135*t^7 - 0.07666698829*t^8 - 0.1208430459*t^9 - 0.1532807096*t^10 - 0.1502887315*t^11 - 0.08081711694*t^12 + 0.08723908368*t^13 + 0.3739922121*t^14 + 0.02613532070*t^3 + 0.7668074342*t^15 + 1.193400178*t^16 + 1.494763985*t^17 + 1.410156260*t^18 - 1.314344866*t^20 + (0.0001602091329 - 0.0002588223953*t^7 - 0.00003670894097*t^5 + 0.002284882542*t^16 + 0.000489737032*t^17 - 0.003218701037*t^18 - 0.008921099152*t^19 - 0.01584390299*t^20 + 0.00009127134483*t^3 + 0.0001145531905*t^2 + 0.0000425415970*t^4 + 0.0001236658945*t - 0.0001428596745*t^6 - 0.0003497975843*t^8 - 0.0003623436479*t^9 - 0.0002303215016*t^10 + 0.0001084637276*t^11 + 0.0006822170349*t^12 + 0.001442367098*t^13 + 0.002215016346*t^14 + 0.002662880153*t^15)*x^2 + (-0.001851175507 + 0.003332013481*t^7 + 0.001097507251*t^6 - 0.07330207408*t^16 - 0.07518594581*t^17 - 0.04454534760*t^18 + 0.03625647239*t^19 + 0.1792588338*t^20 - 0.0004951161665*t^5 - 0.001800264267*t^3 - 0.001419753442*t^4 - 0.001820121246*t^2 - 0.001682130126*t + 0.005911541112*t^8 + 0.008144282327*t^9 + 0.008866873696*t^10 + 0.006494618183*t^11 - 0.000700192505*t^12 - 0.01398148785*t^13 - 0.03316046175*t^14 - 0.05528837322*t^15)*x + 0.0203999494 + (1.028100634*10^(-6) - 7.2053940*10^(-9)*t^7 + 3.512972245*10^(-7)*t - 0.00003497610592*t^16 - 0.00004527725289*t^17 - 0.00004271842203*t^18 - 0.00001570993346*t^19 + 0.00004672084995*t^20 - 8.422234223*10^(-7)*t^5 - 1.77162729*10^(-8)*t^2 - 6.945625630*10^(-7)*t^4 - 3.804682369*10^(-7)*t^3 - 6.645686172*10^(-7)*t^6 + 1.203477024*10^(-6)*t^8 + 2.854424079*10^(-6)*t^9 + 4.530196526*10^(-6)*t^10 + 5.431408984*10^(-6)*t^11 + 4.397599398*10^(-6)*t^12 + 1.23200710*10^(-7)*t^13 - 8.350527253*10^(-6)*t^14 - 0.00002083583998*t^15)*x^4 + (-1.342770642*10^(-8)*t^6 - 1.096253366*10^(-9)*t + 6.919960539*10^(-8)*t^4 + 2.576278608*10^(-6)*t^15 + 2.940984406*10^(-6)*t^16 + 2.147140944*10^(-6)*t^17 - 5.357988488*10^(-7)*t^18 - 5.605196358*10^(-6)*t^19 - 0.00001284610126*t^20 + 3.574739887*10^(-8)*t^2 + 4.738159065*10^(-8)*t^5 + 6.154536896*10^(-8)*t^3 - 1.141655216*10^(-7)*t^7 - 2.391446950*10^(-7)*t^8 - 3.487196159*10^(-7)*t^9 - 3.765295797*10^(-7)*t^10 - 2.367459406*10^(-7)*t^11 + 1.528364050*10^(-7)*t^12 + 8.279951956*10^(-7)*t^13 + 1.717406399*10^(-6)*t^14 - 7.506931272*10^(-8))*x^5 + (-0.00001319241425 + 0.00001381764332*t^7 + 3.220810850*10^(-6)*t^4 - 1.440128201*10^(-6)*t^3 + 0.0001682999985*t^16 + 0.0003848197765*t^17 + 0.0006196887011*t^18 + 0.0007730952084*t^19 + 0.0006862052240*t^20 - 7.737775817*10^(-6)*t + 8.380692889*10^(-6)*t^5 - 5.012430459*10^(-6)*t^2 + 0.00001264107031*t^6 + 9.24578427*10^(-6)*t^8 - 3.45734056*10^(-6)*t^9 - 0.00002508317990*t^10 - 0.00005305744153*t^11 - 0.00007957882544*t^12 - 0.00009045113940*t^13 - 0.00006581645632*t^14 + 0.0000157275211*t^15)*x^3,x, t):

p:=unapply(3261.631540*t - 24640.64441*t^19 + 77.6033741*t^2 - 838.5816503*t^4 - 996.9753328*t^5 - 970.9781968*t^6 - 708.1029436*t^7 - 163.282831*t^8 + 669.489913*t^9 + 1722.149667*t^10 + 2817.646992*t^11 + 3645.300782*t^12 + 3762.486482*t^13 + 2643.149810*t^14 - 519.1629472*t^3 - 205.84929*t^15 - 5046.36104*t^16 - 11632.26790*t^17 - 18890.29469*t^18 - 25495.98306*t^20 - 2982.073516 + (-5018.651782*t^19 - 6144.252129*t^20 + 4.649705204*t - 47.08281109*t^2 + 65.57902768*t^3 + 59.29853566*t^4 + 9.948239835*t^5 - 59.05288110*t^6 - 0.05595024087 - 35.96370904*t^16 - 1333.995231*t^17 - 3135.188227*t^18 - 125.2398866*t^7 - 160.6848530*t^8 - 134.3474032*t^9 - 20.23319235*t^10 + 189.2954607*t^11 + 466.9518197*t^12 + 735.1792911*t^13 + 859.6908654*t^14 + 662.2944526*t^15)*x^4 + (0.3921509832 + 13980.41961*t^20 - 33.51128266*t + 193.2632448*t^2 - 103.6349678*t^3 - 197.1569492*t^4 - 178.0757484*t^5 - 63.03987273*t^6 + 130.3327568*t^7 - 3735.920207*t^16 - 2812.398021*t^17 + 278.5626742*t^18 + 5995.037775*t^19 + 362.5236964*t^8 + 562.5787113*t^9 + 628.7508536*t^10 + 443.7027576*t^11 - 91.16295603*t^12 - 1001.023690*t^13 - 2168.679653*t^14 - 3268.695115*t^15)*x^3 + (-2.342163546 + 2884.872713*t^20 + 205.9927168*t - 608.1782821*t^2 - 80.71871293*t^3 + 274.8684968*t^4 + 504.2841013*t^5 + 572.2881260*t^6 + 425.3368509*t^7 + 7873.067241*t^16 + 12419.68233*t^17 + 15079.13767*t^18 + 12981.55172*t^19 + 25.90207401*t^8 - 611.9462828*t^9 - 1385.299938*t^10 - 2072.862574*t^11 - 2329.841098*t^12 - 1729.183957*t^13 + 128.9830398*t^14 + 3427.478062*t^15)*x^2 + (10.90951815 - 53362.26757*t^20 - 986.1072932*t + 1166.109045*t^2 + 824.3490594*t^3 + 348.2252092*t^4 - 225.9758452*t^5 - 836.8016914*t^6 - 1362.773087*t^7 + 4167.637286*t^16 - 4629.824250*t^17 - 18785.59359*t^18 - 36622.23014*t^19 - 1622.088219*t^8 - 1394.877446*t^9 - 475.7632103*t^10 + 1238.139312*t^11 + 3628.401996*t^12 + 6226.878644*t^13 + 8121.489518*t^14 + 7964.320616*t^15)*x,x , t):

d:=unapply((-0.1126854981*t^8 - 0.1332430446*t^9 - 0.1049790455*t^10 - 0.005621587259*t^11 + 0.1752252430*t^12 + 0.4223463513*t^13 + 0.6800503824*t^14 + 0.8414608301*t^15 + 0.7502511087*t^16 + 0.2253101751*t^17 - 0.8815004126*t^18 - 2.589435043*t^19 - 4.661893923*t^20 + 0.02293363348*t^5 - 0.03563596966*t^2 + 0.04477488944*t^4 + 0.03852241174*t^3 - 0.01749743149*t^6 - 0.06739901847*t^7 + 0.004182278322*t)*x^4 + (0.1550803538*t^8 + 0.3360953629*t^9 + 0.4932321948*t^10 + 0.5476877824*t^11 + 0.4015441903*t^12 - 0.03922252026*t^13 - 0.8235742612*t^14 - 1.897166407*t^15 - 3.036268716*t^16 - 3.794876612*t^17 - 3.499744757*t^18 - 1.339551502*t^19 + 3.403526038*t^20 - 0.02739218837*t - 0.1385340577*t^5 + 0.1363971713*t^2 - 0.09852506758*t^6 + 0.001638775196*t^7 - 0.1209166912*t^4 - 0.04453535207*t^3)*x^3 + (0.2689376105*t^8 - 0.06380565434*t^9 - 0.5862959324*t^10 - 1.232499281*t^11 - 1.841583225*t^12 - 2.142580403*t^13 - 1.770018354*t^14 - 0.3314432482*t^15 + 2.454786098*t^16 + 6.545772076*t^17 + 11.30575751*t^18 + 15.24772945*t^19 + 15.90545984*t^20 - 0.1102402531*t^3 - 0.3969190520*t^2 + 0.1089964038*t^4 + 0.1548685386*t + 0.4020359219*t^6 + 0.4120657627*t^7 + 0.2870022037*t^5)*x^2 + (-1.087578661*t^8 - 1.239953150*t^9 - 1.029900542*t^10 - 0.2900479591*t^11 + 1.083483767*t^12 + 3.040131107*t^13 + 5.266676350*t^14 + 7.089863487*t^15 + 7.439011772*t^16 + 4.937892562*t^17 - 1.795181566*t^18 - 13.57486585*t^19 - 29.79580688*t^20 + 0.0414669576*t^5 + 0.5571400332*t^3 + 0.3431172386*t^4 + 0.6745162257*t^2 - 0.6902307072*t - 0.7410367969*t^7 - 0.3350457894*t^6)*x + 0.643676157*t^9 + 1.421423265*t^10 + 2.184797441*t^11 + 2.661110153*t^12 + 2.472606800*t^13 + 1.191563053*t^14 - 1.538015187*t^15 - 5.801572259*t^16 - 11.14934012*t^17 - 16.31447422*t^18 - 19.01450594*t^19 - 15.99481503*t^20 + 1.892650932*t + 0.020721000*t^2 - 0.352662486*t^3 - 0.559051170*t^4 - 0.6575066687*t^5 - 0.6225442462*t^6 - 0.4111214131*t^7 + 0.0110966753*t^8, x, t):

Below are the results of numerical solution and DTM solution at x=0 compared to each other:

Can you help me solve this problem?

Thank you for your answer and your time. Let me explain to you more. The value of the function physically tends to a constant with the passage of time. Now, the few sentences that I wrote in my question, for the range of time between zero and 0.65, give an valid answer according to the numerical solution of the problem. I know that in response time equal to 1 second, it has reached its final value with acceptable accuracy. Also, all betas are positive values. This causes all exponential terms to be equal to zero at infinity. In fact, my answer has a general form similar to 1-exp(-5*t). It should be noted that these polynomial terms are obtained from the Differential Transformation Method based on Taylor's expansion, and I know that 20 terms are not enough to obtain a general form similar to 1-exp(-5*t). But reaching more terms will exponentially increase the cost of calculations. But apparently, I have no choice but to get more terms, for example 60 terms. It should also be said that I tried to obtain the exponential function with the “gfun” package, but again I did not succeed. Do you have any ideas to help solve the problem?

Best wishes

## About specfunc and its output...

Thanks very much for your reply. I studied your codes and tried to learn the logic you used.
I have a question.
Can you explain to me what "specfunc" creates?
What is the difference between, for example, specfunc(identical(x^2), sin) and specfunc(sin)?
What is "identical(*)"?
I would appreciate it if you could guide me.

Best wishes

## I am confused....

It is very difficult to realize. As you said, there is no useful documentation in Maple's help.

If possible, please write a code to extract only (-4*sin(x)) from the mentioned expression. Moreover, please create a separate command to extract only (2*exp(y^2)).

I have another question: Do you have any references to help me learn about this issue?

I am looking forward to hearing from you.

## Thanks a lot...

@nm Thanks very much

Very excellent

Thanks very much

Very excellent

Thanks very much

## Would you please updata the code?...

@Kitonum

Before anything, I thank you for your attention to my problem. As @nm said, I need to move all terms, including u(x,t), into the left side of the equation, and all source terms are moved to the right side. I confused you by saying, "I want all terms with 'diff' to be moved to the left side of the equation and all source terms to be moved to the right side of the equation." Therefore, I sincerely apologize and ask you to update the code.

## Very excellent...

Thanks very much.

## I'm surprised. Please explain to me...

Dear acer,

I am surprised by your coding style when writing this transformation. Is it possible to explain to me the different parameters used in the define command, such as nonunit, algebraic, conditional, anything, identical, freeof, and _type. I looked at the Maple Help about the define command, but I didn't see any professional code like what you wrote.

In addition, during the coding process, I realized that I needed to transform the unknown function f(x), for example, in the expression 3*t*x^(-2)+4*alpha*t^4*f(x). The result of the transformation should be 3*t*T(1/x^2)+4*alpha*t^4*T(f(x)). Do you have any ideas on improving the code to cover this expression?

Best wishes

## thanks...

@acer Thank you very much

Best wishes

@acer Thanks very much for explaining in detail.

@tomleslie I always have a problem extracting the coefficients of "diff" functions in the expression. I saw you used "op~" to extract the coefficients in chebyshev(exp(x),x).
Is it possible to apply a simillar way to take the coeffiecients of the expression including "diff"? For example, let me assume the following expresstion:
eq:=2*ln(x)*diff(y(x),x,x)+2*x*diff(y(x),x)+sin(x)*x^2*y(x);
Now, the coefficeints of diff(y(x),x,x), diff(y(x),x), and y(x) are 2*ln(x), 2*x, and sin(x)*x^2, respectively.
How can I extract the above coefficients by coding in such a way you used for chebyshev(exp(x),x) or any other way you know?
Thanks