File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""
2- This module provides a numerical implementation of the Laplace Transform.
32
4- https://en.wikipedia.org/wiki/Laplace_transform
3+ Laplace Transform — Numerical Implementation.
4+
5+ Computes the numerical Laplace Transform using the trapezoidal
6+ integration rule. Supports real-valued, non-negative Laplace
7+ parameters only.
8+
9+ Reference: https://en.wikipedia.org/wiki/Laplace_transform
10+
511
612"""
713
@@ -47,9 +53,11 @@ def laplace_transform(
4753 raise ValueError ("delta_t must be a positive value." )
4854 if function_values .size == 0 :
4955 raise ValueError ("function_values array cannot be empty." )
56+ if s_value < 0 :
57+ raise ValueError (f"s_value must be non-negative for this implementation, got{ s_value } ." )
5058
5159 # Time vector corresponding to the function values
52- time_vector = np .arange ( len (function_values )) * delta_t
60+ time_vector = np .linspace ( 0 , ( len (function_values ) - 1 ) * delta_t , len ( function_values ))
5361
5462 # The integrand: f(t) * e^(-s*t)
5563 integrand = function_values * np .exp (- s_value * time_vector )
You can’t perform that action at this time.
0 commit comments