Skip to content

Commit e8cfb25

Browse files
authored
Update dual_number_automatic_differentiation.py
1 parent 90feebd commit e8cfb25

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

maths/dual_number_automatic_differentiation.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ def __init__(self, real, rank):
1717
self.duals = rank
1818

1919
def __repr__(self):
20-
return (
21-
f"{self.real}+"
22-
f"{'+'.join('{}E{}'.format(dual, n) for n, dual in enumerate(self.duals, 1))}"
23-
)
20+
s = "+".join(f"{dual}E{n}" for n, dual in enumerate(self.duals, 1))
21+
return f"{self.real}+{s}"
2422

2523
def reduce(self):
2624
cur = self.duals.copy()

0 commit comments

Comments
 (0)