Constructing a Contour Plot for Solving a PDE with a Summation Formula

  • Context: MHB 
  • Thread starter Thread starter Dustinsfl
  • Start date Start date
  • Tags Tags
    Pde Plotting sol
Click For Summary

Discussion Overview

The discussion revolves around constructing a contour plot for a partial differential equation (PDE) defined by a summation formula. Participants are exploring methods to visualize the solution using contour plots and vector fields, with references to specific plotting techniques and software.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Experimental/applied

Main Points Raised

  • One participant provides a summation formula for \(u(x,y)\) and seeks guidance on constructing a contour plot of this function.
  • Another participant references a specific figure from a document as a model for the desired contour plot.
  • Multiple participants share MATLAB code intended to generate the contour plot, but one notes that the code causes MATLAB to freeze.
  • A participant attempts to use Maxima for plotting and shares their code and results for both 3D and contour plots.
  • There are inquiries about plotting the vector field of the function, with one participant noting that \(u\) is not a vector-valued function, which complicates this request.

Areas of Agreement / Disagreement

Participants express uncertainty regarding the effectiveness of their plotting methods, particularly with MATLAB. There is no consensus on how to successfully plot the vector field, as the nature of the function \(u\) is debated.

Contextual Notes

Some participants' code attempts may depend on specific software capabilities and settings, which are not resolved in the discussion. The limitations of the function \(u\) being non-vector-valued are acknowledged but not fully explored.

Dustinsfl
Messages
2,217
Reaction score
5
$$
u(x,y) = \frac{4}{\pi}\sum_{n = 1}^{\infty}\left[\frac{\sin(2n - 1)\pi x\sinh\left[(2n - 1)\pi (1 - y)\right]}{(2n - 1)\sinh(2n - 1)\pi} + \frac{\sin(2n - 1)\pi y\sinh\left[(2n - 1)\pi(1 - x)\right]}{(2n - 1)\sinh(2n - 1)\pi}\right].
$$

How do I construct a contour plot of this?
 
Physics news on Phys.org
Code:
>> [x,y]=meshgrid(-10:0.1:10, -10:0.1:10);
>> syms n;
>> z=symsum(4/pi*(sin((2*n-1)*pi*x)*sinh((2*n-1)*pi*(1-y))/((2*n-1)*sinh((2*n-1)*pi))+sin((2*n-1)*pi*y)*sinh((2*n-1)*pi*(1-x))/((2*n-1)*sinh((2*n-1)*pi))),0,20);
contour3(x,y,z)
I just tried this code but Matlab froze.

Any thoughts or suggestions?
 
dwsmith said:
Code:
>> [x,y]=meshgrid(-10:0.1:10, -10:0.1:10);
>> syms n;
>> z=symsum(4/pi*(sin((2*n-1)*pi*x)*sinh((2*n-1)*pi*(1-y))/((2*n-1)*sinh((2*n-1)*pi))+sin((2*n-1)*pi*y)*sinh((2*n-1)*pi*(1-x))/((2*n-1)*sinh((2*n-1)*pi))),0,20);
contour3(x,y,z)
I just tried this code but Matlab froze.

Any thoughts or suggestions?

I tried this using Maxima. The code I used and the plots are given below.

Code:
expr:sum(4/%pi*(sin((2*n-1)*%pi*x)*sinh((2*n-1)*%pi*(1-y))/((2*n-1)*sinh((2*n-1)*%pi))+sin((2*n-1)*%pi*y)*sinh((2*n-1)*%pi*(1-x))/((2*n-1)*sinh((2*n-1)*%pi))),n,0,20)$

plot3d(expr, [x,-10,10],[y,-10,10],[grid, 150, 150]);

contour_plot(expr,[x,-15,15],[y,-10,10],[grid, 300, 300]);
3D Plot

14ccift.png


Contour Plot

2v1no6a.png
 
Is there anyway to plot the vector field of this?
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 10 ·
Replies
10
Views
13K
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K