Paras31

240 Reputation

9 Badges

1 years, 362 days
Agricultural University of Athens
PhD Candidate

Social Networks and Content at Maplesoft.com

Teacher of Mathematics with a proven track record of working in education management. Proficient in Ease of Adaptation, Course Design, and Instructional Technology. Holds a Bachelor's degree in Mathematics from the University of the Aegean and a Master's in Applied Mathematics at the Hellenic Open University, focusing on Ordinary and Partial Differential Equations. His enthusiasm lies in the application of mathematical models to real-world contexts, such as epidemiology and population growth. Aside from his passion for teaching, Athanasios enjoys football, basketball, and spending time with his dogs.

MaplePrimes Activity


These are replies submitted by Paras31

I would like to ask when Maple Ambassadors are going to receive the new license because my license expires in 11 days, and I need it for my research in Agriculture.

@dharr Maple

wval := CodeTools:-Usage(Re(approx_w(0.075, 1)))=0.0008359048

dwval := CodeTools:-Usage(Re(dapprox_w(0.075, 1)))=-0.062827521

theata := CodeTools:-Usage(Re(thetaApprox(0.075, 1)))=0.2735196835

Mathematica

approxW[0.075, 1]=0.000640127

dapproxW[0.075, 1]=-0.062794

thetaApprox[0.075, 1]=0.355

where

thetaApprox[x_?NumericQ, t_?NumericQ] := 
 Re[-(dcoeff/a) (dapproxW[x, t]/approxW[x, t]) - b]

As you can observe, the big difference there is when we translate the problem back to the original.

@dharr 

Mathematica

approxW[0.01, 1000]=0.736449

approxW[0.01, 3000]=0.835549

)approxW[0.01, 5000]=0.871917

 Maple

wval := CodeTools:-Usage(Re(approx_w(0.01, 1000)))=0.7396122132

wval := CodeTools:-Usage(Re(approx_w(0.01, 3000)))=0.8365462196

wval := CodeTools:-Usage(Re(approx_w(0.01, 5000)))=0.8688616449

 

@dharr As you can see in Mathematica (_ex_2.nb.pdf) [Fokas Method], I got exactly the same plot as the attached plot. 

First, I solved it with the Fourier series expansion on Maple Fourier_ex.2_.mw. I got exactly the same plot. Then I tried the Fokas method on Maple, and I got these differences. 

The main problem in the Maple routine is not the mathematics, because I have double checked it— it’s the structure of the numerical evaluation, and specifically how the contour integral is being implemented and evaluated numerically.

 

@dharr 

I have implemented the solution in Mathematica using a modular approach with NumericQ guards to ensure robust numerical evaluation. The integration is split into the diagonal 'wings' ($\lambda_1, \lambda_2$) and the horizontal segment ($\lambda_3$)
approxW[x_?NumericQ, t_?NumericQ] :=
Module[{temp1, temp2},
  temp1 = NIntegrate[
    Re[v[λ1[r], x, t]*dλ1[r] - v[λ2[r], x, t]*dλ2[r]], {r, 0, Infinity},
    AccuracyGoal -> 8, PrecisionGoal -> 8, MaxRecursion -> 25];
  temp2 = NIntegrate[
    Re[v[λ3[s], x, t]*dλ3[s]], {s, -l, l},
    AccuracyGoal -> 8, PrecisionGoal -> 8, MaxRecursion -> 25];
  temp1 + temp2]

approxW[0.01, 0.1] = 0.375077, which is different from my solution

@dharr 

The Fokas Method represents the solution as an integral in the complex $\lambda$-plane. To ensure the integral converges and is well-defined, we must stay within the $D^+$ domain, where the exponential term $e^{-d\lambda^2 t}$ decays rapidly.

Avoiding Poles: The boundary conditions (Robin type) introduce "poles" (points where the denominator becomes zero) along the real axis. By lifting the horizontal contour $\lambda_3$ by $+i$ (the $s+i$ shift you used), you effectively "fly over" these singularities, making the numerical integration smooth and reliable.

Analyticity: Because the function is analytic within the region enclosed by your chosen contours ($\lambda_1, \lambda_2, \lambda_3$), the Cauchy Integral Theorem ensures that this path provides the exact solution for the heat equation part of the Hopf-Cole transform.

I have solved this problem with the Fokas method and with the Fourier Series expansions, and as you can observe, the results are similar but not the same. For this reason I asked how to create  more accurate plots

Download ex2.mw

Download Fourier_ex.2_.mw

@dharr @acer Thanks for your assistance. Should I increase the tolerance for more accurate plots?

@dharr First of all, thank you very much for your help. Numerically, I validated my research, although when I tried to create the plots, Maple ran for too much time. Is there a trick to creating the plots faster? I have highlighted the code blocks in red.

Download third_try.mw

@dharr I have tried what you suggested, but as you can see, approx_w is not numeric. It should be 0.375077

