-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy path40679-Update_to_maxima_5.49.patch
More file actions
615 lines (566 loc) · 33 KB
/
40679-Update_to_maxima_5.49.patch
File metadata and controls
615 lines (566 loc) · 33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
diff --git a/src/sage/calculus/calculus.py b/src/sage/calculus/calculus.py
index 270e3c49058..0f64e09e18b 100644
--- a/src/sage/calculus/calculus.py
+++ b/src/sage/calculus/calculus.py
@@ -133,8 +133,8 @@
[x^2 + x 2*x^3]
[ 2 x^2 + x]
sage: e^M
- [ 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x)) 1/2*(x*e^(2*sqrt(x)) - x)*sqrt(x)*e^(x - sqrt(x))]
- [ 1/2*(e^(2*sqrt(x)) - 1)*e^(x - sqrt(x))/x^(3/2) 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x))]
+ [ 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x)) 1/2*x^(3/2)*(e^(2*sqrt(x)) - 1)*e^(x - sqrt(x))]
+ [1/2*(e^(2*sqrt(x)) - 1)*e^(x - sqrt(x))/x^(3/2) 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x))]
Complex exponentiation works, but may require a patched version of
maxima (:issue:`32898`) for now::
@@ -1247,7 +1247,7 @@ def limit(ex, *args, dir=None, taylor=False, algorithm='maxima', **kwargs):
sage: limit(sin(x)/x, x, 0, algorithm='sympy')
1
- sage: limit(sin(x)/x, x, 0, algorithm='giac') # needs sage.libs.giac
+ sage: limit(sin(x)/x, x, 0, algorithm='giac') # needs sage.libs.giac
1
sage: limit(x^x, x, 0, dir='+', algorithm='fricas') # optional - fricas
1
diff --git a/src/sage/calculus/test_sympy.py b/src/sage/calculus/test_sympy.py
index aa084799a10..e081e9674d9 100644
--- a/src/sage/calculus/test_sympy.py
+++ b/src/sage/calculus/test_sympy.py
@@ -63,7 +63,7 @@
sage: diff(tan(x), x)
tan(x)^2 + 1
sage: limit((tan(x+y) - tan(x))/y, y=0)
- cos(x)^(-2)
+ tan(x)^2 + 1
sage: diff(sin(2*x), x, 1)
2*cos(2*x)
sage: diff(sin(2*x), x, 2)
diff --git a/src/sage/calculus/tests.py b/src/sage/calculus/tests.py
index 2879dda115d..abdbbad932e 100644
--- a/src/sage/calculus/tests.py
+++ b/src/sage/calculus/tests.py
@@ -119,7 +119,7 @@
sage: integrate(exp(1-x^2),x)
1/2*sqrt(pi)*erf(x)*e
sage: integrate(sin(x^2),x)
- 1/16*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x) + (I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x) - (I - 1)*sqrt(2)*erf(sqrt(-I)*x) + (I + 1)*sqrt(2)*erf((-1)^(1/4)*x))
+ 1/16*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x) - (I - 1)*sqrt(2)*erf(sqrt(-I)*x) - 2*sqrt(2)*imag_part(erf((-1)^(1/4)*x)) + 2*sqrt(2)*real_part(erf((-1)^(1/4)*x)))
sage: integrate((1-x^2)^n,x) # long time
x*hypergeometric((1/2, -n), (3/2,), x^2*exp_polar(2*I*pi))
diff --git a/src/sage/functions/bessel.py b/src/sage/functions/bessel.py
index db32eebe381..056bceaf49c 100644
--- a/src/sage/functions/bessel.py
+++ b/src/sage/functions/bessel.py
@@ -1864,7 +1864,7 @@ class SphericalHankel1(BuiltinFunction):
sage: spherical_hankel1(3 + 0.2 * I, 3)
0.201654587512037 - 0.531281544239273*I
sage: spherical_hankel1(1, x).simplify()
- -(x + I)*e^(I*x)/x^2
+ -I*(-I*x + 1)*e^(I*x)/x^2
sage: spherical_hankel1(3 + 2 * I, 5 - 0.2 * I)
1.25375216869913 - 0.518011435921789*I
sage: integrate(spherical_hankel1(3, x), x)
@@ -1962,11 +1962,11 @@ class SphericalHankel2(BuiltinFunction):
sage: spherical_hankel2(3 + 0.2 * I, 3)
0.0998874108557565 + 0.479149050937147*I
sage: spherical_hankel2(1, x).simplify()
- -(x - I)*e^(-I*x)/x^2
+ I*(I*x + 1)*e^(-I*x)/x^2
sage: spherical_hankel2(2,i).simplify()
-e
sage: spherical_hankel2(2,x).simplify()
- (-I*x^2 - 3*x + 3*I)*e^(-I*x)/x^3
+ -I*(x^2 - 3*I*x - 3)*e^(-I*x)/x^3
sage: spherical_hankel2(3 + 2*I, 5 - 0.2*I)
0.0217627632692163 + 0.0224001906110906*I
sage: integrate(spherical_hankel2(3, x), x)
diff --git a/src/sage/interfaces/maxima.py b/src/sage/interfaces/maxima.py
index 154a2cc34e0..1eebc46e03a 100644
--- a/src/sage/interfaces/maxima.py
+++ b/src/sage/interfaces/maxima.py
@@ -194,7 +194,7 @@
You can even nicely typeset the solution in latex::
sage: latex(s)
- \left[ \left[ a=-...{{\sqrt{79}\,i-11}\over{4}}... , b={{...\sqrt{79}\,i+9...}\over{4}} , c={{\sqrt{79}\,i+1}\over{10}} \right] , \left[ a={{...\sqrt{79}\,i+11}\over{4}} , b=-...{{\sqrt{79}\,i-9...}\over{4}}... , c=-...{{...\sqrt{79}\,i-1}\over{10}}... \right] \right]
+ \left[ \left[ a=-\left({{\sqrt{79}\,i-11}\over{4}}\right) , b={{\sqrt{79}\,i +9}\over{4}} , c={{\sqrt{79}\,i+1}\over{10}} \right] , \left[ a={{\sqrt{79} \,i+11}\over{4}} , b=-\left({{\sqrt{79}\,i-9}\over{4}}\right) , c=-\left({{ \sqrt{79}\,i-1}\over{10}}\right) \right] \right]
To have the above appear onscreen via ``xdvi``, type
``view(s)``. (TODO: For OS X should create pdf output
@@ -216,11 +216,11 @@
::
sage: f = maxima('x^3 * %e^(k*x) * sin(w*x)'); f
- x^3*%e^(k*x)*sin(w*x)
+ %e^(k*x)*x^3*sin(w*x)
sage: f.diff('x')
- k*x^3*%e^(k*x)*sin(w*x)+3*x^2*%e^(k*x)*sin(w*x)+w*x^3*%e^(k*x) *cos(w*x)
+ %e^(k*x)*k*x^3*sin(w*x)+3*%e^(k*x)*x^2*sin(w*x)+%e^(k*x)*w*x^3 *cos(w*x)
sage: f.integrate('x')
- (((k*w^6+3*k^3*w^4+3*k^5*w^2+k^7)*x^3 +(3*w^6+3*k^2*w^4-3*k^4*w^2-3*k^6)*x^2+(...-...18*k*w^4)-12*k^3*w^2+6*k^5)*x-6*w^4 +36*k^2*w^2-6*k^4) *%e^(k*x)*sin(w*x) +((...-w^7...-3*k^2*w^5-3*k^4*w^3-k^6*w)*x^3...+(6*k*w^5+12*k^3*w^3+6*k^5*w)*x^2...+(6*w^5-12*k^2*w^3-18*k^4*w)*x-24*k*w^3 +24*k^3*w) *%e^(k*x)*cos(w*x)) /(w^8+4*k^2*w^6+6*k^4*w^4+4*k^6*w^2+k^8)
+ (((%e^(k*x)*k*w^6+3*%e^(k*x)*k^3*w^4+3*%e^(k*x)*k^5*w^2+%e^(k*x)*k^7)*x ^3 +(3*%e^(k*x)*w^6+3*%e^(k*x)*k^2*w^4-3*%e^(k*x)*k^4*w^2-3*%e^(k*x)*k^6)*x^2 +(-(18*%e^(k*x)*k*w^4)-12*%e^(k*x)*k^3*w^2+6*%e^(k*x)*k^5)*x-6*%e^(k*x)*w^4 +36*%e^(k*x)*k^2*w^2-6*%e^(k*x)*k^4) *sin(w*x) +((-(%e^(k*x)*w^7)-3*%e^(k*x)*k^2*w^5-3*%e^(k*x)*k^4*w^3-%e^(k*x)*k^6*w)*x^3 +(6*%e^(k*x)*k*w^5+12*%e^(k*x)*k^3*w^3+6*%e^(k*x)*k^5*w)*x^2 +(6*%e^(k*x)*w^5-12*%e^(k*x)*k^2*w^3-18*%e^(k*x)*k^4*w)*x-24*%e^(k*x)*k*w^3 +24*%e^(k*x)*k^3*w) *cos(w*x)) /(w^8+4*k^2*w^6+6*k^4*w^4+4*k^6*w^2+k^8)
::
@@ -291,13 +291,14 @@
sage: _ = maxima.eval("f(t) := t^5*exp(t)*sin(t)")
sage: maxima("laplace(f(t),t,s)")
- (360*(2*s-2))/(s^2-2*s+2)^4-(480*(2*s-2)^3)/(s^2-2*s+2)^5 +(120*(2*s-2)^5)/(s^2-2*s+2)^6
+ (720*s^5-3600*s^4+4800*s^3-2880*s+960) /(s^12-12*s^11+72*s^10-280*s^9+780*s^8-1632*s^7+2624*s^6-3264*s^5+3120*s^4 -2240*s^3+1152*s^2-384*s+64)
sage: print(maxima("laplace(f(t),t,s)"))
- 3 5
- 360 (2 s - 2) 480 (2 s - 2) 120 (2 s - 2)
- --------------- - --------------- + ---------------
- 2 4 2 5 2 6
- (s - 2 s + 2) (s - 2 s + 2) (s - 2 s + 2)
+ 5 4 3
+ (720 s - 3600 s + 4800 s - 2880 s + 960)
+ 12 11 10 9 8 7 6 5
+ /(s - 12 s + 72 s - 280 s + 780 s - 1632 s + 2624 s - 3264 s
+ 4 3 2
+ + 3120 s - 2240 s + 1152 s - 384 s + 64)
::
@@ -363,11 +364,11 @@
sage: S = maxima('nusum(exp(1+2*i/n),i,1,n)')
sage: print(S)
- 2/n + 3 2/n + 1
- %e %e
- ----------------------- - -----------------------
- 1/n 1/n 1/n 1/n
- (%e - 1) (%e + 1) (%e - 1) (%e + 1)
+ 2/n + 3 2/n + 1
+ %e %e
+ ─────────────────────── - ───────────────────────
+ 1/n 1/n 1/n 1/n
+ (%e - 1) (%e + 1) (%e - 1) (%e + 1)
We formally compute the limit as `n\to\infty` of
`2S/n` as follows::
@@ -418,7 +419,7 @@
sage: from sage.interfaces.maxima import maxima
sage: g = maxima('exp(3*%i*x)/(6*%i) + exp(%i*x)/(2*%i) + c')
sage: latex(g)
- -...{{i\,e^{3\,i\,x}}\over{6}}...-{{i\,e^{i\,x}}\over{2}}+c
+ c-{{e^{3\,i\,x}\,i}\over{6}}-{{e^{i\,x}\,i}\over{2}}
Long Input
----------
diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py
index 5866b955bb0..e7c1da2a277 100644
--- a/src/sage/interfaces/maxima_abstract.py
+++ b/src/sage/interfaces/maxima_abstract.py
@@ -866,11 +866,11 @@ def de_solve(self, de, vars, ics=None):
sage: maxima.de_solve('diff(y,x,2) + 3*x = y', ['x','y'], [1,1,1])
y = 3*x-2*%e^(x-1)
sage: maxima.de_solve('diff(y,x,2) + 3*x = y', ['x','y'])
- y = %k1*%e^x+%k2*%e^-x+3*x
+ y = 3*x+%e^-x*%k2+%e^x*%k1
sage: maxima.de_solve('diff(y,x) + 3*x = y', ['x','y'])
- y = (%c-3*(...-x...-1)*%e^-x)*%e^x
+ y = %e^x*(%c-3*%e^-x*(-x-1))
sage: maxima.de_solve('diff(y,x) + 3*x = y', ['x','y'],[1,1])
- y = -...%e^-1*(5*%e^x-3*%e*x-3*%e)...
+ y = %e^-1*(3*%e*x-5*%e^x+3*%e)
"""
if not isinstance(vars, str):
str_vars = '%s, %s' % (vars[1], vars[0])
@@ -910,20 +910,20 @@ def de_solve_laplace(self, de, vars, ics=None):
sage: from sage.interfaces.maxima_lib import maxima
sage: maxima.clear('x'); maxima.clear('f')
sage: maxima.de_solve_laplace("diff(f(x),x,2) = 2*diff(f(x),x)-f(x)", ["x","f"], [0,1,2])
- f(x) = x*%e^x+%e^x
+ f(x) = %e^x*x+%e^x
::
sage: maxima.clear('x'); maxima.clear('f')
sage: f = maxima.de_solve_laplace("diff(f(x),x,2) = 2*diff(f(x),x)-f(x)", ["x","f"])
sage: f
- f(x) = x*%e^x*('at('diff(f(x),x,1),x = 0))-f(0)*x*%e^x+f(0)*%e^x
+ f(x) = %e^x*x*('at('diff(f(x),x,1),x = 0))-%e^x*f(0)*x+%e^x*f(0)
sage: print(f)
- !
- x d ! x x
- f(x) = x %e (-- (f(x))! ) - f(0) x %e + f(0) %e
- dx !
- !x = 0
+ │
+ x d │ x x
+ f(x) = %e x (── (f(x))│ ) - %e f(0) x + %e f(0)
+ dx │
+ │x = 0
.. NOTE::
@@ -1136,10 +1136,10 @@ def __str__(self):
sage: f = maxima('1/(x-1)^3'); f
1/(x-1)^3
sage: print(f)
- 1
- --------
- 3
- (x - 1)
+ 1
+ ────────
+ 3
+ (x - 1)
"""
return self.display2d(onscreen=False)
@@ -1798,9 +1798,9 @@ def _latex_(self):
sage: y,d = var('y,d')
sage: f = function('f')
sage: latex(maxima(derivative(f(x*y), x)))
- \left(\left.{{{\it \partial}}\over{{\it \partial}\, {\it \_symbol}_{0}}}\,f\left( {\it \_symbol}_{0}\right)\right|_{ {\it \_symbol}_{0}={\it x}\, {\it y}}\right)\,{\it y}
+ \left(\left.{{{\it \partial}}\over{{\it \partial}\, {\it \_symbol}_{0}}}\,f\left({\it \_symbol}_{0} \right)\right|_{{\it \_symbol}_{0}={\it x}\, {\it y}}\right)\,{\it y}
sage: latex(maxima(derivative(f(x,y,d), d,x,x,y)))
- {{{\it \partial}^4}\over{{\it \partial}\,{\it d}\, {\it \partial}\,{\it x}^2\,{\it \partial}\, {\it y}}}\,f\left({\it x} , {\it y} , {\it d}\right)
+ {{{\it \partial}^4}\over{{\it \partial}\,{\it d}\, {\it \partial}\,{\it x}^2\,{\it \partial}\,{\it y} }}\,f\left({\it x} , {\it y} , {\it d} \right)
sage: latex(maxima(d/(d-2)))
{{{\it d}}\over{{\it d}-2}}
"""
@@ -1929,9 +1929,9 @@ def partial_fraction_decomposition(self, var='x'):
sage: f.partial_fraction_decomposition('x')
1/(2*(x-1))-1/(2*(x+1))
sage: print(f.partial_fraction_decomposition('x'))
- 1 1
- --------- - ---------
- 2 (x - 1) 2 (x + 1)
+ 1 1
+ ───────── - ─────────
+ 2 (x - 1) 2 (x + 1)
"""
return self.partfrac(var)
diff --git a/src/sage/interfaces/maxima_lib.py b/src/sage/interfaces/maxima_lib.py
index 637ef29a6f2..fff2a6ee39c 100644
--- a/src/sage/interfaces/maxima_lib.py
+++ b/src/sage/interfaces/maxima_lib.py
@@ -164,7 +164,7 @@
ecl_eval("(setq $nolabels t))")
ecl_eval("(defun add-lineinfo (x) x)")
ecl_eval(r"(defun tex-derivative (x l r) (tex (if $derivabbrev (tex-dabbrev x) (tex-d x '\\partial)) l r lop rop ))")
-ecl_eval('(defun principal nil (cond ($noprincipal (diverg)) ((not pcprntd) (merror "Divergent Integral"))))')
+ecl_eval('(defun principal nil (cond ($noprincipal (diverg)) ((not *pcprntd*) (merror "Divergent Integral"))))')
ecl_eval("(remprop 'mfactorial 'grind)") # don't use ! for factorials (#11539)
ecl_eval("(setf $errormsg nil)")
@@ -1224,6 +1224,8 @@ def reduce_load_MaximaLib():
sage.functions.error.erf: "%ERF",
sage.functions.gamma.gamma_inc: "%GAMMA_INCOMPLETE",
sage.functions.other.conjugate: "$CONJUGATE",
+ sage.functions.other.imag_part: "%IMAGPART",
+ sage.functions.other.real_part: "%REALPART",
}
# we compile the dictionary
sage_op_dict = {k: EclObject(sage_op_dict[k]) for k in sage_op_dict}
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 7232f0c4ddb..1240fe5ad83 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -3761,7 +3761,7 @@ def set_inverse(self, *transformations, **kwds):
sage: spher_to_cart.set_inverse(sqrt(x^2+y^2), atan2(y,x))
Check of the inverse coordinate transformation:
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
x == x *passed*
y == y *passed*
NB: a failed report can reflect a mere lack of simplification.
@@ -3798,8 +3798,8 @@ def set_inverse(self, *transformations, **kwds):
sage: spher_to_cart.set_inverse(sqrt(x^3+y^2), atan2(y,x))
Check of the inverse coordinate transformation:
- r == sqrt(r*cos(ph)^3 + sin(ph)^2)*r **failed**
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ r == r*sqrt(abs(r*cos(ph)^3 + sin(ph)^2)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
x == sqrt(x^3 + y^2)*x/sqrt(x^2 + y^2) **failed**
y == sqrt(x^3 + y^2)*y/sqrt(x^2 + y^2) **failed**
NB: a failed report can reflect a mere lack of simplification.
diff --git a/src/sage/manifolds/continuous_map.py b/src/sage/manifolds/continuous_map.py
index e673f0ced6d..bd9db2f3e2b 100644
--- a/src/sage/manifolds/continuous_map.py
+++ b/src/sage/manifolds/continuous_map.py
@@ -1578,7 +1578,7 @@ def expr(self, chart1=None, chart2=None):
sage: ch_spher_cart.set_inverse(sqrt(x^2+y^2), atan2(y,x))
Check of the inverse coordinate transformation:
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
x == x *passed*
y == y *passed*
NB: a failed report can reflect a mere lack of simplification.
@@ -1627,7 +1627,7 @@ def set_expr(self, chart1, chart2, coord_functions):
x == x *passed*
y == y *passed*
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
NB: a failed report can reflect a mere lack of simplification.
sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
....: name='R')
@@ -1681,7 +1681,7 @@ def set_expr(self, chart1, chart2, coord_functions):
x == x *passed*
y == y *passed*
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
NB: a failed report can reflect a mere lack of simplification.
sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
....: name='R')
@@ -1770,7 +1770,7 @@ def add_expr(self, chart1, chart2, coord_functions):
x == x *passed*
y == y *passed*
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
NB: a failed report can reflect a mere lack of simplification.
sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
....: name='R')
@@ -1784,7 +1784,7 @@ def add_expr(self, chart1, chart2, coord_functions):
sage: rot.display(c_spher, c_spher)
R: U → U
- (r, ph) ↦ (r, arctan2(1/2*(sqrt(3)*cos(ph) + sin(ph))*r, -1/2*(sqrt(3)*sin(ph) - cos(ph))*r))
+ (r, ph) ↦ (r, arctan2(1/2*sqrt(3)*cos(ph) + 1/2*sin(ph), -1/2*sqrt(3)*sin(ph) + 1/2*cos(ph)))
Therefore, we use the method :meth:`add_expr` to set the
spherical-coordinate expression by hand::
diff --git a/src/sage/manifolds/differentiable/automorphismfield_group.py b/src/sage/manifolds/differentiable/automorphismfield_group.py
index 45a2fad087a..11a548a0317 100644
--- a/src/sage/manifolds/differentiable/automorphismfield_group.py
+++ b/src/sage/manifolds/differentiable/automorphismfield_group.py
@@ -535,8 +535,7 @@ class AutomorphismFieldParalGroup(FreeModuleLinearGroup):
Field of tangent-space automorphisms t^(-1) on the 2-dimensional
differentiable manifold M
sage: (t1^(-1)).display()
- t^(-1) = 1/(e^y + 1) ∂/∂x⊗dx - x*y/(x^2 + (x^2 + 1)*e^y + 1) ∂/∂x⊗dy
- + 1/(x^2 + 1) ∂/∂y⊗dy
+ t^(-1) = 1/(e^y + 1) ∂/∂x⊗dx - x*y/(x^2*(e^y + 1) + e^y + 1) ∂/∂x⊗dy + 1/(x^2 + 1) ∂/∂y⊗dy
Since any automorphism field can be considered as a tensor field of
type-`(1,1)` on ``M``, there is a coercion map from ``G`` to the
diff --git a/src/sage/manifolds/differentiable/curve.py b/src/sage/manifolds/differentiable/curve.py
index 8a1cfc2e77e..9c1d518acc3 100644
--- a/src/sage/manifolds/differentiable/curve.py
+++ b/src/sage/manifolds/differentiable/curve.py
@@ -466,7 +466,7 @@ def coord_expr(self, chart=None):
x == x *passed*
y == y *passed*
r == r *passed*
- ph == arctan2(r*sin(ph), r*cos(ph)) **failed**
+ ph == -2*pi*ceil(-1/2*(pi - ph)/pi) + ph **failed**
NB: a failed report can reflect a mere lack of simplification.
sage: R.<t> = manifolds.RealLine()
sage: c = U.curve({c_spher: (1,t)}, (t, 0, 2*pi), name='c')
diff --git a/src/sage/manifolds/differentiable/metric.py b/src/sage/manifolds/differentiable/metric.py
index 01b48ef9724..43758ba7e73 100644
--- a/src/sage/manifolds/differentiable/metric.py
+++ b/src/sage/manifolds/differentiable/metric.py
@@ -1556,9 +1556,9 @@ def sqrt_abs_det(self, frame=None):
[ 1/8*u^2 - 1/8*v^2 + 1/4*v + 1/2 1/4*u]
[ 1/4*u -1/8*u^2 + 1/8*v^2 + 1/4*v + 1/2]
sage: g.sqrt_abs_det(Y.frame()).expr()
- 1/2*sqrt(-x^2*y^2 - (x + 1)*y + x + 1)
+ 1/2*sqrt(abs(x^2*y^2 + (x + 1)*y - x - 1))
sage: g.sqrt_abs_det(Y.frame()).expr(Y)
- 1/8*sqrt(-u^4 - v^4 + 2*(u^2 + 2)*v^2 - 4*u^2 + 16*v + 16)
+ 1/8*sqrt(abs(u^4 + v^4 - 2*(u^2 + 2)*v^2 + 4*u^2 - 16*v - 16))
A chart can be passed instead of a frame::
@@ -1578,9 +1578,9 @@ def sqrt_abs_det(self, frame=None):
sage: g.sqrt_abs_det().expr()
sqrt(-x**2*y**2 - x*y + x - y + 1)
sage: g.sqrt_abs_det(Y.frame()).expr()
- sqrt(-x**2*y**2 - x*y + x - y + 1)/2
+ sqrt(Abs(x**2*y**2 + x*y - x + y - 1))/2
sage: g.sqrt_abs_det(Y.frame()).expr(Y)
- sqrt(-u**4 + 2*u**2*v**2 - 4*u**2 - v**4 + 4*v**2 + 16*v + 16)/8
+ sqrt(Abs(-u**4 + 2*u**2*v**2 - 4*u**2 - v**4 + 4*v**2 + 16*v + 16))/8
"""
dom = self._domain
if frame is None:
diff --git a/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py b/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py
index 57dc1c99862..e7c7aaebeea 100644
--- a/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py
+++ b/src/sage/manifolds/differentiable/pseudo_riemannian_submanifold.py
@@ -819,8 +819,7 @@ def normal(self):
....: atan2(-y,-x)+pi)
Check of the inverse coordinate transformation:
the == 2*arctan(sqrt(-cos(the) + 1)/sqrt(cos(the) + 1)) **failed**
- phi == pi + arctan2(sin(phi)*sin(the)/(cos(the) - 1),
- cos(phi)*sin(the)/(cos(the) - 1)) **failed**
+ phi == pi + arctan2(cos(the)*sin(phi) - sin(phi), cos(phi)*cos(the) - cos(phi)) **failed**
x == x *passed*
y == y *passed*
NB: a failed report can reflect a mere lack of simplification.
diff --git a/src/sage/manifolds/utilities.py b/src/sage/manifolds/utilities.py
index b1eed3b8b2e..57b35bef6cc 100644
--- a/src/sage/manifolds/utilities.py
+++ b/src/sage/manifolds/utilities.py
@@ -225,10 +225,10 @@ class SimplifyAbsTrig(ExpressionTreeWalker):
sage: a = abs(cos(x)) + abs(sin(x))
The method :meth:`~sage.symbolic.expression.Expression.simplify_full()`
- is ineffective on such an expression::
+ works on such an expression::
sage: a.simplify_full()
- abs(cos(x)) + abs(sin(x))
+ -cos(x) + sin(x)
We construct a :class:`SimplifyAbsTrig` object ``s`` from the symbolic
expression ``a``::
@@ -436,9 +436,9 @@ def simplify_abs_trig(expr):
sage: s = abs(sin(x)) + abs(sin(y)) + abs(sin(3*z))
sage: s.simplify_trig()
- abs(4*cos(-z)^2 - 1)*abs(sin(-z)) + abs(sin(x)) + abs(sin(y))
+ -4*sin(-z)^3 + abs(sin(x)) + sin(y) + 3*sin(-z)
sage: s.simplify_full()
- abs(4*cos(-z)^2 - 1)*abs(sin(-z)) + abs(sin(x)) + abs(sin(y))
+ -4*sin(-z)^3 + abs(sin(x)) + sin(y) + 3*sin(-z)
despite the following assumptions hold::
@@ -571,10 +571,10 @@ def simplify_chain_real(expr):
sage: s = abs(sin(pi*x))
sage: simplify_chain_real(s) # correct output since x in (0,1)
sin(pi*x)
- sage: s.simplify_real() # unsimplified output
- abs(sin(pi*x))
- sage: s.simplify_full() # unsimplified output
- abs(sin(pi*x))
+ sage: s.simplify_real() # simplified output with maxima>=5.48
+ sin(pi*x)
+ sage: s.simplify_full() # simplified output with maxima>=5.48
+ sin(pi*x)
::
diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx
index 7ff5a3a95bc..6c057a23bbe 100644
--- a/src/sage/matrix/matrix2.pyx
+++ b/src/sage/matrix/matrix2.pyx
@@ -16669,8 +16669,8 @@ cdef class Matrix(Matrix1):
sage: # needs sage.symbolic
sage: a = matrix([[1,2], [3,4]])
sage: a.exp()
- [-1/22*((sqrt(33) - 11)*e^sqrt(33) - sqrt(33) - 11)*e^(-1/2*sqrt(33) + 5/2) 2/33*(sqrt(33)*e^sqrt(33) - sqrt(33))*e^(-1/2*sqrt(33) + 5/2)]
- [ 1/11*(sqrt(33)*e^sqrt(33) - sqrt(33))*e^(-1/2*sqrt(33) + 5/2) 1/22*((sqrt(33) + 11)*e^sqrt(33) - sqrt(33) + 11)*e^(-1/2*sqrt(33) + 5/2)]
+ [ 1/22*((sqrt(33) + 11)*e^2 - (sqrt(33) - 11)*e^(sqrt(33) + 2))*e^(-1/2*sqrt(33) + 1/2) -2/33*(sqrt(33)*e^2 - sqrt(33)*e^(sqrt(33) + 2))*e^(-1/2*sqrt(33) + 1/2)]
+ [ -1/11*(sqrt(33)*e^2 - sqrt(33)*e^(sqrt(33) + 2))*e^(-1/2*sqrt(33) + 1/2) -1/22*((sqrt(33) - 11)*e^2 - (sqrt(33) + 11)*e^(sqrt(33) + 2))*e^(-1/2*sqrt(33) + 1/2)]
sage: type(a.exp()) # needs sage.symbolic
<class 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
diff --git a/src/sage/misc/functional.py b/src/sage/misc/functional.py
index 65a35b45a53..74ecc2198a6 100644
--- a/src/sage/misc/functional.py
+++ b/src/sage/misc/functional.py
@@ -721,9 +721,7 @@ def integral(x, *args, **kwds):
real
sage: f = exp(-x) * sinh(sqrt(x))
sage: t = integrate(f, x, 0, Infinity); t # long time
- 1/4*sqrt(pi)*(erf(1) - 1)*e^(1/4)
- - 1/4*(sqrt(pi)*(erf(1) - 1) - sqrt(pi) + 2*e^(-1) - 2)*e^(1/4)
- + 1/4*sqrt(pi)*e^(1/4) - 1/2*e^(1/4) + 1/2*e^(-3/4)
+ 1/2*sqrt(pi)*e^(1/4)
sage: t.canonicalize_radical() # long time
1/2*sqrt(pi)*e^(1/4)
sage: sage.calculus.calculus.maxima('domain: complex')
@@ -932,7 +930,7 @@ def krull_dimension(x):
0
sage: ZZ.krull_dimension()
1
- sage: ZZ[sqrt(5)].krull_dimension() # needs sage.rings.number_field sage.symbolic
+ sage: ZZ[sqrt(5)].krull_dimension() # needs sage.rings.number_field sage.symbolic
1
sage: U.<x,y,z> = PolynomialRing(ZZ, 3); U
Multivariate Polynomial Ring in x, y, z over Integer Ring
diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index 691acf2c947..07b191522c9 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -13019,21 +13019,21 @@ cdef class Expression(Expression_abc):
Check that the sum in :issue:`10682` is done right::
sage: sum(binomial(n,k)*k^2, k, 2, n)
- 1/4*(n^2 + n)*2^n - n
+ 1/4*2^n*n^2 + 1/4*(2^n - 4)*n
This sum used to give a wrong result (:issue:`9635`) but
now gives correct results with all relevant assumptions::
sage: (n,k,j)=var('n,k,j')
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -sum((-1)^(-j + k)*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: assume(j>-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
1
sage: forget()
sage: assume(n>=j)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -sum((-1)^(-j + k)*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: forget()
sage: assume(j==-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
@@ -13041,7 +13041,7 @@ cdef class Expression(Expression_abc):
sage: forget()
sage: assume(j<-1)
sage: sum(binomial(n,k)*binomial(k-1,j)*(-1)**(k-1-j),k,j+1,n)
- -(-1)^j*sum((-1)^k*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
+ -sum((-1)^(-j + k)*binomial(k - 1, j)*binomial(n, k), k, j + 1, n)
sage: forget()
Check that :issue:`16176` is fixed::
diff --git a/src/sage/symbolic/integration/external.py b/src/sage/symbolic/integration/external.py
index c99676c0b88..105e8e3bbbd 100644
--- a/src/sage/symbolic/integration/external.py
+++ b/src/sage/symbolic/integration/external.py
@@ -31,12 +31,7 @@ def maxima_integrator(expression, v, a=None, b=None):
Check that :issue:`25817` is fixed::
sage: maxima_integrator(log(e^x*log(x)*sin(x))/x^2, x)
- 1/2*(x*(Ei(-log(x)) + conjugate(Ei(-log(x))))
- - 2*x*integrate(sin(x)/(x*cos(x)^2 + x*sin(x)^2
- + 2*x*cos(x) + x), x) + 2*x*integrate(sin(x)/(x*cos(x)^2
- + x*sin(x)^2 - 2*x*cos(x) + x), x) + 2*x*log(x) + 2*log(2)
- - log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) - log(cos(x)^2
- + sin(x)^2 - 2*cos(x) + 1) - 2*log(log(x)))/x
+ -1/2*(2*x*integrate(sin(x)/(x*cos(x)^2 + x*sin(x)^2 + 2*x*cos(x) + x), x) - 2*x*integrate(sin(x)/(x*cos(x)^2 + x*sin(x)^2 - 2*x*cos(x) + x), x) - 2*x*log(x) - 2*x*real_part(Ei(-log(x))) - 2*log(2) + log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1) + log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1) + 2*log(log(x)))/x
"""
from sage.calculus.calculus import maxima
if not isinstance(expression, Expression):
diff --git a/src/sage/symbolic/integration/integral.py b/src/sage/symbolic/integration/integral.py
index b3d1dd1c2bf..1002343e884 100644
--- a/src/sage/symbolic/integration/integral.py
+++ b/src/sage/symbolic/integration/integral.py
@@ -614,10 +614,7 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None, hold=False):
x y + Sqrt[--] FresnelS[Sqrt[--] x]
2 Pi
sage: print(f.integral(x))
- x*y^z + 1/16*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x)
- + (I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x)
- - (I - 1)*sqrt(2)*erf(sqrt(-I)*x)
- + (I + 1)*sqrt(2)*erf((-1)^(1/4)*x))
+ x*y^z + 1/16*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x) - (I - 1)*sqrt(2)*erf(sqrt(-I)*x) - 2*sqrt(2)*imag_part(erf((-1)^(1/4)*x)) + 2*sqrt(2)*real_part(erf((-1)^(1/4)*x)))
Alternatively, just use algorithm='mathematica_free' to integrate via Mathematica
over the internet (does NOT require a Mathematica license!)::
@@ -1011,8 +1008,8 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None, hold=False):
sage: f = log(sin(x))*sin(x)^2
sage: g = integrate(f, x) ; g
1/4*I*x^2
+ - 1/2*I*x*arctan2(-sin(x), -cos(x) + 1)
- 1/2*I*x*arctan2(sin(x), cos(x) + 1)
- + 1/2*I*x*arctan2(sin(x), -cos(x) + 1)
- 1/4*x*log(cos(x)^2 + sin(x)^2 + 2*cos(x) + 1)
- 1/4*x*log(cos(x)^2 + sin(x)^2 - 2*cos(x) + 1)
+ 1/4*(2*x - sin(2*x))*log(sin(x))
@@ -1036,7 +1033,7 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None, hold=False):
sage: assume(a > 0)
sage: assume(a < 1)
sage: integrate(x*log(1/(a*x+(1-x)^2)), x, 0, 1, algorithm='maxima')
- 1/4*a^2*log(a) + 1/2*sqrt(-a^2 + 4*a)*a*arctan(sqrt(-a^2 + 4*a)*(a - 2)/(a^2 - 4*a)) - 1/2*sqrt(-a^2 + 4*a)*a*arctan(sqrt(-a^2 + 4*a)/(a - 4)) - a*log(a) - sqrt(-a^2 + 4*a)*arctan(sqrt(-a^2 + 4*a)*(a - 2)/(a^2 - 4*a)) + sqrt(-a^2 + 4*a)*arctan(sqrt(-a^2 + 4*a)/(a - 4)) - 1/2*a + 3/2
+ 1/4*a^2*log(a) - 1/2*sqrt(-a^2 + 4*a)*a*arctan(sqrt(-a^2 + 4*a)/(a - 4)) + 1/2*sqrt(-a^2 + 4*a)*a*arctan(sqrt(-a^2 + 4*a)*(a - 2)/((a - 4)*a)) - a*log(a) + sqrt(-a^2 + 4*a)*arctan(sqrt(-a^2 + 4*a)/(a - 4)) - sqrt(-a^2 + 4*a)*arctan(sqrt(-a^2 + 4*a)*(a - 2)/((a - 4)*a)) - 1/2*a + 3/2
Check that :issue:`25905` is fixed::
diff --git a/src/sage/symbolic/relation.py b/src/sage/symbolic/relation.py
index 8fada2b4e9b..02cfc43f282 100644
--- a/src/sage/symbolic/relation.py
+++ b/src/sage/symbolic/relation.py
@@ -1338,20 +1338,6 @@ def _solve_expression(f, x, explicit_solutions, multiplicities,
sage: (x^2>1).solve(x)
[[x < -1], [x > 1]]
- Catch error message from Maxima::
-
- sage: solve(acot(x),x)
- Traceback (most recent call last):
- ...
- TypeError: ECL says: cot: argument 0 isn't in the domain of cot.
-
- ::
-
- sage: solve(acot(x),x,to_poly_solve=True)
- Traceback (most recent call last):
- ...
- TypeError: ECL says: cot: argument 0 isn't in the domain of cot.
-
:issue:`7491` fixed::
sage: y = var('y')
diff --git a/src/sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py b/src/sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py
index b5531b112b4..15f74fe5779 100644
--- a/src/sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py
+++ b/src/sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py
@@ -256,7 +256,7 @@
Sage example in ./calculus.tex, line 1086::
sage: solve(x^(1/x)==(1/x)^x, x)
- [(1/x)^x == x^(1/x)]
+ [x^(1/x) == (1/x)^x]
Sage example in ./calculus.tex, line 1124::