diff-grok 1.0.9 → 1.0.10

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 (203) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  2. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  3. package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  4. package/.github/workflows/deploy-docs.yml +15 -0
  5. package/CONTRIBUTING.md +74 -0
  6. package/README.MD +183 -5
  7. package/docs/.nojekyll +1 -0
  8. package/docs/assets/hierarchy.js +1 -0
  9. package/docs/assets/highlight.css +99 -0
  10. package/docs/assets/icons.js +18 -0
  11. package/docs/assets/icons.svg +1 -0
  12. package/docs/assets/main.js +60 -0
  13. package/docs/assets/navigation.js +1 -0
  14. package/docs/assets/search.js +1 -0
  15. package/docs/assets/style.css +1633 -0
  16. package/docs/classes/BasicModelPipelineCreator.html +10 -0
  17. package/docs/classes/Callback.html +7 -0
  18. package/docs/classes/CyclicModelPipelineCreator.html +10 -0
  19. package/docs/classes/IterCheckerCallback.html +8 -0
  20. package/docs/classes/PipelineCreator.html +6 -0
  21. package/docs/classes/TimeCheckerCallback.html +8 -0
  22. package/docs/classes/UpdatesModelPipelineCreator.html +10 -0
  23. package/docs/functions/applyPipeline.html +9 -0
  24. package/docs/functions/getCallback.html +3 -0
  25. package/docs/functions/getIVP.html +6 -0
  26. package/docs/functions/getInputVector.html +2 -0
  27. package/docs/functions/getIvp2WebWorker.html +6 -0
  28. package/docs/functions/getJScode.html +6 -0
  29. package/docs/functions/getOutputNames.html +4 -0
  30. package/docs/functions/getPipelineCreator.html +7 -0
  31. package/docs/functions/mrt.html +11 -0
  32. package/docs/functions/printE5.html +76 -0
  33. package/docs/functions/printHires.html +76 -0
  34. package/docs/functions/printOrego.html +66 -0
  35. package/docs/functions/printPollution.html +163 -0
  36. package/docs/functions/printRobertson.html +60 -0
  37. package/docs/functions/printVdpol.html +66 -0
  38. package/docs/functions/ros34prw.html +8 -0
  39. package/docs/functions/ros3prw.html +8 -0
  40. package/docs/functions/solveIvp.html +5 -0
  41. package/docs/hierarchy.html +1 -0
  42. package/docs/index.html +683 -0
  43. package/docs/media/CONTRIBUTING.md +74 -0
  44. package/docs/media/POLL.png +0 -0
  45. package/docs/media/VDPOL.png +0 -0
  46. package/docs/media/acid-prod.gif +0 -0
  47. package/docs/media/basic-use.js +40 -0
  48. package/docs/media/basic-use.js.map +1 -0
  49. package/docs/media/basic-use.ts +44 -0
  50. package/docs/media/check-methods.js +59 -0
  51. package/docs/media/check-methods.js.map +1 -0
  52. package/docs/media/check-methods.ts +81 -0
  53. package/docs/media/corr-probs.js +132 -0
  54. package/docs/media/corr-probs.js.map +1 -0
  55. package/docs/media/corr-probs.ts +155 -0
  56. package/docs/media/cyclic-model.js +100 -0
  57. package/docs/media/cyclic-model.js.map +1 -0
  58. package/docs/media/cyclic-model.ts +110 -0
  59. package/docs/media/e5.js +36 -0
  60. package/docs/media/e5.js.map +1 -0
  61. package/docs/media/e5.ts +36 -0
  62. package/docs/media/hires.js +39 -0
  63. package/docs/media/hires.js.map +1 -0
  64. package/docs/media/hires.ts +40 -0
  65. package/docs/media/model-updates.js +112 -0
  66. package/docs/media/model-updates.js.map +1 -0
  67. package/docs/media/model-updates.ts +122 -0
  68. package/docs/media/orego.js +24 -0
  69. package/docs/media/orego.js.map +1 -0
  70. package/docs/media/orego.ts +25 -0
  71. package/docs/media/pipeline-use.js +87 -0
  72. package/docs/media/pipeline-use.js.map +1 -0
  73. package/docs/media/pipeline-use.ts +98 -0
  74. package/docs/media/pollution.js +132 -0
  75. package/docs/media/pollution.js.map +1 -0
  76. package/docs/media/pollution.ts +133 -0
  77. package/docs/media/print-benchmark.js +581 -0
  78. package/docs/media/print-benchmark.js.map +1 -0
  79. package/docs/media/print-benchmark.ts +594 -0
  80. package/docs/media/robertson.js +19 -0
  81. package/docs/media/robertson.js.map +1 -0
  82. package/docs/media/robertson.ts +19 -0
  83. package/docs/media/scripting.js +30 -0
  84. package/docs/media/scripting.js.map +1 -0
  85. package/docs/media/scripting.ts +35 -0
  86. package/docs/media/vdpol.js +17 -0
  87. package/docs/media/vdpol.js.map +1 -0
  88. package/docs/media/vdpol.ts +17 -0
  89. package/docs/modules.html +1 -0
  90. package/docs/types/Arg.html +12 -0
  91. package/docs/types/DifEqs.html +8 -0
  92. package/docs/types/Func.html +7 -0
  93. package/docs/types/IVP.html +40 -0
  94. package/docs/types/IVP2WebWorker.html +12 -0
  95. package/docs/types/Input.html +8 -0
  96. package/docs/types/Loop.html +7 -0
  97. package/docs/types/ODEs.html +31 -0
  98. package/docs/types/Output.html +6 -0
  99. package/docs/types/Pipeline.html +6 -0
  100. package/docs/types/SolverOptions.html +8 -0
  101. package/docs/types/Update.html +9 -0
  102. package/docs/types/Wrapper.html +8 -0
  103. package/images/POLL.png +0 -0
  104. package/images/VDPOL.png +0 -0
  105. package/index.js +2 -2
  106. package/index.js.map +1 -1
  107. package/index.ts +6 -5
  108. package/package.json +2 -1
  109. package/src/examples/check-methods.js +23 -9
  110. package/src/examples/check-methods.js.map +1 -1
  111. package/src/examples/check-methods.ts +28 -9
  112. package/src/examples/corr-probs.js +3 -1
  113. package/src/examples/corr-probs.js.map +1 -1
  114. package/src/examples/corr-probs.ts +7 -3
  115. package/src/examples/e5.js +6 -0
  116. package/src/examples/e5.js.map +1 -1
  117. package/src/examples/e5.ts +7 -0
  118. package/src/examples/hires.js +10 -0
  119. package/src/examples/hires.js.map +1 -1
  120. package/src/examples/hires.ts +11 -0
  121. package/src/examples/index.js +21 -7
  122. package/src/examples/index.js.map +1 -1
  123. package/src/examples/index.ts +23 -7
  124. package/src/examples/orego.js +5 -0
  125. package/src/examples/orego.js.map +1 -1
  126. package/src/examples/orego.ts +6 -0
  127. package/src/examples/pollution.js +22 -0
  128. package/src/examples/pollution.js.map +1 -1
  129. package/src/examples/pollution.ts +23 -0
  130. package/src/examples/print-benchmark.js +581 -0
  131. package/src/examples/print-benchmark.js.map +1 -0
  132. package/src/examples/print-benchmark.ts +594 -0
  133. package/src/examples/robertson.js +6 -1
  134. package/src/examples/robertson.js.map +1 -1
  135. package/src/examples/robertson.ts +7 -1
  136. package/src/examples/scripting.js +1 -1
  137. package/src/examples/scripting.js.map +1 -1
  138. package/src/examples/scripting.ts +1 -1
  139. package/src/examples/vdpol.js +4 -0
  140. package/src/examples/vdpol.js.map +1 -1
  141. package/src/examples/vdpol.ts +5 -0
  142. package/src/pipeline/basic-pipeline-creator.js +96 -1
  143. package/src/pipeline/basic-pipeline-creator.js.map +1 -1
  144. package/src/pipeline/basic-pipeline-creator.ts +97 -1
  145. package/src/pipeline/loops-pipeline-creator.js +115 -2
  146. package/src/pipeline/loops-pipeline-creator.js.map +1 -1
  147. package/src/pipeline/loops-pipeline-creator.ts +116 -2
  148. package/src/pipeline/output.js +7 -2
  149. package/src/pipeline/output.js.map +1 -1
  150. package/src/pipeline/output.ts +7 -2
  151. package/src/pipeline/pipeline-creator.js.map +1 -1
  152. package/src/pipeline/pipeline-creator.ts +4 -0
  153. package/src/pipeline/pipeline.js +193 -2
  154. package/src/pipeline/pipeline.js.map +1 -1
  155. package/src/pipeline/pipeline.ts +206 -4
  156. package/src/pipeline/updates-pipeline-creator.js +130 -2
  157. package/src/pipeline/updates-pipeline-creator.js.map +1 -1
  158. package/src/pipeline/updates-pipeline-creator.ts +131 -2
  159. package/src/scripting-tools/constants.js +18 -4
  160. package/src/scripting-tools/constants.js.map +1 -1
  161. package/src/scripting-tools/constants.ts +22 -4
  162. package/src/scripting-tools/index.js.map +1 -1
  163. package/src/scripting-tools/index.ts +3 -2
  164. package/src/scripting-tools/model-error.js +3 -1
  165. package/src/scripting-tools/model-error.js.map +1 -1
  166. package/src/scripting-tools/model-error.ts +3 -1
  167. package/src/scripting-tools/scripting-tools.js +139 -9
  168. package/src/scripting-tools/scripting-tools.js.map +1 -1
  169. package/src/scripting-tools/scripting-tools.ts +228 -21
  170. package/src/solver-tools/callbacks/callback-base.js +2 -0
  171. package/src/solver-tools/callbacks/callback-base.js.map +1 -1
  172. package/src/solver-tools/callbacks/callback-base.ts +4 -0
  173. package/src/solver-tools/callbacks/callback-tools.js +3 -1
  174. package/src/solver-tools/callbacks/callback-tools.js.map +1 -1
  175. package/src/solver-tools/callbacks/callback-tools.ts +3 -1
  176. package/src/solver-tools/callbacks/iter-checker-callback.js +4 -0
  177. package/src/solver-tools/callbacks/iter-checker-callback.js.map +1 -1
  178. package/src/solver-tools/callbacks/iter-checker-callback.ts +4 -0
  179. package/src/solver-tools/callbacks/time-checker-callback.js +4 -0
  180. package/src/solver-tools/callbacks/time-checker-callback.js.map +1 -1
  181. package/src/solver-tools/callbacks/time-checker-callback.ts +4 -0
  182. package/src/solver-tools/index.js +3 -0
  183. package/src/solver-tools/index.js.map +1 -1
  184. package/src/solver-tools/index.ts +3 -0
  185. package/src/solver-tools/mrt-method.js +40 -1
  186. package/src/solver-tools/mrt-method.js.map +1 -1
  187. package/src/solver-tools/mrt-method.ts +40 -1
  188. package/src/solver-tools/ros34prw-method.js +39 -1
  189. package/src/solver-tools/ros34prw-method.js.map +1 -1
  190. package/src/solver-tools/ros34prw-method.ts +39 -1
  191. package/src/solver-tools/ros3prw-method.js +39 -1
  192. package/src/solver-tools/ros3prw-method.js.map +1 -1
  193. package/src/solver-tools/ros3prw-method.ts +39 -1
  194. package/src/solver-tools/solver-defs.js +9 -3
  195. package/src/solver-tools/solver-defs.js.map +1 -1
  196. package/src/solver-tools/solver-defs.ts +85 -7
  197. package/src/worker-tools/scripting.js +95 -1
  198. package/src/worker-tools/scripting.js.map +1 -1
  199. package/src/worker-tools/scripting.ts +104 -2
  200. package/src/worker-tools/solving.js +5 -1
  201. package/src/worker-tools/solving.js.map +1 -1
  202. package/src/worker-tools/solving.ts +5 -1
  203. package/typedoc.json +8 -0
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printE5 | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printE5</a></li></ul><h1>Function printE5</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printe5"><span class="tsd-kind-call-signature">printE5</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printe5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the E5 benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printE5</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printE5</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparison
6
+ import numpy as np
7
+ import pandas as pd
8
+ from scipy.integrate import solve_ivp
9
+
10
+ # -------------------------
11
+ # 0. Solver method
12
+ # -------------------------
13
+ METHOD = "Radau" # stiff solver recommended
14
+
15
+ # -------------------------
16
+ # 1. Define E5 constants
17
+ # -------------------------
18
+ K1 = 7.89e-10
19
+ K2 = 1.13e9
20
+ K3 = 1.1e7
21
+ K4 = 1.13e3
22
+
23
+ # -------------------------
24
+ # 2. Define E5 ODE
25
+ # -------------------------
26
+ def e5(t, y):
27
+ y1, y2, y3, y4 = y
28
+ dy = np.zeros(4)
29
+ dy[0] = -K1 * y1 - K3 * y1 * y3
30
+ dy[1] = K1 * y1 - K2 * y2 * y3
31
+ dy[2] = K1 * y1 - K2 * y2 * y3 - K3 * y1 * y3 + K4 * y4
32
+ dy[3] = K3 * y1 * y3 - K4 * y4
33
+ return dy
34
+
35
+ # -------------------------
36
+ # 3. Initial conditions and time
37
+ # -------------------------
38
+ y0 = [0.00176, 0, 0, 0]
39
+ t_start = 0.0
40
+ t_end = 1e6
41
+ t_step = 2.5e3
42
+
43
+ # Ensure t_eval is within t_span
44
+ n_points = int(np.ceil((t_end - t_start) / t_step)) + 1
45
+ t_eval = np.linspace(t_start, t_end, n_points)
46
+
47
+ # -------------------------
48
+ # 4. Solve ODE
49
+ # -------------------------
50
+ sol = solve_ivp(
51
+ e5,
52
+ (t_start, t_end),
53
+ y0,
54
+ method=METHOD,
55
+ t_eval=t_eval,
56
+ rtol=1e-6,
57
+ atol=1e-6
58
+ )
59
+
60
+ print("Success:", sol.success)
61
+ print("Message:", sol.message)
62
+
63
+ # -------------------------
64
+ # 5. Save solution to CSV
65
+ # -------------------------
66
+ data = np.column_stack((sol.t, sol.y.T))
67
+ col_names = ['t', 'y1', 'y2', 'y3', 'y4']
68
+
69
+ df = pd.DataFrame(data, columns=col_names)
70
+ filename = f"E5-using-{METHOD}.csv"
71
+ df.to_csv(filename, index=False)
72
+
73
+ print(f"Solution saved to '{filename}'")
74
+ </code><button type="button">Copy</button></pre>
75
+
76
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L421">src/examples/print-benchmark.ts:421</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printHires | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printHires</a></li></ul><h1>Function printHires</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printhires"><span class="tsd-kind-call-signature">printHires</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printhires" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the HIRES benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printHires</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printHires</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparison
6
+ import numpy as np
7
+ import pandas as pd
8
+ from scipy.integrate import solve_ivp
9
+
10
+ # -------------------------
11
+ # 0. Solver method
12
+ # -------------------------
13
+ METHOD = "Radau" # stiff solver suitable for HIRES
14
+
15
+ # -------------------------
16
+ # 1. Define HIRES ODE
17
+ # -------------------------
18
+ def hires(t, y):
19
+ y1, y2, y3, y4, y5, y6, y7, y8 = y
20
+ dy = np.zeros(8)
21
+ dy[0] = -1.71 * y1 + 0.43 * y2 + 8.32 * y3 + 0.0007
22
+ dy[1] = 1.71 * y1 - 8.75 * y2
23
+ dy[2] = -10.03 * y3 + 0.43 * y4 + 0.035 * y5
24
+ dy[3] = 8.32 * y2 + 1.71 * y3 - 1.12 * y4
25
+ dy[4] = -1.745 * y5 + 0.43 * y6 + 0.43 * y7
26
+ dy[5] = -280 * y6 * y8 + 0.69 * y4 + 1.71 * y5 - 0.43 * y6 + 0.69 * y7
27
+ dy[6] = 280 * y6 * y8 - 1.81 * y7
28
+ dy[7] = -280 * y6 * y8 + 1.81 * y7
29
+ return dy
30
+
31
+ # -------------------------
32
+ # 2. Initial conditions and time
33
+ # -------------------------
34
+ y0 = [1, 0, 0, 0, 0, 0, 0, 0.0057]
35
+
36
+ t_start = 0.0
37
+ t_end = 321.8122
38
+ t_step = 0.01
39
+ n_points = int(np.ceil((t_end - t_start) / t_step)) + 1
40
+ t_eval = np.linspace(t_start, t_end, n_points)
41
+
42
+ # -------------------------
43
+ # 3. Solve ODE
44
+ # -------------------------
45
+ sol = solve_ivp(
46
+ hires,
47
+ t_span,
48
+ y0,
49
+ method=METHOD,
50
+ t_eval=t_eval,
51
+ rtol=1e-10,
52
+ atol=1e-10
53
+ )
54
+
55
+ print("Success:", sol.success)
56
+ print("Message:", sol.message)
57
+
58
+ # -------------------------
59
+ # 4. Save solution to CSV
60
+ # -------------------------
61
+ # Combine time + concentrations
62
+ data = np.column_stack((sol.t, sol.y.T))
63
+
64
+ # Column names
65
+ col_names = ['t'] + ['y1','y2','y3','y4','y5','y6','y7','y8']
66
+
67
+ # Create DataFrame and save
68
+ df = pd.DataFrame(data, columns=col_names)
69
+ filename = f'HIRES-using-{METHOD}.csv'
70
+ df.to_csv(filename, index=False)
71
+
72
+ print(f"Solution saved to '{filename}'")
73
+
74
+ </code><button type="button">Copy</button></pre>
75
+
76
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L187">src/examples/print-benchmark.ts:187</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printOrego | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printOrego</a></li></ul><h1>Function printOrego</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printorego"><span class="tsd-kind-call-signature">printOrego</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printorego" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the OREGO benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printOrego</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printOrego</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparison
6
+ import numpy as np
7
+ import pandas as pd
8
+ from scipy.integrate import solve_ivp
9
+
10
+ # -------------------------
11
+ # 0. Solver method
12
+ # -------------------------
13
+ METHOD = "Radau" # stiff solver recommended
14
+
15
+ # -------------------------
16
+ # 1. Define OREGO ODE
17
+ # -------------------------
18
+ def orego(t, y):
19
+ y1, y2, y3 = y
20
+ dy1 = 77.27 * (y2 - y1 * y2 + y1 - 0.000008375 * y1**2)
21
+ dy2 = ( -y2 - y1 * y2 + y3 ) / 77.27
22
+ dy3 = 0.161 * (y1 - y3)
23
+ return [dy1, dy2, dy3]
24
+
25
+ # -------------------------
26
+ # 2. Initial conditions and time
27
+ # -------------------------
28
+ y0 = [1, 2, 3]
29
+ t_start = 0.0
30
+ t_end = 360.0
31
+ t_step = 0.01
32
+
33
+ # Use linspace to ensure t_eval within t_span
34
+ n_points = int(np.ceil((t_end - t_start) / t_step)) + 1
35
+ t_eval = np.linspace(t_start, t_end, n_points)
36
+
37
+ # -------------------------
38
+ # 3. Solve ODE
39
+ # -------------------------
40
+ sol = solve_ivp(
41
+ orego,
42
+ (t_start, t_end),
43
+ y0,
44
+ method=METHOD,
45
+ t_eval=t_eval,
46
+ rtol=1e-8,
47
+ atol=1e-8
48
+ )
49
+
50
+ print("Success:", sol.success)
51
+ print("Message:", sol.message)
52
+
53
+ # -------------------------
54
+ # 4. Save solution to CSV
55
+ # -------------------------
56
+ data = np.column_stack((sol.t, sol.y.T))
57
+ col_names = ['t', 'y1', 'y2', 'y3']
58
+
59
+ df = pd.DataFrame(data, columns=col_names)
60
+ filename = f"OREGO-using-{METHOD}.csv"
61
+ df.to_csv(filename, index=False)
62
+
63
+ print(f"Solution saved to '{filename}'")
64
+ </code><button type="button">Copy</button></pre>
65
+
66
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L337">src/examples/print-benchmark.ts:337</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,163 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printPollution | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printPollution</a></li></ul><h1>Function printPollution</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printpollution"><span class="tsd-kind-call-signature">printPollution</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printpollution" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the POLL benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printPollution</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printPollution</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparisonimport numpy as np
6
+ import pandas as pd
7
+ from scipy.integrate import solve_ivp
8
+
9
+ # -------------------------
10
+ # 0. Solver method and tolerance
11
+ # -------------------------
12
+ METHOD = "Radau" # stiff solver
13
+ RTOL = 1e-6
14
+ ATOL = 1e-6
15
+
16
+ # -------------------------
17
+ # 1. Reaction constants
18
+ # -------------------------
19
+ k1 = 0.35
20
+ k2 = 26.6
21
+ k3 = 1.23e4
22
+ k4 = 8.6e-4
23
+ k5 = 8.2e-4
24
+ k6 = 1.5e4
25
+ k7 = 1.3e-4
26
+ k8 = 2.4e4
27
+ k9 = 1.65e4
28
+ k10 = 9e3
29
+ k11 = 0.022
30
+ k12 = 1.2e4
31
+ k13 = 1.88
32
+ k14 = 1.63e4
33
+ k15 = 4.8e6
34
+ k16 = 3.5e-4
35
+ k17 = 0.0175
36
+ k18 = 1e8
37
+ k19 = 4.44e11
38
+ k20 = 1240
39
+ k21 = 2.1
40
+ k22 = 5.78
41
+ k23 = 0.0474
42
+ k24 = 1780
43
+ k25 = 3.12
44
+
45
+ # -------------------------
46
+ # 2. Initial conditions
47
+ # -------------------------
48
+ y0 = [
49
+ 0, # y1 NO2
50
+ 0.2, # y2 NO
51
+ 0, # y3 O3P
52
+ 0.04, # y4 O3
53
+ 0, # y5 HO2
54
+ 0, # y6 OH
55
+ 0.1, # y7 HCHO
56
+ 0.3, # y8 CO
57
+ 0.01, # y9 ALD
58
+ 0, # y10 MEO2
59
+ 0, # y11 C2O3
60
+ 0, # y12 CO2
61
+ 0, # y13 PAN
62
+ 0, # y14 CH3O
63
+ 0, # y15 HNO3
64
+ 0, # y16 O1D
65
+ 0.007, # y17 SO2
66
+ 0, # y18 SO4
67
+ 0, # y19 NO3
68
+ 0 # y20 N2O5
69
+ ]
70
+
71
+ # -------------------------
72
+ # 3. Define POLL ODE system
73
+ # -------------------------
74
+ def poll(t, y):
75
+ y = np.array(y)
76
+ r1 = k1*y[0]
77
+ r2 = k2*y[1]*y[3]
78
+ r3 = k3*y[4]*y[1]
79
+ r4 = k4*y[6]
80
+ r5 = k5*y[6]
81
+ r6 = k6*y[6]*y[5]
82
+ r7 = k7*y[8]
83
+ r8 = k8*y[8]*y[5]
84
+ r9 = k9*y[10]*y[1]
85
+ r10 = k10*y[10]*y[0]
86
+ r11 = k11*y[12]
87
+ r12 = k12*y[9]*y[1]
88
+ r13 = k13*y[13]
89
+ r14 = k14*y[0]*y[5]
90
+ r15 = k15*y[2]
91
+ r16 = k16*y[3]
92
+ r17 = k17*y[3]
93
+ r18 = k18*y[15]
94
+ r19 = k19*y[15]
95
+ r20 = k20*y[16]*y[5]
96
+ r21 = k21*y[18]
97
+ r22 = k22*y[18]
98
+ r23 = k23*y[0]*y[3]
99
+ r24 = k24*y[18]*y[0]
100
+ r25 = k25*y[19]
101
+
102
+ dy = np.zeros(20)
103
+ dy[0] = -(r1 + r10 + r14 + r23 + r24) + (r2 + r3 + r9 + r11 + r12 + r22 + r25)
104
+ dy[1] = -r2 - r3 - r9 - r12 + r1 + r21
105
+ dy[2] = -r15 + r1 + r17 + r19 + r22
106
+ dy[3] = -r2 - r16 - r17 - r23 + r15
107
+ dy[4] = -r3 + 2*r4 + r6 + r7 + r13 + r20
108
+ dy[5] = -r6 - r8 - r14 - r20 + r3 + 2*r18
109
+ dy[6] = -r4 - r5 - r6 + r13
110
+ dy[7] = r4 + r5 + r6 + r7
111
+ dy[8] = -r7 - r8
112
+ dy[9] = -r12 + r7 + r9
113
+ dy[10] = -r9 - r10 + r8 + r11
114
+ dy[11] = r9
115
+ dy[12] = -r11 + r10
116
+ dy[13] = -r13 + r12
117
+ dy[14] = r14
118
+ dy[15] = -r18 - r19 + r16
119
+ dy[16] = -r20
120
+ dy[17] = r20
121
+ dy[18] = -r21 - r22 - r24 + r23 + r25
122
+ dy[19] = -r25 + r24
123
+
124
+ return dy
125
+
126
+ # -------------------------
127
+ # 4. Time array
128
+ # -------------------------
129
+ t_start = 0
130
+ t_end = 60 # final time
131
+ t_step = 0.002
132
+ n_points = int(np.ceil((t_end - t_start)/t_step)) + 1
133
+ t_eval = np.linspace(t_start, t_end, n_points)
134
+
135
+ # -------------------------
136
+ # 5. Solve ODE
137
+ # -------------------------
138
+ sol = solve_ivp(
139
+ poll,
140
+ (t_start, t_end),
141
+ y0,
142
+ method=METHOD,
143
+ t_eval=t_eval,
144
+ rtol=RTOL,
145
+ atol=ATOL
146
+ )
147
+
148
+ print("Success:", sol.success)
149
+ print("Message:", sol.message)
150
+
151
+ # -------------------------
152
+ # 6. Save solution to CSV
153
+ # -------------------------
154
+ col_names = ['t'] + [f'y{i+1}' for i in range(20)]
155
+ data = np.column_stack((sol.t, sol.y.T))
156
+ df = pd.DataFrame(data, columns=col_names)
157
+ filename = f"POLL-using-{METHOD}.csv"
158
+ df.to_csv(filename, index=False)
159
+
160
+ print(f"Solution saved to '{filename}'")
161
+ </code><button type="button">Copy</button></pre>
162
+
163
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L592">src/examples/print-benchmark.ts:592</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,60 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printRobertson | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printRobertson</a></li></ul><h1>Function printRobertson</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printrobertson"><span class="tsd-kind-call-signature">printRobertson</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printrobertson" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the ROBER benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printRobertson</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printRobertson</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparison
6
+ import numpy as np
7
+ import pandas as pd
8
+ from scipy.integrate import solve_ivp
9
+
10
+ METHOD = "Radau" # "BDF" or "LSODA"
11
+
12
+ # -------------------------
13
+ # 1. Define Robertson ODE
14
+ # -------------------------
15
+ def robertson(t, y):
16
+ A, B, C = y
17
+ dA = -0.04 * A + 1e4 * B * C
18
+ dB = 0.04 * A - 1e4 * B * C - 3e7 * B**2
19
+ dC = 3e7 * B**2
20
+ return [dA, dB, dC]
21
+
22
+ # -------------------------
23
+ # 2. Initial conditions
24
+ # -------------------------
25
+ y0 = [1.0, 0.0, 0.0]
26
+ t_start = 0.0
27
+ t_end = 1e11
28
+ t_step = 2.5e6
29
+ t_span = (t_start, t_end)
30
+
31
+ # Output points
32
+ t_eval = np.arange(t_start, t_end + t_step, t_step)
33
+
34
+ # -------------------------
35
+ # 3. Solve ODE
36
+ # -------------------------
37
+ sol = solve_ivp(
38
+ robertson,
39
+ t_span,
40
+ y0,
41
+ method=METHOD,
42
+ t_eval=t_eval,
43
+ rtol=1e-7,
44
+ atol=1e-7
45
+ )
46
+
47
+ print("Success:", sol.success)
48
+ print("Message:", sol.message)
49
+
50
+ # sol.t → time array, sol.y.T → concentrations (n_points, 3)
51
+ data = np.column_stack((sol.t, sol.y.T))
52
+
53
+ # Create DataFrame with headers
54
+ df = pd.DataFrame(data, columns=['time', 'A', 'B', 'C'])
55
+
56
+ # Save to CSV
57
+ df.to_csv(f'ROBER-using-{METHOD}.csv', index=False)
58
+ </code><button type="button">Copy</button></pre>
59
+
60
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L102">src/examples/print-benchmark.ts:102</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>printVdpol | diff-grok - v1.0.10</title><meta name="description" content="Documentation for diff-grok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">diff-grok - v1.0.10</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="" aria-current="page">printVdpol</a></li></ul><h1>Function printVdpol</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="printvdpol"><span class="tsd-kind-call-signature">printVdpol</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#printvdpol" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Print solution of the VDPOL benchmark problem</p>
2
+ </div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link" id="example">Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-3">// TypeScript usage example</span><br/><span class="hl-4">import</span><span class="hl-1"> {</span><span class="hl-5">printVdpol</span><span class="hl-1">} </span><span class="hl-4">from</span><span class="hl-1"> </span><span class="hl-2">&#39;diff-grok&#39;</span><span class="hl-1">;</span><br/><br/><span class="hl-0">printVdpol</span><span class="hl-1">();</span>
3
+ </code><button type="button">Copy</button></pre>
4
+
5
+ <pre><code class="python"># Python reference calculation for comparison
6
+ import numpy as np
7
+ import pandas as pd
8
+ from scipy.integrate import solve_ivp
9
+
10
+ # -------------------------
11
+ # 0. Solver method
12
+ # -------------------------
13
+ METHOD = "Radau" # stiff solver recommended for van der Pol with large mu
14
+
15
+ # -------------------------
16
+ # 1. Define van der Pol ODE (stiff)
17
+ # -------------------------
18
+ def vdpol(t, y):
19
+ x1, x2 = y
20
+ dx1 = x2
21
+ dx2 = -x1 + 1000 * (1 - x1**2) * x2 # mu = 1000
22
+ return [dx1, dx2]
23
+
24
+ # -------------------------
25
+ # 2. Initial conditions and time
26
+ # -------------------------
27
+ y0 = [-1, 1]
28
+ t_start = 0.0
29
+ t_end = 2000.0
30
+ t_step = 0.1
31
+
32
+ # Use linspace to avoid "t_eval not in t_span" error
33
+ n_points = int(np.ceil((t_end - t_start) / t_step)) + 1
34
+ t_eval = np.linspace(t_start, t_end, n_points)
35
+
36
+ # -------------------------
37
+ # 3. Solve ODE
38
+ # -------------------------
39
+ sol = solve_ivp(
40
+ vdpol,
41
+ (t_start, t_end),
42
+ y0,
43
+ method=METHOD,
44
+ t_eval=t_eval,
45
+ rtol=1e-12,
46
+ atol=1e-12
47
+ )
48
+
49
+ print("Success:", sol.success)
50
+ print("Message:", sol.message)
51
+
52
+ # -------------------------
53
+ # 4. Save solution to CSV
54
+ # -------------------------
55
+ data = np.column_stack((sol.t, sol.y.T))
56
+ col_names = ['t', 'x1', 'x2']
57
+
58
+ df = pd.DataFrame(data, columns=col_names)
59
+ filename = f"VANDERPOL-using-{METHOD}.csv"
60
+ df.to_csv(filename, index=False)
61
+
62
+ print(f"Solution saved to '{filename}'")
63
+
64
+ </code><button type="button">Copy</button></pre>
65
+
66
+ </div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/datagrok-ai/DiffGrok/blob/3c67f17fb9b88f69647e701ac86a3b861345124e/src/examples/print-benchmark.ts#L262">src/examples/print-benchmark.ts:262</a></li></ul></aside></div></li></ul></section></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">diff-grok - v1.0.10</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>