Download second_try.mw

@acer 

Yes exactly! I tried running it again after fixing k*(L-x), but it still runs indefinitely.

Download resources.mw

@sand15 You are right the integrand must be integrand1 := Re(eval(V, k = k1(r))*dk1(r) - eval(V, k = k2(r))*dk2(r)):

@dharr Thank you!! It was difficult to find what to do hear. There were no other references for Fokas Method on Maple!


@Rouben Rostamian, I created a function, so the solution is given faster now, but when I try to replicate the two panels from the textbook, as you can see they are a bit different


 

restart; with(plots); with(ColorTools); with(LinearAlgebra); with(Student[VectorCalculus]); V := proc (k, x, t) options operator, arrow; -((1/2)*I)*exp(I*k*x-k^2*t)*(1/(k-I)+1/(k+I)-k*(1/(k^2+I)+1/(k^2-I)))/Pi end proc; k1 := proc (r) options operator, arrow; r*exp(((1/8)*I)*Pi) end proc; k2 := proc (r) options operator, arrow; r*exp(((7/8)*I)*Pi) end proc; dk1 := proc (r) options operator, arrow; exp(((1/8)*I)*Pi) end proc; dk2 := proc (r) options operator, arrow; exp(((7/8)*I)*Pi) end proc; u1 := proc (x::numeric, t::numeric) try evalf(Int(Re(V(k1(r), x, t)*dk1(r)-V(k2(r), x, t)*dk2(r)), r = 0 .. infinity)) catch: 0 end try end proc; approx_u := proc (x::numeric, t::numeric) Re(evalf(exp(-x/sqrt(2))*cos(t-x/sqrt(2))+u1(x, t))) end proc; surf := plot3d(proc (x, t) options operator, arrow; approx_u(x, t) end proc, 0 .. 3, 0 .. Student[VectorCalculus]:-`*`(2, Pi), grid = [40, 40], axes = boxed, labels = ["x", "t", "u(x,t)"], title = "Fokas Method Solution of Half-Line Heat Equation", shading = zhue)

 

``

 

 

p1 := plot(proc (x) options operator, arrow; approx_u(x, .1) end proc, 0 .. 2, color = red); p2 := plot(proc (x) options operator, arrow; approx_u(x, .2) end proc, 0 .. 2, color = green); p3 := plot(proc (x) options operator, arrow; approx_u(x, .3) end proc, 0 .. 2, color = blue); p4 := plot(proc (x) options operator, arrow; approx_u(x, .4) end proc, 0 .. 2, color = magenta); p5 := plot(proc (x) options operator, arrow; approx_u(x, .5) end proc, 0 .. 2, color = RGB(1.0, .5, 0.)); p6 := plot(proc (x) options operator, arrow; approx_u(x, .6) end proc, 0 .. 2, color = cyan); p0 := plot(exp(-x), x = 0 .. 2, linestyle = dash, color = black); display([p0, p1, p2, p3, p4, p5, p6], legend = ["u(x,0)", "t=0.1", "t=0.2", "t=0.3", "t=0.4", "t=0.5", "t=0.6"], legendstyle = [location = right, font = [Helvetica, 12]], view = [0 .. 2, 0 .. 1.2], labels = ["x", "u(x,t)"], labelfont = [Helvetica, 12], axes = boxed, title = "Short-Time Behavior of u(x,t)")

 

q1 := plot(proc (x) options operator, arrow; approx_u(x, .5) end proc, 0 .. 2, color = red); q2 := plot(proc (x) options operator, arrow; approx_u(x, 1.0) end proc, 0 .. 2, color = green); q3 := plot(proc (x) options operator, arrow; approx_u(x, 1.5) end proc, 0 .. 2, color = blue); q4 := plot(proc (x) options operator, arrow; approx_u(x, 2.0) end proc, 0 .. 2, color = magenta); q5 := plot(proc (x) options operator, arrow; approx_u(x, 2.5) end proc, 0 .. 2, color = RGB(1.0, .5, 0.)); q6 := plot(proc (x) options operator, arrow; approx_u(x, 3.0) end proc, 0 .. 2, color = cyan); q0 := plot(exp(-x), x = 0 .. 2, linestyle = dash, color = black); long_plot := display([q0, q1, q2, q3, q4, q5, q6], title = "Long-Time Behavior of u(x,t)", labels = ["x", "u(x,t)"], labelfont = [Helvetica, 12], legend = ["u(x,0)", "t=0.5", "t=1.0", "t=1.5", "t=2.0", "t=2.5", "t=3.0"], legendstyle = [location = right, font = [Helvetica, 10]], axes = boxed, view = [0 .. 2, -1.2 .. 1.2])

 

 

 

``


 

Download fokas_method_new.mw

@dharr Thank you for your answer and the time you spent looking at my question. I will try to find a faster way. 

1 2 3 4 5 6 7 Page 1 of 7