I have two quadric surfaces in 3-dimensional space. 

* circular hyperboloid of one sheet
	+ described by xt, yt, zt, rt
* circular paraboloid
	+ described by xs, ys, zs, rs

I would like to minimize the distance between the two objects. Function `distance()` takes 4 variables - alpha, beta, zt and zs. The goal is to find such values of these 4 variables that the function returns the minimal possible value.

Consider the code below.

```
import numpy as np
from scipy.optimize import minimize

A = 1; B = 1; C = 1; D = 1; Z = 0;

def distance(alpha,beta,zt,zs):
    """distance between points in 2 quadric surfaces in 3D space"""
    rt = (A/B) * np.sqrt(B**2 + (zt-C)**2)
    xt = rt * np.cos(alpha)
    yt = rt * np.sin(alpha)

    rs = D * np.sqrt(zs-Z)
    xs = rs * np.cos(beta)
    ys = rs * np.sin(beta)

    return (xt-xs)**2 + (yt-ys)**2 + (zt-zs)**2

x0 = np.array([0, 0, 0, 0])
res = minimize(distance,
               x0,
               method='nelder-mead')

```

The code gives me the following error.

> 
> TypeError: distance() missing 3 required positional arguments: 'beta',
>  'zt', and 'zs'
> 
> 
> 

All [documentation](https://docs.scipy.org/doc/scipy/reference/tutorial/optimize.html#nelder-mead-simplex-algorithm-method-nelder-mead) I have found uses only univariate (one variable) functions (like the Rosenbrock function) despite it saying it minimizes "multivariate scalar functions".

How do I make my code find the optimal values for the 4 parameters to minimize the value of a function?