summarylogtreecommitdiffstats
path: root/sagemath-pynac-0.7.12.patch
blob: aeedf8e87df3b09fade9c9eadcaadbf3d10fa99a (plain)
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
diff --git a/src/doc/de/thematische_anleitungen/sage_gymnasium.rst b/src/doc/de/thematische_anleitungen/sage_gymnasium.rst
index 5a150a0..f9ede06 100644
--- a/src/doc/de/thematische_anleitungen/sage_gymnasium.rst
+++ b/src/doc/de/thematische_anleitungen/sage_gymnasium.rst
@@ -716,7 +716,7 @@ die ähnliche Funktion ``canonicalize_radical``::
 Diese Gesetze können auch umgekehrt verwendet werden, wie in diesem Beispiel::
 
     sage: (5*log(2) + 5*log(5)).simplify_log()
-    log(100000)
+    5*log(10)
 
 Es geben weitere mögliche Vereinfachungen, die wir hier nicht weiter erwähnen.
 
diff --git a/src/sage/coding/code_bounds.py b/src/sage/coding/code_bounds.py
index 7935bbf..64ac455 100644
--- a/src/sage/coding/code_bounds.py
+++ b/src/sage/coding/code_bounds.py
@@ -577,8 +577,8 @@ def entropy(x, q=2):
 
         sage: codes.bounds.entropy(0, 2)
         0
-        sage: codes.bounds.entropy(1/5,4)
-        1/5*log(3)/log(4) - 4/5*log(4/5)/log(4) - 1/5*log(1/5)/log(4)
+        sage: codes.bounds.entropy(1/5,4).factor()
+        1/10*(log(3) - 4*log(4/5) - log(1/5))/log(2)
         sage: codes.bounds.entropy(1, 3)
         log(2)/log(3)
 
diff --git a/src/sage/functions/log.py b/src/sage/functions/log.py
index 15e3dbf..64d898c 100644
--- a/src/sage/functions/log.py
+++ b/src/sage/functions/log.py
@@ -121,12 +121,12 @@ class Function_exp(GinacFunction):
             sage: model_exp = exp(II)**a*(b)
             sage: sol1_l={b: 5.0, a: 1.1}
             sage: model_exp.subs(sol1_l)
-            5.00000000000000*(e^II)^1.10000000000000
+            5.00000000000000*e^(1.10000000000000*II)
 
         ::
 
             sage: exp(3)^II*exp(x)
-            (e^3)^II*e^x
+            e^(3*II + x)
             sage: exp(x)*exp(x)
             e^(2*x)
             sage: exp(x)*exp(a)
@@ -137,7 +137,7 @@ class Function_exp(GinacFunction):
         Another instance of the same problem (:trac:`7394`)::
 
             sage: 2*sqrt(e)
-            2*sqrt(e)
+            2*e^(1/2)
 
         Check that :trac:`19918` is fixed::
 
@@ -271,7 +271,7 @@ class Function_log(GinacFunction):
             sage: RDF(log(1024, 2))
             10.0
             sage: log(10, 4)
-            log(10)/log(4)
+            1/2*log(10)/log(2)
             sage: RDF(log(10, 4))
             1.6609640474436813
             sage: log(10, 2)
diff --git a/src/sage/functions/orthogonal_polys.py b/src/sage/functions/orthogonal_polys.py
index 5db9871..c877454 100644
--- a/src/sage/functions/orthogonal_polys.py
+++ b/src/sage/functions/orthogonal_polys.py
@@ -1666,7 +1666,7 @@ class Func_assoc_legendre_Q(BuiltinFunction):
         EXAMPLES::
 
             sage: gen_legendre_Q(2,1,3)
