Skip to content

Commit f55efb5

Browse files
eric-wieserutensil
authored andcommitted
Use a substitution that sympy 1.3.0 understands (#169)
The original substitution does not seem to work in sympy 1.3.0, but works in 1.5.0. The modified one is equivalent, but works in both versions. A direct substitution is easier to understand here anyway. Part of the work to migrate to a newer sympy
1 parent f5da64f commit f55efb5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

examples/LaTeX/latex_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def noneuclidian_distance_calculation():
231231
W = W.subs(c**2,(C+1)/2)
232232
W = W.subs(s**2,(C-1)/2)
233233
W = simplify(W)
234-
W = W.subs(1/Binv,Bmag)
234+
W = W.subs(Binv,1/Bmag)
235235
W = expand(W)
236236

237237
print('#%S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha}')

examples/Old Format/latex_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def noneuclidian_distance_calculation():
219219
W = W.subs(c**2,(C+1)/2)
220220
W = W.subs(s**2,(C-1)/2)
221221
W = simplify(W)
222-
W = W.subs(1/Binv,Bmag)
222+
W = W.subs(Binv,1/Bmag)
223223
W = expand(W)
224224

225225
print('#%S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha}')

examples/ipython/LaTeX.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@
11311131
" W = W.subs(c**2,(C+1)/2)\n",
11321132
" W = W.subs(s**2,(C-1)/2)\n",
11331133
" W = simplify(W)\n",
1134-
" W = W.subs(1/Binv,Bmag)\n",
1134+
" W = W.subs(Binv,1/Bmag)\n",
11351135
" W = expand(W)\n",
11361136
" print('#%S = \\\\f{\\\\sinh}{\\\\alpha} \\\\text{ and } C = \\\\f{\\\\cosh}{\\\\alpha}')\n",
11371137
" print('W =',W)\n",
@@ -1179,9 +1179,9 @@
11791179
"\\begin{equation*} e^{\\alpha B/{2\\abs{B}}} = c + (1/B) s \\boldsymbol{X}\\wedge \\boldsymbol{Y} - (1/B) \\left ( Y\\cdot e\\right ) s \\boldsymbol{X}\\wedge \\boldsymbol{e} + (1/B) \\left ( X\\cdot e\\right ) s \\boldsymbol{Y}\\wedge \\boldsymbol{e} \\end{equation*}\n",
11801180
"\\begin{equation*} W = Z\\cdot Y = (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{3} s^{2} - 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) ^{2} \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) s^{2} + 4 (1/B)^{2} \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) ^{2} \\left ( Y\\cdot e\\right ) ^{2} s^{2} + 2 (1/B) \\left ( X\\cdot Y\\right ) ^{2} c s - 4 (1/B) \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) c s + \\left ( X\\cdot Y\\right ) c^{2} \\end{equation*}\n",
11811181
"\\begin{equation*} S = \\f{\\sinh}{\\alpha} \\text{ and } C = \\f{\\cosh}{\\alpha} \\end{equation*}\n",
1182-
"\\begin{equation*} W = (1/B) \\left ( X\\cdot Y\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
1183-
"\\begin{equation*} \\text{Scalar Coefficient} = (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
1184-
"\\begin{equation*} \\text{Cosh Coefficient} = (1/B) \\left ( X\\cdot Y\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } - (1/B) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
1182+
"\\begin{equation*} W = \\left ( X\\cdot Y\\right ) C - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) C + \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) + S \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
1183+
"\\begin{equation*} \\text{Scalar Coefficient} = \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\end{equation*}\n",
1184+
"\\begin{equation*} \\text{Cosh Coefficient} = \\left ( X\\cdot Y\\right ) - \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) \\end{equation*}\n",
11851185
"\\begin{equation*} \\text{Sinh Coefficient} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
11861186
"\\begin{equation*} \\abs{B} = \\sqrt{\\left ( X\\cdot Y\\right ) ^{2} - 2 \\left ( X\\cdot Y\\right ) \\left ( X\\cdot e\\right ) \\left ( Y\\cdot e\\right ) } \\end{equation*}\n",
11871187
"\\begin{equation*} \\text{Require } aC^{2}+bC+c = 0 \\end{equation*}\n",

0 commit comments

Comments
 (0)