@@ -11,7 +11,10 @@ def test_quadratic_solution() -> None:
1111 def solve (a , b , c ):
1212 return (- b + math .sqrt (b ** 2 - 4 * a * c )) / (2 * a )
1313
14- latex = r"\mathrm{solve}(a, b, c) = \frac{-b + \sqrt{ b^{2} - 4 a c }}{2 a}"
14+ latex = (
15+ r"\mathrm{solve}(a, b, c) ="
16+ r" \frac{-b + \sqrt{ b^{2} - 4 \cdot a \cdot c }}{2 \cdot a}"
17+ )
1518 integration_utils .check_function (solve , latex )
1619
1720
@@ -36,13 +39,15 @@ def test_x_times_beta() -> None:
3639 def xtimesbeta (x , beta ):
3740 return x * beta
3841
39- latex_without_symbols = r"\mathrm{xtimesbeta}(x, \mathrm{beta}) = x \mathrm{beta}"
42+ latex_without_symbols = (
43+ r"\mathrm{xtimesbeta}(x, \mathrm{beta}) = x \cdot \mathrm{beta}"
44+ )
4045 integration_utils .check_function (xtimesbeta , latex_without_symbols )
4146 integration_utils .check_function (
4247 xtimesbeta , latex_without_symbols , use_math_symbols = False
4348 )
4449
45- latex_with_symbols = r"\mathrm{xtimesbeta}(x, \beta) = x \beta"
50+ latex_with_symbols = r"\mathrm{xtimesbeta}(x, \beta) = x \cdot \ beta"
4651 integration_utils .check_function (
4752 xtimesbeta , latex_with_symbols , use_math_symbols = True
4853 )
@@ -64,8 +69,8 @@ def sum_with_limit(a, n):
6469 return sum (i ** 2 for i in range (a , n ))
6570
6671 latex = (
67- r"\mathrm{sum\_with\_limit}(a, n) = \sum_{i = a}^{n - 1} "
68- r"\mathopen{}\left({i^{2}}\mathclose{}\right)"
72+ r"\mathrm{sum\_with\_limit}(a, n) = \sum_{i = a}^{n - 1}"
73+ r" \mathopen{}\left({i^{2}}\mathclose{}\right)"
6974 )
7075 integration_utils .check_function (sum_with_limit , latex )
7176
@@ -75,8 +80,8 @@ def sum_with_limit(n):
7580 return sum (i for i in range (n + 1 ))
7681
7782 latex = (
78- r"\mathrm{sum\_with\_limit}(n) = \sum_{i = 0}^{n} "
79- r"\mathopen{}\left({i}\mathclose{}\right)"
83+ r"\mathrm{sum\_with\_limit}(n) = \sum_{i = 0}^{n}"
84+ r" \mathopen{}\left({i}\mathclose{}\right)"
8085 )
8186 integration_utils .check_function (sum_with_limit , latex )
8287
@@ -86,8 +91,8 @@ def sum_with_limit(n):
8691 return sum (i for i in range (n * 3 ))
8792
8893 latex = (
89- r"\mathrm{sum\_with\_limit}(n) = \sum_{i = 0}^{n 3 - 1} "
90- r"\mathopen{}\left({i}\mathclose{}\right)"
94+ r"\mathrm{sum\_with\_limit}(n) = \sum_{i = 0}^{n \cdot 3 - 1}"
95+ r" \mathopen{}\left({i}\mathclose{}\right)"
9196 )
9297 integration_utils .check_function (sum_with_limit , latex )
9398
@@ -97,8 +102,8 @@ def prod_with_limit(n):
97102 return math .prod (i ** 2 for i in range (n ))
98103
99104 latex = (
100- r"\mathrm{prod\_with\_limit}(n) = "
101- r"\prod_{i = 0}^{n - 1} \mathopen{}\left({i^{2}}\mathclose{}\right)"
105+ r"\mathrm{prod\_with\_limit}(n) ="
106+ r" \prod_{i = 0}^{n - 1} \mathopen{}\left({i^{2}}\mathclose{}\right)"
102107 )
103108 integration_utils .check_function (prod_with_limit , latex )
104109
@@ -108,8 +113,8 @@ def prod_with_limit(a, n):
108113 return math .prod (i ** 2 for i in range (a , n ))
109114
110115 latex = (
111- r"\mathrm{prod\_with\_limit}(a, n) = "
112- r"\prod_{i = a}^{n - 1} \mathopen{}\left({i^{2}}\mathclose{}\right)"
116+ r"\mathrm{prod\_with\_limit}(a, n) ="
117+ r" \prod_{i = a}^{n - 1} \mathopen{}\left({i^{2}}\mathclose{}\right)"
113118 )
114119 integration_utils .check_function (prod_with_limit , latex )
115120
@@ -119,8 +124,8 @@ def prod_with_limit(n):
119124 return math .prod (i for i in range (n - 1 ))
120125
121126 latex = (
122- r"\mathrm{prod\_with\_limit}(n) = "
123- r"\prod_{i = 0}^{n - 2} \mathopen{}\left({i}\mathclose{}\right)"
127+ r"\mathrm{prod\_with\_limit}(n) ="
128+ r" \prod_{i = 0}^{n - 2} \mathopen{}\left({i}\mathclose{}\right)"
124129 )
125130 integration_utils .check_function (prod_with_limit , latex )
126131
@@ -131,7 +136,7 @@ def prod_with_limit(n):
131136
132137 latex = (
133138 r"\mathrm{prod\_with\_limit}(n) = "
134- r"\prod_{i = 0}^{n 3 - 1} \mathopen{}\left({i}\mathclose{}\right)"
139+ r"\prod_{i = 0}^{n \cdot 3 - 1} \mathopen{}\left({i}\mathclose{}\right)"
135140 )
136141 integration_utils .check_function (prod_with_limit , latex )
137142
@@ -140,7 +145,7 @@ def test_nested_function() -> None:
140145 def nested (x ):
141146 return 3 * x
142147
143- integration_utils .check_function (nested , r"\mathrm{nested}(x) = 3 x" )
148+ integration_utils .check_function (nested , r"\mathrm{nested}(x) = 3 \cdot x" )
144149
145150
146151def test_double_nested_function () -> None :
@@ -150,7 +155,7 @@ def inner(y):
150155
151156 return inner
152157
153- integration_utils .check_function (nested (3 ), r"\mathrm{inner}(y) = x y" )
158+ integration_utils .check_function (nested (3 ), r"\mathrm{inner}(y) = x \cdot y" )
154159
155160
156161def test_reduce_assignments () -> None :
@@ -160,11 +165,11 @@ def f(x):
160165
161166 integration_utils .check_function (
162167 f ,
163- r"\begin{array}{l} a = x + x \\ f(x) = 3 a \end{array}" ,
168+ r"\begin{array}{l} a = x + x \\ f(x) = 3 \cdot a \end{array}" ,
164169 )
165170 integration_utils .check_function (
166171 f ,
167- r"f(x) = 3 \mathopen{}\left( x + x \mathclose{}\right)" ,
172+ r"f(x) = 3 \cdot \ mathopen{}\left( x + x \mathclose{}\right)" ,
168173 reduce_assignments = True ,
169174 )
170175
@@ -176,18 +181,18 @@ def f(x):
176181 return 3 * b
177182
178183 latex_without_option = (
179- r"\begin{array}{l} "
180- r"a = x^{2} \\ "
181- r"b = a + a \\ "
182- r"f(x) = 3 b "
183- r"\end{array}"
184+ r"\begin{array}{l}"
185+ r" a = x^{2} \\"
186+ r" b = a + a \\"
187+ r" f(x) = 3 \cdot b "
188+ r" \end{array}"
184189 )
185190
186191 integration_utils .check_function (f , latex_without_option )
187192 integration_utils .check_function (f , latex_without_option , reduce_assignments = False )
188193 integration_utils .check_function (
189194 f ,
190- r"f(x) = 3 \mathopen{}\left( x^{2} + x^{2} \mathclose{}\right)" ,
195+ r"f(x) = 3 \cdot \ mathopen{}\left( x^{2} + x^{2} \mathclose{}\right)" ,
191196 reduce_assignments = True ,
192197 )
193198
@@ -204,12 +209,12 @@ def sigmoid(x):
204209 integration_utils .check_function (
205210 sigmoid ,
206211 (
207- r"\mathrm{sigmoid}(x) = \left\{ \begin{array}{ll} "
208- r"\frac{1}{1 + \exp \mathopen{}\left( -x \mathclose{}\right)}, & "
209- r"\mathrm{if} \ x > 0 \\ "
210- r"\frac{\exp x}{\exp x + 1}, & "
211- r"\mathrm{otherwise} "
212- r"\end{array} \right."
212+ r"\mathrm{sigmoid}(x) = \left\{ \begin{array}{ll}"
213+ r" \frac{1}{1 + \exp \mathopen{}\left( -x \mathclose{}\right)}, &"
214+ r" \mathrm{if} \ x > 0 \\"
215+ r" \frac{\exp x}{\exp x + 1}, &"
216+ r" \mathrm{otherwise}"
217+ r" \end{array} \right."
213218 ),
214219 reduce_assignments = True ,
215220 )
@@ -220,10 +225,10 @@ def solve(a, b):
220225 return ((a + b ) - b ) / (a - b ) - (a + b ) - (a - b ) - (a * b )
221226
222227 latex = (
223- r"\mathrm{solve}(a, b) = "
224- r"\frac{a + b - b}{a - b} - \mathopen{}\left( "
225- r"a + b \mathclose{}\right) - \mathopen{}\left( "
226- r"a - b \mathclose{}\right) - a b"
228+ r"\mathrm{solve}(a, b) ="
229+ r" \frac{a + b - b}{a - b} - \mathopen{}\left("
230+ r" a + b \mathclose{}\right) - \mathopen{}\left("
231+ r" a - b \mathclose{}\right) - a \cdot b"
227232 )
228233 integration_utils .check_function (solve , latex )
229234
0 commit comments