Repository: PennyLaneAI/pennylane (python)

Issue:
[BUG] `qml.simplify` removes information regarding `num_steps` from `Exp`
### Expected behavior

``` py
>>> op1 = qml.exp(qml.Z(0) + 1.2*qml.Z(1), -1.2j, num_steps=2)
>>> qml.simplify(op1).num_steps
2
```

### Actual behavior

``` py
>>> op1 = qml.exp(qml.Z(0) + 1.2*qml.Z(1), -1.2j, num_steps=2)
>>> qml.simplify(op1).num_steps
None
```

### Additional information

![image](https://github.com/PennyLaneAI/pennylane/assets/23234279/fb98b52f-f33a-4210-b8dc-37c23aa1dd5c)


### Source code

_No response_

### Tracebacks

_No response_

### System information

```shell
Name: PennyLane
Version: 0.37.0.dev0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages
Editable project location: /Users/utkarsh/Xanadu/Codes/SourceCodes/pennylane
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: amazon-braket-pennylane-plugin, PennyLane-Catalyst, PennyLane-Cirq, PennyLane-qiskit, PennyLane_Lightning, PennyLane_Lightning_Kokkos, quantum-datasets

Platform info:           macOS-13.6.7-arm64-arm-64bit
Python version:          3.10.4
Numpy version:           1.22.4
Scipy version:           1.12.0
Installed devices:
- default.clifford (PennyLane-0.37.0.dev0)
- default.gaussian (PennyLane-0.37.0.dev0)
- default.mixed (PennyLane-0.37.0.dev0)
- default.qubit (PennyLane-0.37.0.dev0)
- default.qubit.autograd (PennyLane-0.37.0.dev0)
- default.qubit.jax (PennyLane-0.37.0.dev0)
- default.qubit.legacy (PennyLane-0.37.0.dev0)
- default.qubit.tf (PennyLane-0.37.0.dev0)
- default.qubit.torch (PennyLane-0.37.0.dev0)
- default.qutrit (PennyLane-0.37.0.dev0)
- default.qutrit.mixed (PennyLane-0.37.0.dev0)
- default.tensor (PennyLane-0.37.0.dev0)
- null.qubit (PennyLane-0.37.0.dev0)
- lightning.kokkos (PennyLane_Lightning_Kokkos-0.36.0)
- lightning.qubit (PennyLane_Lightning-0.36.0)
```


### Existing GitHub issues

- [X] I have searched existing GitHub issues to make sure the issue does not already exist.

Pull request description:
include the the num_steps in Exp.simplify
**Context:**

The simplified operator of an exponential was not returning the correct number of steps.

**Description of the Change:**

`Exp.simplify()`now returns an operator with the correct number of Trotter steps, i.e. equal to the one from the pre-simplified operator.


**Benefits:**
Correct number of Trotter steps is now included after simplification

**Related GitHub Issues:**
Fixes #5747
[sc-64181]

Patch:
diff --git a/doc/releases/changelog-dev.md b/doc/releases/changelog-dev.md
index 12959fa66..8c23238f7 100644
--- a/doc/releases/changelog-dev.md
+++ b/doc/releases/changelog-dev.md
@@ -369,6 +369,9 @@
 * Fixed a bug where `split_non_commuting` raises an error when the circuit contains measurements of observables that are not pauli words.
   [(#5827)](https://github.com/PennyLaneAI/pennylane/pull/5827)
 
+* Simplify method for `Exp` now returns an operator with the correct number of Trotter steps, i.e. equal to the one from the pre-simplified operator.
+  [(#5831)](https://github.com/PennyLaneAI/pennylane/pull/5831)
+
 <h3>Contributors ✍️</h3>
 
 This release contains contributions from (in alphabetical order):
diff --git a/pennylane/ops/op_math/exp.py b/pennylane/ops/op_math/exp.py
index 2e01dfc8e..5662199c2 100644
--- a/pennylane/ops/op_math/exp.py
+++ b/pennylane/ops/op_math/exp.py
@@ -464,8 +464,8 @@ class Exp(ScalarSymbolicOp, Operation):
     def simplify(self):
         new_base = self.base.simplify()
         if isinstance(new_base, qml.ops.op_math.SProd):  # pylint: disable=no-member
-            return Exp(new_base.base, self.coeff * new_base.scalar)
-        return Exp(new_base, self.coeff)
+            return Exp(new_base.base, self.coeff * new_base.scalar, self.num_steps)
+        return Exp(new_base, self.coeff, self.num_steps)
 
     # pylint: disable=arguments-renamed, invalid-overridden-method
     @property


Test patch:
diff --git a/tests/ops/op_math/test_exp.py b/tests/ops/op_math/test_exp.py
index 97a17235c..90d0e44ca 100644
--- a/tests/ops/op_math/test_exp.py
+++ b/tests/ops/op_math/test_exp.py
@@ -736,6 +736,13 @@ class TestMiscMethods:
         assert qml.equal(new_op.base, qml.PauliX(0))
         assert new_op.coeff == 0.2
 
+    def test_simplify_num_steps(self):
+        """Test that the number of Trotter steps is conserved after simplification"""
+        base = qml.Z(0) + 1.2 * qml.Z(1)
+        op = Exp(base, coeff=-1.2j, num_steps=2)
+        new_op = op.simplify()
+        assert new_op.num_steps == op.num_steps
+
     def test_simplify_s_prod(self):
         """Tests that when simplification of the base results in an SProd,
         the scalar is included in the coeff rather than the base"""