nerdamer 1.1.13 → 2.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/LICENSE.md +184 -0
  2. package/README.md +293 -312
  3. package/dist/bundle.js +2 -0
  4. package/dist/bundle.js.LICENSE.txt +7 -0
  5. package/dist/parser.js +2 -0
  6. package/dist/parser.js.LICENSE.txt +7 -0
  7. package/docs-data/parser-functions.json +1960 -0
  8. package/index.d.ts +10 -426
  9. package/output/algebra/adapters.d.ts +33 -0
  10. package/output/algebra/adapters.js +109 -0
  11. package/output/algebra/algorithms/arith.d.ts +84 -0
  12. package/output/algebra/algorithms/arith.js +323 -0
  13. package/output/algebra/algorithms/factor.d.ts +3 -0
  14. package/output/algebra/algorithms/factor.js +5 -0
  15. package/output/algebra/algorithms/factorMultivariate.d.ts +23 -0
  16. package/output/algebra/algorithms/factorMultivariate.js +2393 -0
  17. package/output/algebra/algorithms/factorUnivariate.d.ts +72 -0
  18. package/output/algebra/algorithms/factorUnivariate.js +1072 -0
  19. package/output/algebra/algorithms/gcd.d.ts +22 -0
  20. package/output/algebra/algorithms/gcd.js +690 -0
  21. package/output/algebra/algorithms/groebnerBase.d.ts +157 -0
  22. package/output/algebra/algorithms/groebnerBase.js +1166 -0
  23. package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +137 -0
  24. package/output/algebra/algorithms/multiPoly/MultiPoly.js +346 -0
  25. package/output/algebra/algorithms/poly.d.ts +228 -0
  26. package/output/algebra/algorithms/poly.js +1299 -0
  27. package/output/algebra/algorithms/rational.d.ts +17 -0
  28. package/output/algebra/algorithms/rational.js +115 -0
  29. package/output/algebra/factor/factor.d.ts +62 -0
  30. package/output/algebra/factor/factor.js +158 -0
  31. package/output/algebra/gcd/gcd.d.ts +29 -0
  32. package/output/algebra/gcd/gcd.js +141 -0
  33. package/output/algebra/groebner.d.ts +21 -0
  34. package/output/algebra/groebner.js +42 -0
  35. package/output/algebra/partfrac.d.ts +19 -0
  36. package/output/algebra/partfrac.js +398 -0
  37. package/output/algebra/polynomialize.d.ts +20 -0
  38. package/output/algebra/polynomialize.js +24 -0
  39. package/output/algebra/simplify/complexsimp.d.ts +7 -0
  40. package/output/algebra/simplify/complexsimp.js +24 -0
  41. package/output/algebra/simplify/factorCommon.d.ts +13 -0
  42. package/output/algebra/simplify/factorCommon.js +136 -0
  43. package/output/algebra/simplify/funcsimp.d.ts +26 -0
  44. package/output/algebra/simplify/funcsimp.js +633 -0
  45. package/output/algebra/simplify/invtrigrewrite.d.ts +10 -0
  46. package/output/algebra/simplify/invtrigrewrite.js +96 -0
  47. package/output/algebra/simplify/ratsimp.d.ts +21 -0
  48. package/output/algebra/simplify/ratsimp.js +140 -0
  49. package/output/algebra/simplify/simplify.d.ts +25 -0
  50. package/output/algebra/simplify/simplify.js +228 -0
  51. package/output/algebra/simplify/trigreduce.d.ts +38 -0
  52. package/output/algebra/simplify/trigreduce.js +424 -0
  53. package/output/algebra/simplify/trigrewrite.d.ts +17 -0
  54. package/output/algebra/simplify/trigrewrite.js +156 -0
  55. package/output/algebra/simplify/trigsimp.d.ts +11 -0
  56. package/output/algebra/simplify/trigsimp.js +369 -0
  57. package/output/algebra/simplify/utils.d.ts +32 -0
  58. package/output/algebra/simplify/utils.js +56 -0
  59. package/output/algebra/utils.d.ts +32 -0
  60. package/output/algebra/utils.js +48 -0
  61. package/output/api/advanced.d.ts +7 -0
  62. package/output/api/advanced.js +18 -0
  63. package/output/api/algebra.d.ts +17 -0
  64. package/output/api/algebra.js +32 -0
  65. package/output/api/assumptions.d.ts +4 -0
  66. package/output/api/assumptions.js +11 -0
  67. package/output/api/calculus.d.ts +9 -0
  68. package/output/api/calculus.js +21 -0
  69. package/output/api/core.d.ts +17 -0
  70. package/output/api/core.js +41 -0
  71. package/output/api/debug.d.ts +16 -0
  72. package/output/api/debug.js +23 -0
  73. package/output/api/parser.d.ts +85 -0
  74. package/output/api/parser.js +16 -0
  75. package/output/api/solve.d.ts +10 -0
  76. package/output/api/solve.js +16 -0
  77. package/output/api/structures.d.ts +10 -0
  78. package/output/api/structures.js +22 -0
  79. package/output/calculus/derivative/diff.d.ts +30 -0
  80. package/output/calculus/derivative/diff.js +238 -0
  81. package/output/calculus/fresnel.d.ts +16 -0
  82. package/output/calculus/fresnel.js +39 -0
  83. package/output/calculus/integrate/byParts.d.ts +18 -0
  84. package/output/calculus/integrate/byParts.js +339 -0
  85. package/output/calculus/integrate/bySubstitution.d.ts +135 -0
  86. package/output/calculus/integrate/bySubstitution.js +411 -0
  87. package/output/calculus/integrate/integrate.d.ts +38 -0
  88. package/output/calculus/integrate/integrate.js +652 -0
  89. package/output/calculus/integrate/integrationTable.d.ts +2 -0
  90. package/output/calculus/integrate/integrationTable.js +914 -0
  91. package/output/calculus/integrate/utils.d.ts +28 -0
  92. package/output/calculus/integrate/utils.js +96 -0
  93. package/output/calculus/laplace/ilaplace.d.ts +31 -0
  94. package/output/calculus/laplace/ilaplace.js +192 -0
  95. package/output/calculus/laplace/ilaplaceTable.d.ts +2 -0
  96. package/output/calculus/laplace/ilaplaceTable.js +200 -0
  97. package/output/calculus/laplace/laplace.d.ts +22 -0
  98. package/output/calculus/laplace/laplace.js +109 -0
  99. package/output/calculus/laplace/laplaceTable.d.ts +2 -0
  100. package/output/calculus/laplace/laplaceTable.js +187 -0
  101. package/output/calculus/limit/limit.d.ts +35 -0
  102. package/output/calculus/limit/limit.js +1183 -0
  103. package/output/calculus/limit/limitsTable.d.ts +2 -0
  104. package/output/calculus/limit/limitsTable.js +7 -0
  105. package/output/core/Settings.d.ts +32 -0
  106. package/output/core/Settings.js +68 -0
  107. package/output/core/adapters.d.ts +18 -0
  108. package/output/core/adapters.js +40 -0
  109. package/output/core/classes/assumption/Assumption.d.ts +218 -0
  110. package/output/core/classes/assumption/Assumption.js +605 -0
  111. package/output/core/classes/assumption/assertiveFunctions.d.ts +6 -0
  112. package/output/core/classes/assumption/assertiveFunctions.js +64 -0
  113. package/output/core/classes/assumption/assume.d.ts +90 -0
  114. package/output/core/classes/assumption/assume.js +145 -0
  115. package/output/core/classes/collection/Collection.d.ts +107 -0
  116. package/output/core/classes/collection/Collection.js +231 -0
  117. package/output/core/classes/complex/Complex.d.ts +99 -0
  118. package/output/core/classes/complex/Complex.js +135 -0
  119. package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
  120. package/output/core/classes/decimalSet/DecimalSet.js +453 -0
  121. package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
  122. package/output/core/classes/dictionary/Dictionary.js +213 -0
  123. package/output/core/classes/equation/Equation.d.ts +256 -0
  124. package/output/core/classes/equation/Equation.js +350 -0
  125. package/output/core/classes/expression/CoeffObject.d.ts +100 -0
  126. package/output/core/classes/expression/CoeffObject.js +198 -0
  127. package/output/core/classes/expression/Expression.d.ts +1674 -0
  128. package/output/core/classes/expression/Expression.js +2332 -0
  129. package/output/core/classes/expression/analysis.d.ts +25 -0
  130. package/output/core/classes/expression/analysis.js +218 -0
  131. package/output/core/classes/expression/collect.d.ts +9 -0
  132. package/output/core/classes/expression/collect.js +49 -0
  133. package/output/core/classes/expression/format.d.ts +45 -0
  134. package/output/core/classes/expression/format.js +217 -0
  135. package/output/core/classes/expression/products.d.ts +23 -0
  136. package/output/core/classes/expression/products.js +115 -0
  137. package/output/core/classes/expression/shortcuts.d.ts +35 -0
  138. package/output/core/classes/expression/shortcuts.js +129 -0
  139. package/output/core/classes/expression/traversal.d.ts +31 -0
  140. package/output/core/classes/expression/traversal.js +216 -0
  141. package/output/core/classes/expression/trig.d.ts +25 -0
  142. package/output/core/classes/expression/trig.js +40 -0
  143. package/output/core/classes/expression/utils.d.ts +52 -0
  144. package/output/core/classes/expression/utils.js +189 -0
  145. package/output/core/classes/lookupTable/LookupTable.d.ts +12 -0
  146. package/output/core/classes/lookupTable/LookupTable.js +55 -0
  147. package/output/core/classes/matrix/Matrix.d.ts +227 -0
  148. package/output/core/classes/matrix/Matrix.js +889 -0
  149. package/output/core/classes/matrix/Sylvester.d.ts +11 -0
  150. package/output/core/classes/matrix/Sylvester.js +54 -0
  151. package/output/core/classes/matrix/functions.d.ts +26 -0
  152. package/output/core/classes/matrix/functions.js +52 -0
  153. package/output/core/classes/matrix/utils.d.ts +9 -0
  154. package/output/core/classes/matrix/utils.js +22 -0
  155. package/output/core/classes/parser/Parser.d.ts +480 -0
  156. package/output/core/classes/parser/Parser.js +1812 -0
  157. package/output/core/classes/parser/Token.d.ts +58 -0
  158. package/output/core/classes/parser/Token.js +137 -0
  159. package/output/core/classes/parser/constants.d.ts +160 -0
  160. package/output/core/classes/parser/constants.js +227 -0
  161. package/output/core/classes/parser/helpers.d.ts +21 -0
  162. package/output/core/classes/parser/helpers.js +42 -0
  163. package/output/core/classes/parser/operations/add.d.ts +15 -0
  164. package/output/core/classes/parser/operations/add.js +238 -0
  165. package/output/core/classes/parser/operations/comma.d.ts +7 -0
  166. package/output/core/classes/parser/operations/comma.js +11 -0
  167. package/output/core/classes/parser/operations/compare.d.ts +21 -0
  168. package/output/core/classes/parser/operations/compare.js +461 -0
  169. package/output/core/classes/parser/operations/divide.d.ts +2 -0
  170. package/output/core/classes/parser/operations/divide.js +72 -0
  171. package/output/core/classes/parser/operations/functions.d.ts +46 -0
  172. package/output/core/classes/parser/operations/functions.js +430 -0
  173. package/output/core/classes/parser/operations/multiply.d.ts +11 -0
  174. package/output/core/classes/parser/operations/multiply.js +321 -0
  175. package/output/core/classes/parser/operations/power.d.ts +48 -0
  176. package/output/core/classes/parser/operations/power.js +673 -0
  177. package/output/core/classes/parser/operations/subtract.d.ts +3 -0
  178. package/output/core/classes/parser/operations/subtract.js +35 -0
  179. package/output/core/classes/parser/preprocess.d.ts +14 -0
  180. package/output/core/classes/parser/preprocess.js +259 -0
  181. package/output/core/classes/parser/scripting/controlFlow.d.ts +121 -0
  182. package/output/core/classes/parser/scripting/controlFlow.js +355 -0
  183. package/output/core/classes/parser/scripting/evaluate.d.ts +10 -0
  184. package/output/core/classes/parser/scripting/evaluate.js +112 -0
  185. package/output/core/classes/parser/scripting/functions.d.ts +14 -0
  186. package/output/core/classes/parser/scripting/functions.js +59 -0
  187. package/output/core/classes/parser/scripting/scope.d.ts +35 -0
  188. package/output/core/classes/parser/scripting/scope.js +155 -0
  189. package/output/core/classes/parser/types.d.ts +125 -0
  190. package/output/core/classes/parser/types.js +2 -0
  191. package/output/core/classes/parser/wrappers/IndexedReference.d.ts +31 -0
  192. package/output/core/classes/parser/wrappers/IndexedReference.js +68 -0
  193. package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +24 -0
  194. package/output/core/classes/parser/wrappers/KeyValuePair.js +51 -0
  195. package/output/core/classes/polynomial/Polynomial.d.ts +500 -0
  196. package/output/core/classes/polynomial/Polynomial.js +1149 -0
  197. package/output/core/classes/polynomial/Term.d.ts +222 -0
  198. package/output/core/classes/polynomial/Term.js +430 -0
  199. package/output/core/classes/polynomial/functions.d.ts +69 -0
  200. package/output/core/classes/polynomial/functions.js +126 -0
  201. package/output/core/classes/polynomial/utils.d.ts +62 -0
  202. package/output/core/classes/polynomial/utils.js +206 -0
  203. package/output/core/classes/rational/Rational.d.ts +504 -0
  204. package/output/core/classes/rational/Rational.js +779 -0
  205. package/output/core/classes/seq/SEQ.d.ts +13 -0
  206. package/output/core/classes/seq/SEQ.js +137 -0
  207. package/output/core/classes/valuesSet/ValuesSet.d.ts +179 -0
  208. package/output/core/classes/valuesSet/ValuesSet.js +381 -0
  209. package/output/core/classes/vector/Vector.d.ts +222 -0
  210. package/output/core/classes/vector/Vector.js +497 -0
  211. package/output/core/classes/vector/functions.d.ts +28 -0
  212. package/output/core/classes/vector/functions.js +47 -0
  213. package/output/core/common/classes/MathematicalAggregate.d.ts +53 -0
  214. package/output/core/common/classes/MathematicalAggregate.js +140 -0
  215. package/output/core/common/classes/Scope.d.ts +62 -0
  216. package/output/core/common/classes/Scope.js +122 -0
  217. package/output/core/common/classes/StructuredEntity.d.ts +55 -0
  218. package/output/core/common/classes/StructuredEntity.js +151 -0
  219. package/output/core/common/common.d.ts +63 -0
  220. package/output/core/common/common.js +279 -0
  221. package/output/core/common/functions/functions.d.ts +14 -0
  222. package/output/core/common/functions/functions.js +33 -0
  223. package/output/core/common/functions/structuredEntityUtils.d.ts +27 -0
  224. package/output/core/common/functions/structuredEntityUtils.js +40 -0
  225. package/output/core/converters/BaseConverter.d.ts +97 -0
  226. package/output/core/converters/BaseConverter.js +405 -0
  227. package/output/core/converters/Converter.d.ts +111 -0
  228. package/output/core/converters/Converter.js +802 -0
  229. package/output/core/converters/Pattern.d.ts +71 -0
  230. package/output/core/converters/Pattern.js +302 -0
  231. package/output/core/dispatch.d.ts +34 -0
  232. package/output/core/dispatch.js +304 -0
  233. package/output/core/errors.d.ts +531 -0
  234. package/output/core/errors.js +621 -0
  235. package/output/core/functions/bigint/bigint.d.ts +121 -0
  236. package/output/core/functions/bigint/bigint.js +392 -0
  237. package/output/core/functions/bigint/primeFactor.d.ts +49 -0
  238. package/output/core/functions/bigint/primeFactor.js +267 -0
  239. package/output/core/functions/bigint/primes.d.ts +1 -0
  240. package/output/core/functions/bigint/primes.js +11 -0
  241. package/output/core/functions/build/definitions.d.ts +12 -0
  242. package/output/core/functions/build/definitions.js +133 -0
  243. package/output/core/functions/build/index.d.ts +32 -0
  244. package/output/core/functions/build/index.js +136 -0
  245. package/output/core/functions/complex.d.ts +90 -0
  246. package/output/core/functions/complex.js +482 -0
  247. package/output/core/functions/decimal.d.ts +24 -0
  248. package/output/core/functions/decimal.js +664 -0
  249. package/output/core/functions/expand/expand.d.ts +42 -0
  250. package/output/core/functions/expand/expand.js +376 -0
  251. package/output/core/functions/fresnelNumeric.d.ts +12 -0
  252. package/output/core/functions/fresnelNumeric.js +123 -0
  253. package/output/core/functions/numeric.d.ts +140 -0
  254. package/output/core/functions/numeric.js +790 -0
  255. package/output/core/functions/rationalNormalization.d.ts +11 -0
  256. package/output/core/functions/rationalNormalization.js +117 -0
  257. package/output/core/functions/setFunction.d.ts +19 -0
  258. package/output/core/functions/setFunction.js +75 -0
  259. package/output/core/functions/string.d.ts +26 -0
  260. package/output/core/functions/string.js +101 -0
  261. package/output/core/functions/subst.d.ts +90 -0
  262. package/output/core/functions/subst.js +498 -0
  263. package/output/core/functions/utils.d.ts +24 -0
  264. package/output/core/functions/utils.js +51 -0
  265. package/output/core/types.d.ts +48 -0
  266. package/output/core/types.js +2 -0
  267. package/output/index.d.ts +339 -0
  268. package/output/index.js +715 -0
  269. package/output/math/defint/defintDecimal.d.ts +37 -0
  270. package/output/math/defint/defintDecimal.js +320 -0
  271. package/output/math/defint/defintNative.d.ts +57 -0
  272. package/output/math/defint/defintNative.js +292 -0
  273. package/output/math/geometry.d.ts +8 -0
  274. package/output/math/geometry.js +32 -0
  275. package/output/math/math.d.ts +655 -0
  276. package/output/math/math.js +1811 -0
  277. package/output/math/trig.d.ts +518 -0
  278. package/output/math/trig.js +1444 -0
  279. package/output/math/trunc.d.ts +19 -0
  280. package/output/math/trunc.js +36 -0
  281. package/output/math/utils.d.ts +60 -0
  282. package/output/math/utils.js +180 -0
  283. package/output/solve/classes/DecimalMatrix.d.ts +17 -0
  284. package/output/solve/classes/DecimalMatrix.js +86 -0
  285. package/output/solve/classes/FunctionSolver.d.ts +135 -0
  286. package/output/solve/classes/FunctionSolver.js +433 -0
  287. package/output/solve/classes/MultivariateSolver.d.ts +84 -0
  288. package/output/solve/classes/MultivariateSolver.js +240 -0
  289. package/output/solve/classes/PolynomialSolver.d.ts +85 -0
  290. package/output/solve/classes/PolynomialSolver.js +292 -0
  291. package/output/solve/classes/SolutionSet.d.ts +153 -0
  292. package/output/solve/classes/SolutionSet.js +357 -0
  293. package/output/solve/classes/Solver.d.ts +17 -0
  294. package/output/solve/classes/Solver.js +132 -0
  295. package/output/solve/classes/SymbolicSolver.d.ts +74 -0
  296. package/output/solve/classes/SymbolicSolver.js +601 -0
  297. package/output/solve/linsolve.d.ts +51 -0
  298. package/output/solve/linsolve.js +225 -0
  299. package/output/solve/solve.d.ts +34 -0
  300. package/output/solve/solve.js +260 -0
  301. package/output/solve/solveSystem.d.ts +31 -0
  302. package/output/solve/solveSystem.js +290 -0
  303. package/output/solve/utils.d.ts +9 -0
  304. package/output/solve/utils.js +62 -0
  305. package/output/utils/array.d.ts +42 -0
  306. package/output/utils/array.js +98 -0
  307. package/output/utils/debug.d.ts +131 -0
  308. package/output/utils/debug.js +295 -0
  309. package/output/utils/decimal.d.ts +3 -0
  310. package/output/utils/decimal.js +16 -0
  311. package/output/utils/numeric.d.ts +14 -0
  312. package/output/utils/numeric.js +51 -0
  313. package/output/utils/object.d.ts +26 -0
  314. package/output/utils/object.js +56 -0
  315. package/package.json +213 -57
  316. package/.travis.yml +0 -3
  317. package/Algebra.js +0 -4568
  318. package/BREAKING_CHANGES.md +0 -5
  319. package/CODE_OF_CONDUCT.md +0 -46
  320. package/CONTRIBUTING.md +0 -14
  321. package/Calculus.js +0 -2675
  322. package/Extra.js +0 -622
  323. package/Solve.js +0 -1783
  324. package/all.js +0 -16
  325. package/all.min.js +0 -1
  326. package/gulpfile.js +0 -16
  327. package/index.html +0 -158
  328. package/license.txt +0 -19
  329. package/nerdamer.core.js +0 -12510
  330. package/spec/LaTeX.spec.js +0 -302
  331. package/spec/TeXConvert.spec.js +0 -8
  332. package/spec/algebra.spec.js +0 -287
  333. package/spec/basic_parser.spec.js +0 -134
  334. package/spec/build.spec.js +0 -131
  335. package/spec/calculus.spec.js +0 -183
  336. package/spec/core.spec.js +0 -2970
  337. package/spec/extra.spec.js +0 -54
  338. package/spec/solve.spec.js +0 -126
  339. package/spec/support/jasmine.json +0 -11
  340. package/spec/support/utils.js +0 -42
  341. package/spec/text.spec.js +0 -132
