code: def simulate(
      circuit: qml.tape.QuantumScript,
      rng=None,
      prng_key=None,
      debugger=None,
      interface=None,
      state_cache: Optional[dict] = None,
  ) -> Result:
      """Simulate a single quantum script.
  
      This is an internal function that will be called by the successor to ``default.qubit``.
  
      Args:
          circuit (QuantumTape): The single circuit to simulate
          rng (Union[None, int, array_like[int], SeedSequence, BitGenerator, Generator]): A
              seed-like parameter matching that of ``seed`` for ``numpy.random.default_rng``.
              If no value is provided, a default RNG will be used.
          prng_key (Optional[jax.random.PRNGKey]): An optional ``jax.random.PRNGKey``. This is
              the key to the JAX pseudo random number generator. If None, a random key will be
              generated. Only for simulation using JAX.
          debugger (_Debugger): The debugger to use
          interface (str): The machine learning interface to create the initial state with
          state_cache=None (Optional[dict]): A dictionary mapping the hash of a circuit to the pre-rotated state. Used to pass the state between forward passes and vjp calculations.
  
      Returns:
          tuple(TensorLike): The results of the simulation
  
      Note that this function can return measurements for non-commuting observables simultaneously.
  
      This function assumes that all operations provide matrices.
  
      >>> qs = qml.tape.QuantumScript([qml.RX(1.2, wires=0)], [qml.expval(qml.PauliZ(0)), qml.probs(wires=(0,1))])
      >>> simulate(qs)
      (0.36235775447667357,
      tensor([0.68117888, 0.        , 0.31882112, 0.        ], requires_grad=True))
  
      """
      state, is_state_batched = get_final_state(
          circuit, debugger=debugger, interface=interface
      )
      if state_cache is not None:
          state_cache[circuit.hash] = state
      return measure_final_state(
          circuit, state, is_state_batched, rng=rng, prng_key=prng_key
      )
  
file_path: pennylane/pennylane/devices/qubit/simulate.py
imports: from typing import Optional
  from numpy.random import default_rng
  import numpy
  import pennylane
  from pennylane.typing import Result
  from .initialize_state import create_initial_state
  from .apply_operation import apply_operation
  from .measure import measure
  from .sampling import measure_with_samples
label_desc: Use image node_id 4 for calling a global function with example usage: simulate(circuit, rng, prng_key, debugger, interface, state_cache) and returns: measure_final_state