1+ # sage.doctest: needs sage.symbolic
12r"""
23Symbolic minimum and maximum
34
78
89Here you can see some differences::
910
10- sage: max(x, x^2) # needs sage.symbolic
11+ sage: max(x, x^2)
1112 x
12- sage: max_symbolic(x, x^2) # needs sage.symbolic
13+ sage: max_symbolic(x, x^2)
1314 max(x, x^2)
14- sage: f(x) = max_symbolic(x, x^2); f(1/2) # needs sage.symbolic
15+ sage: f(x) = max_symbolic(x, x^2); f(1/2)
1516 1/2
1617
1718This works as expected for more than two entries::
1819
19- sage: # needs sage.symbolic
2020 sage: max(3, 5, x)
2121 5
2222 sage: min(3, 5, x)
@@ -48,7 +48,6 @@ def eval_helper(self, this_f, builtin_f, initial_val, args):
4848 """
4949 EXAMPLES::
5050
51- sage: # needs sage.symbolic
5251 sage: max_symbolic(3, 5, x) # indirect doctest
5352 max(x, 5)
5453 sage: max_symbolic([5.0r]) # indirect doctest
@@ -93,20 +92,20 @@ def __call__(self, *args, **kwds):
9392 """
9493 EXAMPLES::
9594
96- sage: max_symbolic(3, 5, x) # needs sage.symbolic
95+ sage: max_symbolic(3, 5, x)
9796 max(x, 5)
98- sage: max_symbolic(3, 5, x, hold=True) # needs sage.symbolic
97+ sage: max_symbolic(3, 5, x, hold=True)
9998 max(3, 5, x)
100- sage: max_symbolic([3, 5, x]) # needs sage.symbolic
99+ sage: max_symbolic([3, 5, x])
101100 max(x, 5)
102101
103102 ::
104103
105- sage: min_symbolic(3, 5, x) # needs sage.symbolic
104+ sage: min_symbolic(3, 5, x)
106105 min(x, 3)
107- sage: min_symbolic(3, 5, x, hold=True) # needs sage.symbolic
106+ sage: min_symbolic(3, 5, x, hold=True)
108107 min(3, 5, x)
109- sage: min_symbolic([3, 5, x]) # needs sage.symbolic
108+ sage: min_symbolic([3, 5, x])
110109 min(x, 3)
111110
112111 TESTS:
@@ -120,7 +119,6 @@ def __call__(self, *args, **kwds):
120119
121120 Check if a single argument which is not iterable works::
122121
123- sage: # needs sage.symbolic
124122 sage: max_symbolic(None)
125123 Traceback (most recent call last):
126124 ...
@@ -161,13 +159,13 @@ def __init__(self):
161159 r"""
162160 Symbolic `\max` function.
163161
164- The Python builtin :func:`max` function does not work as expected when symbolic
165- expressions are given as arguments. This function delays evaluation
166- until all symbolic arguments are substituted with values.
162+ The Python builtin :func:`max` function does not work as
163+ expected when symbolic expressions are given as
164+ arguments. This function delays evaluation until all symbolic
165+ arguments are substituted with values.
167166
168167 EXAMPLES::
169168
170- sage: # needs sage.symbolic
171169 sage: max_symbolic(3, x)
172170 max(3, x)
173171 sage: max_symbolic(3, x).subs(x=5)
@@ -179,11 +177,11 @@ def __init__(self):
179177
180178 TESTS::
181179
182- sage: loads(dumps(max_symbolic(x, 5))) # needs sage.symbolic
180+ sage: loads(dumps(max_symbolic(x, 5)))
183181 max(x, 5)
184- sage: latex(max_symbolic(x, 5)) # needs sage.symbolic
182+ sage: latex(max_symbolic(x, 5))
185183 \max\left(x, 5\right)
186- sage: max_symbolic(x, 5)._sympy_() # needs sympy sage.symbolic
184+ sage: max_symbolic(x, 5)._sympy_() # needs sympy
187185 Max(5, x)
188186 """
189187 BuiltinFunction .__init__ (self , 'max' , nargs = 0 , latex_name = r"\max" ,
@@ -193,7 +191,6 @@ def _eval_(self, *args):
193191 """
194192 EXAMPLES::
195193
196- sage: # needs sage.symbolic
197194 sage: t = max_symbolic(x, 5); t
198195 max(x, 5)
199196 sage: t.subs(x=3) # indirect doctest
@@ -222,7 +219,6 @@ def _evalf_(self, *args, **kwds):
222219 """
223220 EXAMPLES::
224221
225- sage: # needs sage.symbolic
226222 sage: t = max_symbolic(sin(x), cos(x))
227223 sage: t.subs(x=1).n(200)
228224 0.84147098480789650665250232163029899962256306079837106567275
@@ -239,7 +235,7 @@ def _evalf_(self, *args, **kwds):
239235 We can usually integrate these expressions, but can't
240236 guarantee a symbolic answer in closed form::
241237
242- sage: # long time, needs sage.symbolic
238+ sage: # long time
243239 sage: f = max_symbolic(sin(x), cos(x))
244240 sage: r = integral(f, x, 0, 1)
245241 ...
@@ -263,7 +259,6 @@ def __init__(self):
263259
264260 EXAMPLES::
265261
266- sage: # needs sage.symbolic
267262 sage: min_symbolic(3, x)
268263 min(3, x)
269264 sage: min_symbolic(3, x).subs(x=5)
@@ -275,11 +270,11 @@ def __init__(self):
275270
276271 TESTS::
277272
278- sage: loads(dumps(min_symbolic(x, 5))) # needs sage.symbolic
273+ sage: loads(dumps(min_symbolic(x, 5)))
279274 min(x, 5)
280- sage: latex(min_symbolic(x, 5)) # needs sage.symbolic
275+ sage: latex(min_symbolic(x, 5))
281276 \min\left(x, 5\right)
282- sage: min_symbolic(x, 5)._sympy_() # needs sympy sage.symbolic
277+ sage: min_symbolic(x, 5)._sympy_() # needs sympy
283278 Min(5, x)
284279 """
285280 BuiltinFunction .__init__ (self , 'min' , nargs = 0 , latex_name = r"\min" ,
@@ -289,7 +284,6 @@ def _eval_(self, *args):
289284 """
290285 EXAMPLES::
291286
292- sage: # needs sage.symbolic
293287 sage: t = min_symbolic(x, 5); t
294288 min(x, 5)
295289 sage: t.subs(x=3) # indirect doctest
@@ -318,7 +312,6 @@ def _evalf_(self, *args, **kwds):
318312 """
319313 EXAMPLES::
320314
321- sage: # needs sage.symbolic
322315 sage: t = min_symbolic(sin(x), cos(x))
323316 sage: t.subs(x=1).n(200)
324317 0.54030230586813971740093660744297660373231042061792222767010
0 commit comments