@@ -0,0 +1,28 @@
1
+ import { Expression } from '../../core/classes/expression/Expression';
2
+ import type { ExpressionInput } from '../../core/types';
3
+ /** Description of the substitution `x = t^n` used to clear fractional powers. */
4
+ export interface RadicalSubstitutionResult {
5
+ /** Integrand after substitution and multiplication by `dx/dt`. */
6
+ integrand: Expression;
7
+ /** Fresh variable used in the transformed integrand. */
8
+ newVariable: string;
9
+ /** Variable replaced in the original integrand. */
10
+ originalVariable: string;
11
+ /** Least common multiple of the fractional-power denominators. */
12
+ n: number;
13
+ /** Expression in the original variable used to replace the fresh variable. */
14
+ backSub: Expression;
15
+ }
16
+ /**
17
+ * Builds the substitution `x = t^n` needed to eliminate fractional powers.
18
+ *
19
+ * @param expr - Integrand to inspect and transform.
20
+ * @param variable - Variable whose fractional powers should be cleared. The
21
+ * first expression variable is used when omitted.
22
+ * @param newVar - Fresh substitution variable. Defaults to `t`.
23
+ * @returns Substitution metadata, or `null` if the expression is constant or
24
+ * contains no fractional powers of the selected variable.
25
+ */
26
+ export declare function radicalSubstitution(expr: ExpressionInput, variable?: string, newVar?: string): RadicalSubstitutionResult | null;
27
+ /** Returns whether `expr` contains a variable-dependent function or exponential. */
28
+ export declare function hasTranscendental(expr: Expression, v: string): boolean;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.radicalSubstitution = radicalSubstitution;
4
+ exports.hasTranscendental = hasTranscendental;
5
+ const Expression_1 = require("../../core/classes/expression/Expression");
6
+ const bigint_1 = require("../../core/functions/bigint/bigint");
7
+ const subst_1 = require("../../core/functions/subst");
8
+ /**
9
+ * Collects all fractional power denominators of a given variable in an expression.
10
+ * Walks into sums, products, and function arguments.
11
+ */
12
+ function collectPowerDenominators(expr, variable) {
13
+ const denoms = [];
14
+ function walk(e) {
15
+ if (e.isVAR() && e.value === variable) {
16
+ const p = e.getPower();
17
+ if (p.isNUM()) {
18
+ const r = p.getMultiplier();
19
+ const d = r.denominator < 0n ? -r.denominator : r.denominator;
20
+ if (d !== 1n) {
21
+ denoms.push(d);
22
+ }
23
+ }
24
+ return;
25
+ }
26
+ if (e.isSum() || e.isProduct()) {
27
+ for (const el of e.elementsArray()) {
28
+ walk(el);
29
+ }
30
+ return;
31
+ }
32
+ if (e.isFunction()) {
33
+ for (const arg of e.getArguments()) {
34
+ walk(arg);
35
+ }
36
+ }
37
+ }
38
+ walk(expr);
39
+ return denoms;
40
+ }
41
+ /**
42
+ * Builds the substitution `x = t^n` needed to eliminate fractional powers.
43
+ *
44
+ * @param expr - Integrand to inspect and transform.
45
+ * @param variable - Variable whose fractional powers should be cleared. The
46
+ * first expression variable is used when omitted.
47
+ * @param newVar - Fresh substitution variable. Defaults to `t`.
48
+ * @returns Substitution metadata, or `null` if the expression is constant or
49
+ * contains no fractional powers of the selected variable.
50
+ */
51
+ function radicalSubstitution(expr, variable, newVar = 't') {
52
+ const e = Expression_1.Expression.create(expr);
53
+ if (!variable) {
54
+ const vars = e.variables();
55
+ if (vars.length === 0) {
56
+ return null;
57
+ }
58
+ variable = vars[0];
59
+ }
60
+ const denoms = collectPowerDenominators(e, variable);
61
+ if (denoms.length === 0) {
62
+ return null;
63
+ }
64
+ const nBig = (0, bigint_1.bigintLCM)(denoms);
65
+ const n = Number(nBig);
66
+ const t = Expression_1.Expression.create(newVar);
67
+ const substituted = (0, subst_1.rewriteRadicals)(e, variable, t, nBig);
68
+ const dxdt = Expression_1.Expression.create(String(n)).times(t.pow(n - 1));
69
+ const integrand = substituted.times(dxdt);
70
+ const backSub = Expression_1.Expression.create(variable).pow(Expression_1.Expression.create(`1/${n}`));
71
+ return {
72
+ integrand,
73
+ newVariable: newVar,
74
+ originalVariable: variable,
75
+ n,
76
+ backSub,
77
+ };
78
+ }
79
+ /** Returns whether `expr` contains a variable-dependent function or exponential. */
80
+ function hasTranscendental(expr, v) {
81
+ if (expr.isFunction() && expr.hasVariable(v)) {
82
+ return true;
83
+ }
84
+ if (expr.isEXP() && expr.hasVariable(v)) {
85
+ return true;
86
+ }
87
+ let found = false;
88
+ if (expr.isProduct() || expr.isSum()) {
89
+ expr.each((child) => {
90
+ if (hasTranscendental(child, v)) {
91
+ found = true;
92
+ }
93
+ });
94
+ }
95
+ return found;
96
+ }
@@ -0,0 +1,31 @@
1
+ import { Expression } from '../../core/classes/expression/Expression';
2
+ import type { ExpressionInput } from '../../core/types';
3
+ /**
4
+ * Computes a symbolic inverse Laplace transform from a transform variable to a
5
+ * time variable.
6
+ *
7
+ * The strategy applies linearity, extracts constants, consults the inverse
8
+ * transform table, normalizes supported shifted quadratics and exponential
9
+ * delays, and finally tries partial-fraction decomposition.
10
+ *
11
+ * @remarks
12
+ * Exponential delay extraction requires a provably positive shift coefficient
13
+ * according to the expression's current sign information. Unsupported or
14
+ * ambiguous input is returned as an unevaluated `ilaplace(expr, s, t)`
15
+ * Expression. The partial-fraction fallback is only attempted when both the
16
+ * numerator and denominator are in its polynomial domain, and relies on
17
+ * `partfrac` preserving object identity when it performs no decomposition.
18
+ *
19
+ * @param expr - Transform-domain expression.
20
+ * @param s - Plain transform-domain variable.
21
+ * @param t - Plain time-domain variable.
22
+ * @returns The symbolic inverse transform, or an unevaluated `ilaplace(...)`
23
+ * Expression when no strategy resolves the input.
24
+ * @throws {@link core!UnexpectedInputError} If `s` or `t` is not a plain variable.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * ilaplace('1/(s^2+1)', 's', 't').text();
29
+ * ```
30
+ */
31
+ export declare function ilaplace(expr: ExpressionInput, s: ExpressionInput, t: ExpressionInput): Expression;
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ilaplace = ilaplace;
4
+ const partfrac_1 = require("../../algebra/partfrac");
5
+ const utils_1 = require("../../algebra/utils");
6
+ const Expression_1 = require("../../core/classes/expression/Expression");
7
+ const products_1 = require("../../core/classes/expression/products");
8
+ const shortcuts_1 = require("../../core/classes/expression/shortcuts");
9
+ const utils_2 = require("../../core/classes/expression/utils");
10
+ const constants_1 = require("../../core/classes/parser/constants");
11
+ const Pattern_1 = require("../../core/converters/Pattern");
12
+ const ilaplaceTable_1 = require("./ilaplaceTable");
13
+ /**
14
+ * Computes a symbolic inverse Laplace transform from a transform variable to a
15
+ * time variable.
16
+ *
17
+ * The strategy applies linearity, extracts constants, consults the inverse
18
+ * transform table, normalizes supported shifted quadratics and exponential
19
+ * delays, and finally tries partial-fraction decomposition.
20
+ *
21
+ * @remarks
22
+ * Exponential delay extraction requires a provably positive shift coefficient
23
+ * according to the expression's current sign information. Unsupported or
24
+ * ambiguous input is returned as an unevaluated `ilaplace(expr, s, t)`
25
+ * Expression. The partial-fraction fallback is only attempted when both the
26
+ * numerator and denominator are in its polynomial domain, and relies on
27
+ * `partfrac` preserving object identity when it performs no decomposition.
28
+ *
29
+ * @param expr - Transform-domain expression.
30
+ * @param s - Plain transform-domain variable.
31
+ * @param t - Plain time-domain variable.
32
+ * @returns The symbolic inverse transform, or an unevaluated `ilaplace(...)`
33
+ * Expression when no strategy resolves the input.
34
+ * @throws {@link core!UnexpectedInputError} If `s` or `t` is not a plain variable.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * ilaplace('1/(s^2+1)', 's', 't').text();
39
+ * ```
40
+ */
41
+ function ilaplace(expr, s, t) {
42
+ expr = Expression_1.Expression.create(expr);
43
+ s = (0, utils_2.assertPlainVariableAndGetString)(Expression_1.Expression.create(s));
44
+ t = (0, utils_2.assertPlainVariableAndGetString)(Expression_1.Expression.create(t));
45
+ let retval;
46
+ // Linearity over sums
47
+ if (expr.isSum() && expr.isLinear()) {
48
+ const elements = expr.elementsArray();
49
+ retval = (0, shortcuts_1.zero)();
50
+ for (const e of elements) {
51
+ const transform = ilaplace(e, s, t);
52
+ // Any unevaluated ilaplace(.) means this branch failed
53
+ if (transform.isFunction(constants_1.ILAPLACE)) {
54
+ retval = undefined;
55
+ break;
56
+ }
57
+ retval = retval.plus(transform);
58
+ }
59
+ if (retval) {
60
+ return retval;
61
+ }
62
+ }
63
+ // Pull out a numeric multiplier stored directly on a non-product node.
64
+ const multiplier = Expression_1.Expression.fromRational(expr.getMultiplier());
65
+ if (!multiplier.isOne()) {
66
+ const transform = ilaplace(expr.toUnitMultiplier(), s, t);
67
+ if (!transform.isFunction(constants_1.ILAPLACE)) {
68
+ return multiplier.times(transform);
69
+ }
70
+ }
71
+ // Pull out constants from products
72
+ if (expr.isProduct()) {
73
+ const { constants, expression } = (0, products_1.constantsFreeProduct)(expr, s);
74
+ if (!constants.isOne()) {
75
+ const transform = ilaplace(expression, s, t);
76
+ if (!transform.isFunction(constants_1.ILAPLACE)) {
77
+ return constants.times(transform);
78
+ }
79
+ }
80
+ }
81
+ // Base/derived table lookup
82
+ retval = ilaplaceTable_1.tableOfInverseTransforms.lookup(new Pattern_1.Pattern(expr, [s]), 0);
83
+ if (retval) {
84
+ if (t !== 't') {
85
+ retval = retval.evaluate({ t });
86
+ }
87
+ return retval;
88
+ }
89
+ // Normalize an affine numerator over an expanded quadratic to the shifted
90
+ // forms already covered by the inverse-transform table.
91
+ {
92
+ const num = expr.getNumerator();
93
+ const den = expr.getDenominator();
94
+ if (den.isPolynomialLike() && num.isPolynomialLike()) {
95
+ const denCoeffs = den.coeffs(s);
96
+ const numCoeffs = num.coeffs(s);
97
+ if (denCoeffs.max() === 2 && numCoeffs.max() <= 1) {
98
+ const { h, expression: completed } = (0, utils_1.sqcomp)(den, s);
99
+ const hasShiftedSquare = den.isSum() &&
100
+ den
101
+ .elementsArray()
102
+ .some(term => term.getPower().eq(2) && term.getBase().isSum());
103
+ if (!h.isZero() && !hasShiftedSquare) {
104
+ const constant = numCoeffs.hasPower(0) ? numCoeffs.getPower(0) : (0, shortcuts_1.zero)();
105
+ const linear = numCoeffs.hasPower(1) ? numCoeffs.getPower(1) : (0, shortcuts_1.zero)();
106
+ const shifted = Expression_1.Expression.create(s).plus(h);
107
+ const remainder = constant.minus(linear.times(h));
108
+ const alignedTransform = linear.isZero()
109
+ ? (0, shortcuts_1.zero)()
110
+ : ilaplace(shifted.div(completed), s, t);
111
+ const remainderTransform = remainder.isZero()
112
+ ? (0, shortcuts_1.zero)()
113
+ : ilaplace(completed.invert(), s, t);
114
+ if (!alignedTransform.isFunction(constants_1.ILAPLACE) &&
115
+ !remainderTransform.isFunction(constants_1.ILAPLACE)) {
116
+ return linear
117
+ .times(alignedTransform)
118
+ .plus(remainder.times(remainderTransform));
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ // Exponential shift: L^-1{e^(-a*s) * F(s)} = heaviside(t-a) * f(t-a)
125
+ // When e^(-a*s) appears, it lands in the denominator as e^(a*s) with a > 0.
126
+ {
127
+ const num = expr.getNumerator();
128
+ const den = expr.getDenominator();
129
+ const shift = extractExpShift(den, s);
130
+ if (shift) {
131
+ // Rebuild the expression without the exponential factor
132
+ const stripped = num.div(shift.remainder);
133
+ const transform = ilaplace(stripped, s, t);
134
+ if (!transform.isFunction(constants_1.ILAPLACE)) {
135
+ const a = shift.coefficient;
136
+ const tShifted = Expression_1.Expression.create(t).minus(a);
137
+ const shifted = transform.subst(t, tShifted);
138
+ return Expression_1.Expression.toFunction(constants_1.HEAVISIDE, [tShifted]).times(shifted);
139
+ }
140
+ }
141
+ }
142
+ // Partial fractions are only defined here for polynomial numerators and denominators.
143
+ // partfrac constructs Polynomial objects once the denominator depends on the selected
144
+ // variable, so guard its domain rather than leaking a PolynomialError for unsupported input.
145
+ const num = expr.getNumerator();
146
+ const den = expr.getDenominator();
147
+ if (num.isPolynomialLike() && den.isPolynomialLike()) {
148
+ // IMPORTANT: partfrac returns the same reference (===) when no decomposition
149
+ // occurs. This identity check avoids infinite recursion. If partfrac is ever
150
+ // changed to return a copy on no-op, this will silently cause wasted recursion
151
+ // (or worse). Keep this method in sync with partfrac.
152
+ const decomposed = (0, partfrac_1.partfrac)(expr, s);
153
+ if (decomposed !== expr) {
154
+ const transform = ilaplace(decomposed, s, t);
155
+ if (!transform.isFunction(constants_1.ILAPLACE)) {
156
+ return transform;
157
+ }
158
+ }
159
+ }
160
+ return Expression_1.Expression.toFunction(constants_1.ILAPLACE, [expr, s, t]);
161
+ }
162
+ /**
163
+ * Scans a denominator expression for an exponential factor e^(a*s) where a > 0.
164
+ * This corresponds to e^(-a*s) in the original expression (negative absorbed into denominator).
165
+ *
166
+ * @returns The positive shift coefficient and the denominator with the exponential stripped,
167
+ * or undefined if no such factor is found.
168
+ */
169
+ function extractExpShift(den, s) {
170
+ const elements = den.isProduct() ? den.elementsArray() : [den];
171
+ for (const el of elements) {
172
+ if (!el.isEXP()) {
173
+ continue;
174
+ }
175
+ const exponent = el.getPower();
176
+ if (!exponent.hasVariable(s)) {
177
+ continue;
178
+ }
179
+ // Check that the exponent is linear in s: exponent = a * s (no constant term, no higher powers)
180
+ const { constants: coefficient, expression: variable } = (0, products_1.constantsFreeProduct)(exponent, s);
181
+ if (!variable.eq(s)) {
182
+ continue;
183
+ }
184
+ if (coefficient.sign() <= 0) {
185
+ continue;
186
+ }
187
+ // Strip this factor from the denominator
188
+ const remainder = den.div(el);
189
+ return { coefficient, remainder };
190
+ }
191
+ return undefined;
192
+ }
@@ -0,0 +1,2 @@
1
+ import { LookupTable } from '../../core/classes/lookupTable/LookupTable';
2
+ export declare const tableOfInverseTransforms: LookupTable;
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableOfInverseTransforms = void 0;
4
+ const LookupTable_1 = require("../../core/classes/lookupTable/LookupTable");
5
+ const Pattern_1 = require("../../core/converters/Pattern");
6
+ const ilaplaceTable = {
7
+ // L^-1{a1/s^n1} = a1*t^(n1-1)/gamma(n1)
8
+ 'a1/x1^n1': p => {
9
+ const { n1 } = p.references;
10
+ if (n1.isZero()) {
11
+ return undefined;
12
+ }
13
+ if (n1.isNegative()) {
14
+ return undefined;
15
+ }
16
+ return p.fromPattern('(a1*t^(n1-1))/gamma(n1)');
17
+ },
18
+ // Linear pole family:
19
+ // L^-1{ a1 / (a2*s + a3)^n2 } =
20
+ // a1 * t^(n2-1) * e^((-a3/a2)*t) / (a2^n2 * gamma(n2))
21
+ //
22
+ // Quadratic unshifted sine family:
23
+ // L^-1{ a1 / (a2*s^2 + a3) } =
24
+ // (a1/(a2^(1/2)*a3^(1/2))) * sin((a3^(1/2)*t)/(a2^(1/2)))
25
+ 'a1/((a2*x1^n1+a3)^n2)': p => {
26
+ const { n1, n2 } = p.references;
27
+ if (n1.isOne()) {
28
+ return p.fromPattern('(a1*t^(n2-1)*e^((-a3/a2)*t))/(a2^n2*gamma(n2))');
29
+ }
30
+ if (n1.eq(2) && n2.isOne()) {
31
+ return p.fromPattern('(a1*sin((a3^(1/2)*t)/(a2^(1/2))))/(a2^(1/2)*a3^(1/2))');
32
+ }
33
+ if (n1.eq(2) && n2.eq(2)) {
34
+ return p
35
+ .fromPattern('(a1*sin((a3^(1/2)*t)/(a2^(1/2))))/(2*a2^(1/2)*a3^(3/2))')
36
+ .minus(p.fromPattern('(a1*t*cos((a3^(1/2)*t)/(a2^(1/2))))/(2*a2*a3)'));
37
+ }
38
+ },
39
+ // Cosine family:
40
+ // L^-1{ a1*s / (a2*s^2 + a3) } =
41
+ // (a1/a2) * cos((a3^(1/2)*t)/(a2^(1/2)))
42
+ //
43
+ // t*sin family:
44
+ // L^-1{ a1*s / (a2*s^2 + a3)^2 } =
45
+ // (a1*t*sin((a3^(1/2)*t)/(a2^(1/2)))) / (2*a2^(3/2)*a3^(1/2))
46
+ '(a1*x1^n1)/((a2*x1^n2+a3)^n3)': p => {
47
+ const { n1, n2, n3 } = p.references;
48
+ if (!n2.eq(2)) {
49
+ return undefined;
50
+ }
51
+ if (n1.isOne()) {
52
+ if (n3.isOne()) {
53
+ return p.fromPattern('(a1*cos((a3^(1/2)*t)/(a2^(1/2))))/a2');
54
+ }
55
+ if (n3.eq(2)) {
56
+ return p.fromPattern('(a1*t*sin((a3^(1/2)*t)/(a2^(1/2))))/(2*a2^(3/2)*a3^(1/2))');
57
+ }
58
+ }
59
+ if (n1.eq(2) && n3.eq(2)) {
60
+ return p
61
+ .fromPattern('(a1*sin((a3^(1/2)*t)/(a2^(1/2))))/(2*a2^(1/2)*a3^(1/2))')
62
+ .plus(p.fromPattern('(a1*t*cos((a3^(1/2)*t)/(a2^(1/2))))/(2*a2)'));
63
+ }
64
+ },
65
+ // Shifted sine family:
66
+ // L^-1{ a1 / (a2*(a3*s + a4)^2 + a5) } =
67
+ // a1*e^((-a4/a3)*t)*sin((a5^(1/2)*t)/(a2^(1/2)*a3)) / (a2^(1/2)*a3*a5^(1/2))
68
+ // 1 / (((s-b)^2 + c^2)^n) and 1 / (((s-b)^2 - c^2)^n)
69
+ 'a1/((a2*(a3*x1^n1+a4)^n2+a5)^n3)': p => {
70
+ const { n1, n2, n3, a5 } = p.references;
71
+ if (!n1.isOne() || !n2.eq(2)) {
72
+ return undefined;
73
+ }
74
+ // Hyperbolic branch: a5 < 0
75
+ if (a5.sign() < 0) {
76
+ if (n3.isOne()) {
77
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*sinh((((-a5)^(1/2))*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3*((-a5)^(1/2)))');
78
+ }
79
+ if (n3.eq(2)) {
80
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*((((-a5)^(1/2))*t*cosh((((-a5)^(1/2))*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3)-sinh((((-a5)^(1/2))*t)/(a2^(1/2)*a3))))/(2*a2^(1/2)*a3*((-a5)^(3/2)))');
81
+ }
82
+ return undefined;
83
+ }
84
+ // Trig branch: a5 > 0
85
+ if (n3.isOne()) {
86
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*sin((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3*a5^(1/2))');
87
+ }
88
+ if (n3.eq(2)) {
89
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*(sin((a5^(1/2)*t)/(a2^(1/2)*a3))-(a5^(1/2)*t*cos((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3)))/(2*a2^(1/2)*a3*a5^(3/2))');
90
+ }
91
+ return undefined;
92
+ },
93
+ // Shifted cosine family:
94
+ // L^-1{ a1*(a3*s+a4) / (a2*(a3*s+a4)^2 + a5) } =
95
+ // a1*e^((-a4/a3)*t)*cos((a5^(1/2)*t)/(a2^(1/2)*a3)) / (a2*a3)
96
+ // (s-b) / (((s-b)^2 + c^2)^n) and (s-b) / (((s-b)^2 - c^2)^n)
97
+ // (c*(s-a)) / ((b*(d*(s-a))^2 + e)^n)
98
+ // (c*(s-a)) / ((b*(d*(s-a))^2 + e)^n)
99
+ '(a1*((a6*x1^n4+a7)^n5))/((a2*(a3*x1^n1+a4)^n2+a5)^n3)': p => {
100
+ const { n1, n2, n3, n4, n5, a3, a4, a5, a6, a7 } = p.references;
101
+ if (!n1.isOne() || !n2.eq(2) || !n4.isOne() || !n5.isOne()) {
102
+ return undefined;
103
+ }
104
+ // numerator affine term must be a scalar multiple of denominator affine term
105
+ if (!a7.times(a3).eq(a4.times(a6))) {
106
+ return undefined;
107
+ }
108
+ // Hyperbolic branch
109
+ if (a5.sign() < 0) {
110
+ if (n3.isOne()) {
111
+ return p.fromPattern('(a1*a6*e^((-a4/a3)*t)*cosh((((-a5)^(1/2))*t)/(a2^(1/2)*a3)))/(a2*a3^2)');
112
+ }
113
+ if (n3.eq(2)) {
114
+ return p.fromPattern('(a1*a6*t*e^((-a4/a3)*t)*sinh((((-a5)^(1/2))*t)/(a2^(1/2)*a3)))/(2*a2^(3/2)*a3^3*((-a5)^(1/2)))');
115
+ }
116
+ return undefined;
117
+ }
118
+ // Trigonometric branch
119
+ if (n3.isOne()) {
120
+ return p.fromPattern('(a1*a6*e^((-a4/a3)*t)*cos((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2*a3^2)');
121
+ }
122
+ if (n3.eq(2)) {
123
+ return p.fromPattern('(a1*a6*t*e^((-a4/a3)*t)*sin((a5^(1/2)*t)/(a2^(1/2)*a3)))/(2*a2^(3/2)*a3^3*a5^(1/2))');
124
+ }
125
+ return undefined;
126
+ },
127
+ // ((c*(s-a))^2) / ((b*(d*(s-a))^2 + e)^2)
128
+ '(a1*(a6*x1^n4+a7)^n5)/((a2*(a3*x1^n1+a4)^n2+a5)^n3)': p => {
129
+ const { n1, n2, n3, n4, n5, a3, a4, a5, a6, a7 } = p.references;
130
+ if (!n1.isOne() || !n2.eq(2) || !n3.eq(2) || !n4.isOne() || !n5.eq(2)) {
131
+ return undefined;
132
+ }
133
+ // numerator affine term must be a scalar multiple of denominator affine term
134
+ if (!a7.times(a3).eq(a4.times(a6))) {
135
+ return undefined;
136
+ }
137
+ // Hyperbolic branch
138
+ if (a5.sign() < 0) {
139
+ return p.fromPattern('(a1*a6^2*e^((-a4/a3)*t)*(sinh((((-a5)^(1/2))*t)/(a2^(1/2)*a3))+(((-a5)^(1/2))*t*cosh((((-a5)^(1/2))*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3)))/(2*a2^(3/2)*a3^3*((-a5)^(1/2)))');
140
+ }
141
+ // Trigonometric branch
142
+ return p.fromPattern('(a1*a6^2*e^((-a4/a3)*t)*(sin((a5^(1/2)*t)/(a2^(1/2)*a3))+(a5^(1/2)*t*cos((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3)))/(2*a2^(3/2)*a3^3*a5^(1/2))');
143
+ },
144
+ // a / ((s-b)^2 - c^2)
145
+ 'a1/(a2*(a3*x1^n1+a4)^n2-a5)': p => {
146
+ const { n1, n2 } = p.references;
147
+ if (!n1.isOne() || !n2.eq(2)) {
148
+ return undefined;
149
+ }
150
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*sinh((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2^(1/2)*a3*a5^(1/2))');
151
+ },
152
+ // (s-b) / ((s-b)^2 - c^2)
153
+ '(a1*(a6*x1^n3+a7)^n4)/(a2*(a3*x1^n1+a4)^n2-a5)': p => {
154
+ const { n1, n2, n3, n4 } = p.references;
155
+ if (!n1.isOne() || !n2.eq(2) || !n3.isOne() || !n4.isOne()) {
156
+ return undefined;
157
+ }
158
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*cosh((a5^(1/2)*t)/(a2^(1/2)*a3)))/(a2*a3^2)');
159
+ },
160
+ // a / (((s-b)^2 - c^2)^2)
161
+ 'a1/((a2*(a3*x1^n1+a4)^n2-a5)^n3)': p => {
162
+ const { n1, n2, n3 } = p.references;
163
+ if (!n1.isOne() || !n2.eq(2) || !n3.eq(2)) {
164
+ return undefined;
165
+ }
166
+ return p.fromPattern('(a1*e^((-a4/a3)*t)*(a5^(1/2)*t*cosh((a5^(1/2)*t)/(a2^(1/2)*a3))-a2^(1/2)*a3*sinh((a5^(1/2)*t)/(a2^(1/2)*a3))))/(2*a2*a3^2*a5^(3/2))');
167
+ },
168
+ // (s-b) / (((s-b)^2 - c^2)^2)
169
+ '(a1*(a6*x1^n3+a7)^n4)/((a2*(a3*x1^n1+a4)^n2-a5)^n5)': p => {
170
+ const { n1, n2, n3, n4, n5 } = p.references;
171
+ if (!n1.isOne() || !n2.eq(2) || !n3.isOne() || !n4.isOne() || !n5.eq(2)) {
172
+ return undefined;
173
+ }
174
+ return p.fromPattern('(a1*t*e^((-a4/a3)*t)*sinh((a5^(1/2)*t)/(a2^(1/2)*a3)))/(2*a2^(1/2)*a3*a5^(1/2))');
175
+ },
176
+ // (A*(B*(s-a)^2+C)) / ((D*(s-a)^2+E)^2)
177
+ '(a1*((a2*(a3*x1^n1+a4)^n2+a5)^n3))/((a6*(a7*x1^n4+a8)^n5+a9)^n6)': p => {
178
+ const { n1, n2, n3, n4, n5, n6, _a2, a3, a4, _a6, a7, a8, _a9 } = p.references;
179
+ if (!n1.isOne() || !n2.eq(2) || !n3.isOne() || !n4.isOne() || !n5.eq(2) || !n6.eq(2)) {
180
+ return undefined;
181
+ }
182
+ if (!a3.eq(a7) || !a4.eq(a8)) {
183
+ return undefined;
184
+ }
185
+ const v = p.get('x1').text();
186
+ const expr1 = p.fromPattern('1/(a6*(a7*x1^n4+a8)^n5+a9)');
187
+ const expr2 = p.fromPattern('1/((a6*(a7*x1^n4+a8)^n5+a9)^2)');
188
+ const T1 = exports.tableOfInverseTransforms.lookup(new Pattern_1.Pattern(expr1, [v]), 0);
189
+ const T2 = exports.tableOfInverseTransforms.lookup(new Pattern_1.Pattern(expr2, [v]), 0);
190
+ if (!T1 || !T2) {
191
+ return undefined;
192
+ }
193
+ return p
194
+ .fromPattern('(a1*a2)/a6')
195
+ .times(T1)
196
+ .plus(p.fromPattern('a1*(a5-(a2*a9)/a6)').times(T2));
197
+ },
198
+ };
199
+ exports.tableOfInverseTransforms = new LookupTable_1.LookupTable();
200
+ exports.tableOfInverseTransforms.addEntries(ilaplaceTable);
@@ -0,0 +1,22 @@
1
+ import { Expression } from '../../core/classes/expression/Expression';
2
+ import type { ExpressionInput } from '../../core/types';
3
+ /**
4
+ * Computes a symbolic Laplace transform from a time variable to a transform variable.
5
+ *
6
+ * The expression is expanded, linear sums are transformed term by term,
7
+ * constants independent of the time variable are extracted, and the remaining
8
+ * expression is matched against the transform table.
9
+ *
10
+ * @param expr - Time-domain expression.
11
+ * @param t - Plain time-domain variable.
12
+ * @param s - Plain transform-domain variable.
13
+ * @returns The symbolic transform, or an unevaluated `laplace(expr, t, s)`
14
+ * Expression when no table rule resolves the input.
15
+ * @throws {@link core!UnexpectedInputError} If `t` or `s` is not a plain variable.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * laplace('sin(t)', 't', 's').text();
20
+ * ```
21
+ */
22
+ export declare function laplace(expr: ExpressionInput, t: ExpressionInput, s: ExpressionInput): Expression;