Plotting an infinite domain PDE

In summary, the author is looking for a way to plot an infinite domain PDE where the solution is an integral. They tried different software but all failed. They also tried to do the integration on their own but it failed. They suggest that someone else try to do the integration and post their code.
  • #1
Dustinsfl
2,281
5
Is anyone familiar with plotting an infinite domain PDE where the solution is an integral.

Take the solution
\[
T(x,t) = \frac{100}{\pi}\int_0^{\infty}\int_{-\infty}^{\infty} \frac{\sinh(u(10-y)}{\sinh(10u)} \cos(u(\xi-x))d\xi du
\]
How could I plot this in Matlab, Mathematica, or Python?

As a note, Mathematica is slow because I have code that does it, but when I increase u, the time to complete goes up exponentially. I am talking hours.

Everything I tried in Matlab failed.
 
Physics news on Phys.org
  • #2
I'm curious: can you post your Mathematica code?
 
  • #3
Ackbach said:
I'm curious: can you post your Mathematica code?

Code:
f[x_, y_, u_, \[Xi]_] =  Sinh[u*(5 - y)]/Sinh[u*5]*100/\[Pi]*Cos[u*(\[Xi] - x)];
 
g[x_?NumericQ, y_?NumericQ] := NIntegrate[f[x, y, u, \[Xi]], {u, 1, 10}, {\[Xi], -5, 5}];

DensityPlot[g[x, y], {x, -5, 5}, {y, 0, 5}, PlotPoints -> 5]

This code only integrate u from 1 to 10 and \(\xi\) from -5 to 5. However, I would like to increase the integration to have a more accurate plot.

Here is Python code that takes a long time but can handle a bigger integration bounds in the same time Mathematica can but the code isn't producing an accurately plot either so there must be something wrong as well.

Code:
import numpy as np
import pylab as pl 
from scipy.integrate import dblquad  

b = 50.0  
x = np.linspace(-10, 10, 1000) 
y = np.linspace(0, 10, 1000)  def f(xx, u, xi, yj):     
    return ((np.exp(u * (b - yj)) - np.exp(-u * (b - yj))) / 
              (np.exp(u * b) - np.exp(-u * b)) * np.cos(u * (xx - xi)))  T = np.zeros([len(x), len(y)])

 
for i, xi in enumerate(x):     
    for j, yj in enumerate(y):         
        T[i, j] += dblquad(             
                   f, -10, 10, lambda x: 0.1, lambda x: 10, args=(xi, yj))[0]fig = pl.figure()
ax = fig.add_subplot(111)
pax = ax.pcolormesh(y, x, T)
fig.colorbar(pax)
pl.xlim((-X, X))
pl.ylim((0, b))
pl.grid(True)

pl.show()
 
  • #4
You might save some computational time if you pull everything out of the inner integral that you can:
$$T(x,t)= \frac{100}{ \pi} \int_{0}^{ \infty} \frac{ \sinh(u(10-y))}{ \sinh(10u)}
\underbrace{ \int_{- \infty}^{ \infty} \cos(u( \xi-x)) \, d \xi}_{ \text{define this as }f(u,x)} \, du.$$
This way, the ratio on sinh's isn't evaluated for every inner loop. I should point out, however, that the inner integral, which is $f(u,x)$, doesn't converge. The Riemann-Lebesgue Lemma might come in handy here, depending on where you want to look at things.
 
  • #5


I am familiar with plotting infinite domain PDEs where the solution is an integral. In this case, the solution provided is a function of two variables, x and t, and involves an integral over an infinite domain. This type of solution is common in many physical systems, such as heat transfer and diffusion processes.

To plot this solution in a computer program like Matlab, Mathematica, or Python, you will need to first define the function T(x,t) with the given integral expression. Then, you can use the built-in plotting functions in these programs to plot the function over a desired range of x and t values.

However, it is worth noting that as u increases, the time to complete the computation will also increase exponentially. This is because the integral becomes more complex and requires more computational resources to solve. Therefore, it is expected that the computation time will be longer for larger values of u.

In order to improve the computational efficiency, you can try using numerical methods such as finite difference or finite element methods to approximate the solution. This will allow you to plot the solution for larger values of u without significantly increasing the computation time.

In conclusion, plotting an infinite domain PDE with an integral solution is possible in Matlab, Mathematica, or Python, but the computation time may increase significantly for larger values of u. Using numerical methods can help improve the efficiency of the computation.
 

FAQ: Plotting an infinite domain PDE

What is an infinite domain PDE?

An infinite domain PDE (partial differential equation) is a type of mathematical equation that describes the behavior of a function in a continuous space, without any boundaries or limits. It is used to model physical phenomena that occur in an infinitely large region, such as heat flow or fluid dynamics.

How do you plot an infinite domain PDE?

Plotting an infinite domain PDE involves using numerical methods and computer software to approximate the solution of the equation at different points in the infinite domain. This is usually done by dividing the domain into smaller regions and solving the equation at each point using finite difference or finite element methods. The results can then be plotted to visualize the behavior of the function in the infinite domain.

What are some challenges in plotting an infinite domain PDE?

One of the main challenges in plotting an infinite domain PDE is choosing an appropriate numerical method that can accurately approximate the solution in an infinite region. Another challenge is dealing with the computational cost and time required to solve the equation at a large number of points in the domain. Additionally, the accuracy of the plotted results can be affected by the choice of boundary conditions and the presence of singularities in the solution.

How can I verify the accuracy of the plotted results for an infinite domain PDE?

To verify the accuracy of the plotted results, it is important to compare them with known analytical solutions, if available. This can help identify any errors or discrepancies in the numerical solution. Another way to verify the accuracy is by using a grid convergence study, where the solution is calculated on increasingly finer grids to see if the results converge to a known solution.

Can infinite domain PDEs be solved analytically?

In general, infinite domain PDEs cannot be solved analytically, as they involve solving an equation in an infinitely large region. However, in some cases, simplified versions of the equation or specific boundary conditions may allow for analytical solutions. In most cases, numerical methods are used to approximate the solution of an infinite domain PDE.

Similar threads

Replies
1
Views
1K
Replies
4
Views
2K
Replies
1
Views
4K
Replies
2
Views
4K
Replies
3
Views
1K
Replies
1
Views
5K
Back
Top