-            -1/4*sqrt(-2)*(-36*I*pi + 36*log(4) - 36*log(2) - 25)
+            -1/4*sqrt(-2)*(-36*I*pi + 36*log(2) - 25)
         """
         ret = self._eval_special_values_(n, m, x)
         if ret is not None:
diff --git a/src/sage/libs/pynac/pynac.pxd b/src/sage/libs/pynac/pynac.pxd
index 9e37f08..1d19fdd 100644
--- a/src/sage/libs/pynac/pynac.pxd
+++ b/src/sage/libs/pynac/pynac.pxd
@@ -97,6 +97,7 @@ cdef extern from "sage/libs/pynac/wrap.h":
 
     cdef cppclass GEx "ex":
         GEx()
+        GEx(GNumeric o)
         GEx(GSymbol m)
         GEx(GEx m)
         GEx(long n)
@@ -127,8 +128,8 @@ cdef extern from "sage/libs/pynac/wrap.h":
         GEx numer()                   except +
         GEx denom()                   except +
         GEx numer_denom()             except +
-        int degree(GEx expr)          except +
-        int ldegree(GEx expr)         except +
+        GNumeric degree(GEx expr)          except +
+        GNumeric ldegree(GEx expr)         except +
         GEx unit(GEx expr)            except +
         GEx content(GEx expr)         except +
         GEx primpart(GEx expr)        except +
@@ -161,6 +162,7 @@ cdef extern from "sage/libs/pynac/wrap.h":
 
     # Algorithms
     GEx g_gcd "gcd"(GEx a, GEx b) except +
+    bint g_factor "factor"(GEx expr, GEx res) except +
     GEx g_gosper_term "gosper_term"(GEx the_ex, GEx n) except +
     GEx g_gosper_sum_definite "gosper_sum_definite"(GEx the_ex,
             GEx n, GEx a, GEx b, int* p) except +
diff --git a/src/sage/rings/asymptotic/asymptotic_ring.py b/src/sage/rings/asymptotic/asymptotic_ring.py
index 0b03a4a..9de56a6 100644
--- a/src/sage/rings/asymptotic/asymptotic_ring.py
+++ b/src/sage/rings/asymptotic/asymptotic_ring.py
@@ -2485,7 +2485,7 @@ class AsymptoticExpansion(CommutativeAlgebraElement):
         ::
 
             sage: (x^2 + log(x)).subs(x=4*x+2).truncate(5)
-            16*x^2 + 16*x + log(x) + log(4) + 4 + 1/2*x^(-1) + O(x^(-2))
+            16*x^2 + 16*x + log(x) + 2*log(2) + 4 + 1/2*x^(-1) + O(x^(-2))
             sage: _.parent()
             Asymptotic Ring <(e^x)^QQ * x^ZZ * log(x)^ZZ> over Symbolic Ring
 
diff --git a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py 
b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
index 9a6f67a..de61ed3 100644
--- a/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
+++ b/src/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py
@@ -60,9 +60,15 @@ A univariate smooth point example::
     sage: decomp = F.asymptotic_decomposition(alpha)
     sage: decomp
     (0, []) +
-    (-1/2*(x^2 + 6*x + 9)*r^2/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
-     - 1/2*(5*x^2 + 24*x + 27)*r/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
-     - 3*(x^2 + 3*x + 3)/(x^5 + 9*x^4 + 27*x^3 + 27*x^2),
+    (-1/2*r^2*(x^2/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     + 6*x/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     + 9/(x^5 + 9*x^4 + 27*x^3 + 27*x^2))
+     - 1/2*r*(5*x^2/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     + 24*x/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     + 27/(x^5 + 9*x^4 + 27*x^3 + 27*x^2))
+     - 3*x^2/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     - 9*x/(x^5 + 9*x^4 + 27*x^3 + 27*x^2)
+     - 9/(x^5 + 9*x^4 + 27*x^3 + 27*x^2),
      [(x - 1/2, 1)])
     sage: F1 = decomp[1]
     sage: p = {x: 1/2}
@@ -139,9 +145,9 @@ A multiple point example (Example 6.5 of [RaWi2012]_)::
     sage: alpha = (var('a'), var('b'))
     sage: decomp =  F.asymptotic_decomposition(alpha); decomp
     (0, []) +
-    (-1/9*(2*b^2*x^2 - 5*a*b*x*y + 2*a^2*y^2)*r^2/(x^2*y^2)
-      - 1/9*(6*b*x^2 - 5*(a + b)*x*y + 6*a*y^2)*r/(x^2*y^2)
-      - 1/9*(4*x^2 - 5*x*y + 4*y^2)/(x^2*y^2),
+    (-1/9*r^2*(2*a^2/x^2 + 2*b^2/y^2 - 5*a*b/(x*y))
+     - 1/9*r*(6*a/x^2 + 6*b/y^2 - 5*a/(x*y) - 5*b/(x*y))
+     - 4/9/x^2 - 4/9/y^2 + 5/9/(x*y),
      [(x + 2*y - 1, 1), (2*x + y - 1, 1)])
     sage: F1 = decomp[1]
     sage: F1.asymptotics(p, alpha, 2)
@@ -1480,9 +1486,9 @@ class FractionWithFactoredDenominator(RingElement):
             sage: alpha = [var('a')]
             sage: F.asymptotic_decomposition(alpha)
             (0, []) +
-            (1/54*(5*a^2*x^2 + 2*a^2*x + 11*a^2)*r^2/x^2
-             - 1/54*(5*a*x^2 - 2*a*x - 33*a)*r/x^2 + 11/27/x^2, [(x - 1, 1)]) +
-            (-5/27, [(x + 2, 1)])
+            (1/54*(5*a^2 + 2*a^2/x + 11*a^2/x^2)*r^2
+             - 1/54*(5*a - 2*a/x - 33*a/x^2)*r + 11/27/x^2,
+            [(x - 1, 1)]) + (-5/27, [(x + 2, 1)])
 
         ::
 
@@ -1495,7 +1501,7 @@ class FractionWithFactoredDenominator(RingElement):
             sage: alpha = var('a, b')
             sage: F.asymptotic_decomposition(alpha)
             (0, []) +
-            (1/3*(2*b*x - a*y)*r/(x*y) + 1/3*(2*x - y)/(x*y),
+            (-1/3*r*(a/x - 2*b/y) - 1/3/x + 2/3/y,
              [(x + 2*y - 1, 1), (2*x + y - 1, 1)])
         """
         R = self.denominator_ring
