Sinusoid with zero boundary conditions on $[0,1] \times [0,1]$ grid

54 Views Asked by At

I want to make a sinusoidal plot (any shape is welcome) on a $[0,1] \times [0,1]$ grid, with boundary conditions equal to zero.

It should resemble a membrane fixed along its edge. I tried out some sinusoidal functions, also a paraboloid; but it struck me that I couldn't get the boundaries fixed. Does anyone know a function? That is, a continuous and smooth function; else, I could just fix the boundaries at zero, regardless of the rest? Cheers;

Here are some examples of basic attempts which do not fulfill the requirement of the boundary conditions.

enter image description here

enter image description here

2

There are 2 best solutions below

0
On

You can try $(1-\cos(2\pi x))(1-\cos(2\pi y))$

0
On

This function not works exactly, but you can change some parameters, I don't know but maybe you can find some nice function, i use python 3 for the plot :

$$f(x,y)=\frac{n\cos\left(\sqrt{x^2+y^2}\right)}{\sqrt{1+x^2+y^2}}$$

With $n$ an integer.


For the plot :

import math
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D

ax = Axes3D(plt.figure())

def f(x,y):
   return (n*np.cos(np.sqrt(x**2+y**2)))/(np.sqrt(1+x**2+y**2))

X = np.arange(-2,2,0.01)
Y = np.arange(-2,2,0.01)


X,Y=np.meshgrid(X,Y)
Z=f(X,Y)


ax.plot_surface(X,Y,Z)

plt.show()

Plot for $n=5$ enter image description here


Plot for $n=8$

If you use a larger window you can show something like a B-E condensat :

enter image description here

EDIT : I make the plot with @Dayo function $$f(x,y)=\left(1-\cos(2\pi x)\right)\left(1-\cos(2\pi y)\right)$$

enter image description here

Hope it will help you a bit, have a nice day !