Skip to content

Commit fca04e3

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent abcbec3 commit fca04e3

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

maths/laplace_transformation.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ def laplace_transform(
2424
2525
Example: For f(t) = 1, the Laplace transform L{1} = 1/s.
2626
If s = 2, L{1} should be 0.5.
27-
27+
2828
>>> t = np.linspace(0, 50, 10000)
2929
>>> f_t = np.ones_like(t) # f(t) = 1
3030
>>> res = laplace_transform(f_t, s_value=2.0, delta_t=50/10000)
3131
>>> abs(res - 0.5) < 1e-3
3232
True
33-
33+
3434
Example: For f(t) = e^(-t), the Laplace transform L{e^-t} = 1/(s+1).
3535
If s = 1, L{e^-t} should be 0.5.
3636
@@ -45,19 +45,17 @@ def laplace_transform(
4545

4646
# Time vector corresponding to the function values
4747
time_vector = np.arange(len(function_values)) * delta_t
48-
48+
4949
# The integrand: f(t) * e^(-s*t)
5050
integrand = function_values * np.exp(-s_value * time_vector)
51-
51+
5252
# Numerical integration using the trapezoidal rule
5353
result = np.trapezoid(integrand, dx=delta_t)
54-
54+
5555
return float(result)
5656

5757

5858
if __name__ == "__main__":
5959
import doctest
6060

61-
6261
doctest.testmod()
63-

0 commit comments

Comments
 (0)