# Maxima and Minima¶

The first two images are visualisations of $\sin(x)\cdot sin(y)$ and its gradient.

In [74]:
x, y = var('x y')
P = plot3d(sin(x)*sin(y),(x,-4,4),(y,-4,4))
P

Out[74]:
In [67]:
d = plot_vector_field((sin(y)*cos(x), sin(x)*cos(y)), (x,-4,4), (y,-4,4))
d

Out[67]:

# Differentiability¶

The next two graphics illustrate differentiability respectively non-differentiability of the functions $tan(|x|)$ and $|x|$ for $x\in \mathbb R^2$

In [10]:
x, y = var('x y')
o = plot3d(tan(sqrt(x*x+y*y)),(x,-1/2,1/2),(y,-1,1))
o

Out[10]:
In [11]:
x, y = var('x y')
a = plot3d((sqrt(x*x+y*y)),(x,-1/2,1/2),(y,-1,1))
a

Out[11]:

# No Converse to Schwarz theorem¶

The function $\frac{x^2y^2}{x^2+y^2}$ has commuting mixed partial derivatives but the mixed partial derivative (plotted below) is not continuous.

In [70]:
x, y = var('x y')
P = plot3d(8*x^3*y^3/(x^2+y^2)^3 ,(x,-4,4),(y,-4,4))
P

Out[70]:

# A travelling wave¶

A sample "sketch" of a solution of the 1-D wave equation. (The capped parabola should be preferrably substitued with something at least twice differentiable).

In [71]:
phii(y)=max(1-y^2,0)*heaviside(1-y)*heaviside(1+y)
wave = [plot((phii(x-t)), (-4,4),  ymin=-1, ymax=1) for t in sxrange(-3,3,.2)]
a = animate(wave)
a

Out[71]: