Skip to content

Commit 99293ff

Browse files
Fix rational issues and Latexify tests
fixes #216
1 parent cf4b9a5 commit 99293ff

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/function_registration.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ end
5454

5555
# special cases
5656
Base.:^(x::Expression,y::T) where T <: Integer = Operation(Base.:^, Expression[x, y])
57+
Base.:^(x::Expression,y::T) where T <: Rational = Operation(Base.:^, Expression[x, y])
5758

5859
@register Base.getindex(x,i)
5960
Base.getindex(x::Operation,i::Int64) = Operation(getindex,[x,i])

test/latexify.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using Latexify
33
using ModelingToolkit
44

55
### Tips for generating latex tests:
6-
### Latexify has an unexported macro:
6+
### Latexify has an unexported macro:
77
###
88
### Latexify.@generate_test
99
###
@@ -15,7 +15,7 @@ using ModelingToolkit
1515
### This puts a ready-made test in your clipboard which you can paste into the
1616
### test file.
1717
###
18-
### Just be sure to remove all such macros before you commit a change since it
18+
### Just be sure to remove all such macros before you commit a change since it
1919
### will cause issues with Travis.
2020

2121
@parameters t σ ρ β
@@ -26,12 +26,10 @@ eqs = [D(x) ~ σ*(y-x)*D(x-y)/D(z),
2626
0 ~ σ*x*-z)/10-y,
2727
D(z) ~ x*y - β*z]
2828

29-
30-
@test latexify(eqs) ==
29+
@test latexify(eqs) ==
3130
raw"\begin{align}
32-
\frac{dx(t)}{dt} =& \frac{\sigma \cdot \left( \mathrm{y}\left( t \right) - \mathrm{x}\left( t \right) \right) \cdot \frac{d\left(\mathrm{x}\left( t \right) - \mathrm{y}\left( t \right)\right)}{dt}}{\frac{dz(t)}{dt}} \\
31+
\mathrm{derivative}\left( \mathrm{x}\left( t \right), t \right) =& \frac{\sigma \cdot \left( \mathrm{y}\left( t \right) - \mathrm{x}\left( t \right) \right) \cdot \mathrm{derivative}\left( \mathrm{x}\left( t \right) - \mathrm{y}\left( t \right), t \right)}{\mathrm{derivative}\left( \mathrm{z}\left( t \right), t \right)} \\
3332
0 =& \frac{\sigma \cdot \mathrm{x}\left( t \right) \cdot \left( \rho - \mathrm{z}\left( t \right) \right)}{10} - \mathrm{y}\left( t \right) \\
34-
\frac{dz(t)}{dt} =& \mathrm{x}\left( t \right) \cdot \mathrm{y}\left( t \right) - \beta \cdot \mathrm{z}\left( t \right)
33+
\mathrm{derivative}\left( \mathrm{z}\left( t \right), t \right) =& \mathrm{x}\left( t \right) \cdot \mathrm{y}\left( t \right) - \beta \cdot \mathrm{z}\left( t \right)
3534
\end{align}
3635
"
37-

0 commit comments

Comments
 (0)