Sympy variables are created using unique string identifiers.

In :
import sympy as sp
import numpy as np
x = sp.Symbol("x")
y = sp.Symbol("y")
z = sp.Symbol("z")


One can form expression from symbols. Sympy expressions are made up of numbers, symbols, and sympy functions.

In :
expression = x**2. + y**2. + z ** 2.
expression

Out:
x**2.0 + y**2.0 + z**2.0

Two expressions may be added together to form a new one.

In :
other_expression = x**2.
expression += other_expression
expression

Out:
2*x**2.0 + y**2.0 + z**2.0

One can form sympy Matrix objects.

In :
sp.Matrix([[1,2],[3,4]])

Out:
Matrix([
[1, 2],
[3, 4]])

An important Matrix function is eye(n), which forms a $n \times n$ identity matrix.

In :
sp.eye(3)

Out:
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])

One can stuff expressions into matrices, too.

In :
# One can stuff expressions into matrices
f1 = x**2.+y**2-z**2.
f2 = 2*x + y + z
function_matrix = sp.Matrix([f1,f2])
function_matrix

Out:
Matrix([
[x**2.0 + y**2 - z**2.0],
[           2*x + y + z]])

One may compute the Jacobian of vector valued functions, too.

In :
function_matrix.jacobian([x,y,z]) # pass in a list of Sympy Symbols to take the Jacobian

Out:
Matrix([
[2.0*x**1.0, 2*y, -2.0*z**1.0],
[         2,   1,           1]])

Sympy expressions can be evaluated by passing in a Python dictionary mapping Symbol Symbols to specific values.

In :
x_val = 1.0
y_val = 2.0
z_val = 3.0
values={"x":x_val,"y":y_val,"z":z_val}
f1.subs(values)

Out:
-4.00000000000000

One can even valuate the Jacobian of functions.

In :
J_mat = function_matrix.jacobian([x,y,z]).subs(values)
J_mat

Out:
Matrix([
[2.0, 4.0, -6.0],
[  2,   1,    1]])

To convert a Sympy Matrix into a Numpy array, one may use the following:

In :
np.array(J_mat)

Out:
array([[2.00000000000000, 4.00000000000000, -6.00000000000000],
[2, 1, 1]], dtype=object)

After evaluating an expression in Sympy, the return type is a sympy.Float. However, this is not readily usable by Numpy. Therefore, consider casting sympy.Float to a numpy.float64.

In :
J=np.array(J_mat).astype(np.float64)
J

Out:
array([[ 2.,  4., -6.],
[ 2.,  1.,  1.]])

At this point, one cna do all the usual stuff one would in Numpy.

In :
J.T@J

Out:
array([[  8.,  10., -10.],
[ 10.,  17., -23.],
[-10., -23.,  37.]])

Symp's Lambdify can help increase the speed of Sympy's numerical computations.

In :
function_matrix.subs(values)

Out:
Matrix([
[-4.0],
[ 7.0]])
In :
from sympy.utilities.lambdify import lambdify
array2mat = [{'ImmutableDenseMatrix': np.array}, 'numpy']
lam_f_mat = lambdify((x,y,z), function_matrix, modules=array2mat)
lam_f_mat(1,2,3)

Out:
array([[-4.],
[ 7.]])

Or if it is more convenient to have the function evaluation occur from a list of some sort, the Python * operator on lists can help.

In :
lam_f_mat(*[1,2,3])

Out:
array([[-4.],
[ 7.]])