@@ -1600,7 +1606,7 @@ class FractionWithFactoredDenominator(RingElement):
             (1, [(x*y + x + y - 1, 2)])
             sage: alpha = [4, 3]
             sage: decomp = F.asymptotic_decomposition(alpha); decomp
-            (0, []) + (-3/2*r*(y + 1)/y - 1/2*(y + 1)/y, [(x*y + x + y - 1, 1)])
+            (0, []) + (-3/2*r*(1/y + 1) - 1/2/y - 1/2, [(x*y + x + y - 1, 1)])
             sage: F1 = decomp[1]
             sage: p = {y: 1/3, x: 1/2}
             sage: asy = F1.asymptotics(p, alpha, 2, verbose=True)
@@ -1634,7 +1640,7 @@ class FractionWithFactoredDenominator(RingElement):
             sage: alpha = [3, 3, 2]
             sage: decomp = F.asymptotic_decomposition(alpha); decomp
             (0, []) +
-            (16*r*(4*y - 3*z)/(y*z) + 16*(2*y - z)/(y*z),
+            (-16*r*(3/y - 4/z) - 16/y + 32/z,
              [(x + 2*y + z - 4, 1), (2*x + y + z - 4, 1)])
             sage: F1 = decomp[1]
             sage: p = {x: 1, y: 1, z: 1}
diff --git a/src/sage/rings/asymptotic/term_monoid.py b/src/sage/rings/asymptotic/term_monoid.py
index b879639..ded7f02 100644
--- a/src/sage/rings/asymptotic/term_monoid.py
+++ b/src/sage/rings/asymptotic/term_monoid.py
@@ -3339,7 +3339,7 @@ class ExactTerm(TermWithCoefficient):
             sage: T(x^1234).log_term()
             (1234*log(x),)
             sage: T(49*x^7).log_term(base=7)
-            (log(49)/log(7), 7/log(7)*log(x))
+            (2, 7/log(7)*log(x))
 
         ::
 
@@ -3347,7 +3347,7 @@ class ExactTerm(TermWithCoefficient):
             sage: T('x * y').log_term()
             (log(x), log(y))
             sage: T('4 * x * y').log_term(base=2)
-            (log(4)/log(2), 1/log(2)*log(x), 1/log(2)*log(y))
+            (2, 1/log(2)*log(x), 1/log(2)*log(y))
 
         .. SEEALSO::
 
diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index 0b8a3bd..cdc34a2 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -2532,7 +2532,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
             sage: Integer(125).log(5,prec=53)
             3.00000000000000
             sage: log(Integer(125))
-            log(125)
+            3*log(5)
 
         For extremely large numbers, this works::
 
diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
index 36af3a5..857081b 100644
--- a/src/sage/rings/rational.pyx
+++ b/src/sage/rings/rational.pyx
@@ -3075,11 +3075,11 @@ cdef class Rational(sage.structure.element.FieldElement):
             sage: (124/345).log(5,100)
             -0.63578895682825611710391773754
             sage: log(QQ(125))
-            log(125)
+            3*log(5)
             sage: log(QQ(125), 5)
             3
             sage: log(QQ(125), 3)
-            log(125)/log(3)
+            3*log(5)/log(3)
             sage: QQ(8).log(1/2)
             -3
             sage: (1/8).log(1/2)
diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py
index 8009421..9ec892e 100644
--- a/src/sage/schemes/elliptic_curves/ell_point.py
+++ b/src/sage/schemes/elliptic_curves/ell_point.py
@@ -2886,7 +2886,7 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field):
             sage: Q.non_archimedean_local_height(K.ideal(1-2*i))
             0
             sage: Q.non_archimedean_local_height()
