human
Can you show me a Python code to gradient and hessian syntax in Python.
assistant
Here is a Python code to gradient and hessian syntax

import numpy as np

def gradient_hessian(f, x):
  """Returns the gradient and hessian of f at x."""
  return f(x), f(x)

# Enter the function
f = lambda x: x**2

# Enter the variable
x = np.array([1, 2, 3])

# Calling the function
print((gradient_hessian(f, x)))

#Example Output

# (array([1, 4, 9]), array([1, 4, 9]))

#Remember to inspect code for bugs.