Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
SageMath
SageMath Developers
tracmirror
Compare Revisions
develop...u/rws/held_symbolic_powers_cannot_be_approximated_numerically
Commits (1)
21754: Held symbolic powers cannot be approximated numerically
· e1279df5
Ralf Stephan
authored
Oct 24, 2016
e1279df5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
src/sage/symbolic/expression.pyx
src/sage/symbolic/expression.pyx
+20
-0
No files found.
src/sage/symbolic/expression.pyx
View file @
e1279df5
...
...
@@ -5470,6 +5470,16 @@ cdef class Expression(CommutativeRingElement):
162.000000000000
sage: (ex+1).n()
163.000000000000
sage: (ex^2).n()
26244.0000000000
We can also compute otherwise inaccessible powers
(:trac:`21754`)::
sage: SR(2).power(SR(QQbar(3).sqrt() + QQbar(2).sqrt()), hold=True)
2^3.146264369941973?
sage: _.n()
8.85360107441145
"""
if
prec
is
None
:
prec
=
digits_to_bits
(
digits
)
...
...
@@ -5483,6 +5493,16 @@ cdef class Expression(CommutativeRingElement):
from
sage.calculus.calculus
import
symbolic_sum
return
symbolic_sum
(
*
(
ex
.
operands
()))
return
super
(
DefiniteSumExpander
,
self
).
composition
(
ex
,
operator
)
def
arithmetic
(
self
,
ex
,
operator
):
# we don't want the default behaviour of reducing
# arithmetical operations here
import
operator
as
_operator
if
operator
is
_operator
.
pow
and
(
is_a_numeric
((
<
Expression
>
ex
.
operands
()[
0
]).
_gobj
)
and
is_a_numeric
((
<
Expression
>
ex
.
operands
()[
1
]).
_gobj
)):
return
ex
.
operands
()[
0
].
power
(
ex
.
operands
()[
1
],
hold
=
True
)
return
super
(
DefiniteSumExpander
,
self
).
arithmetic
(
ex
,
operator
)
s
=
DefiniteSumExpander
(
self
)
cdef
Expression
x
=
self
.
_parent
(
s
())
...
...