-            1/2*log(16)
+            2*log(2)
 
         An example over the rational numbers::
 
diff --git a/src/sage/symbolic/constants_c.pyx b/src/sage/symbolic/constants_c.pyx
index 8eb61f5..38e8db6 100644
--- a/src/sage/symbolic/constants_c.pyx
+++ b/src/sage/symbolic/constants_c.pyx
@@ -145,14 +145,14 @@ cdef class E(Expression):
             sage: t.operands()
             [a]
 
-        As opposed to::
+        This applies to the unit argument as well::
 
             sage: u = SR(1).exp()^a; u
             e^a
             sage: u.operator()
-            <built-in function pow>
+            exp
             sage: u.operands()
-            [e, a]
+            [a]
 
         It also works with matrices (see :trac:`4735`)::
 
diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index 94252ea..3e06201 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -3247,11 +3247,8 @@ cdef class Expression(CommutativeRingElement):
             -1
             sage: b = -x*A; c = b*b; c
             1/4*x^2*(sqrt(5) + I*sqrt(2*sqrt(5) + 10) - 1)
-
-        Products of non integer powers of exp are not simplified::
-
             sage: exp(x)^I*exp(z)^(2.5)
-            (e^x)^I*(e^z)^2.50000000000000
+            e^(I*x + 2.50000000000000*z)
 
         ::
 
@@ -6311,7 +6308,7 @@ cdef class Expression(CommutativeRingElement):
             0
         """
         cdef Expression ss = self.coerce_in(s)
-        return self._gobj.ldegree(ss._gobj)
+        return new_Expression_from_GEx(self._parent, GEx(self._gobj.ldegree(ss._gobj)))
 
     def degree(self, s):
         """
@@ -6337,7 +6334,7 @@ cdef class Expression(CommutativeRingElement):
             0
         """
         cdef Expression ss = self.coerce_in(s)
-        return self._gobj.degree(ss._gobj)
+        return new_Expression_from_GEx(self._parent, GEx(self._gobj.degree(ss._gobj)))
 
     def unit(self, s):
         """
@@ -7185,12 +7182,12 @@ cdef class Expression(CommutativeRingElement):
             sage: f.collect(z)
             (x^2*y^2 + 4)*z^2 + 4*x*y + 20*y^2 + (x + 21*y)*z
 
-        Sometimes, we do have to call :meth:`expand()` on the
-        expression first to achieve the desired result::
+        The terms are collected, whether the expression
+        is expanded or not::
 
             sage: f = (x + y)*(x - z)
             sage: f.collect(x)
-            x^2 + x*y - x*z - y*z
+            x^2 + x*(y - z) - y*z
             sage: f.expand().collect(x)
             x^2 + x*(y - z) - y*z
 
@@ -10433,9 +10430,9 @@ cdef class Expression(CommutativeRingElement):
         ``x*log(9)`` is contracted only if ``algorithm`` is ``'all'``::
 
             sage: (x*log(9)).simplify_log()
-            x*log(9)
+            2*x*log(3)
             sage: (x*log(9)).simplify_log('all')
-            log(9^x)
+            log(3^(2*x))
 
         TESTS:
 
@@ -10550,7 +10547,7 @@ cdef class Expression(CommutativeRingElement):
         To expand also log(3/4) use ``algorithm='all'``::
 
             sage: (log(3/4*x^pi)).log_expand('all')
-            pi*log(x) - log(4) + log(3)
+            pi*log(x) + log(3) - 2*log(2)
 
         To expand only the power use ``algorithm='powers'``.::
 
@@ -10573,7 +10570,7 @@ cdef class Expression(CommutativeRingElement):
             pi*log(x) + log(3/4)
 
             sage: (log(3/4*x^pi)).log_expand('all')
-            pi*log(x) - log(4) + log(3)
+            pi*log(x) + log(3) - 2*log(2)
 
             sage: (log(3/4*x^pi)).log_expand()
             pi*log(x) + log(3/4)
diff --git a/src/sage/tests/french_book/calculus_doctest.py b/src/sage/tests/french_book/calculus_doctest.py
index 0d40cae..ffe5d4b 100644
--- a/src/sage/tests/french_book/calculus_doctest.py
+++ b/src/sage/tests/french_book/calculus_doctest.py
@@ -331,7 +331,7 @@ Sage example in ./calculus.tex, line 914::
 Sage example in ./calculus.tex, line 929::
 
     sage: v(x) = diff(u(x), x); sol = solve(v(x) == 0, x); sol
-    [x == 100/log(100), x == 0]
+    [x == 50/log(10), x == 0]
     sage: floor(sol[0].rhs())
     21