On Wednesday, January 17, 2018 at 10:54:10 PM UTC+1, saad khalid wrote:
>
> what I meant was, when I use the assume(abs(x) < 1), but still plug in a
> value for x that is greater than 1 into the function. For example, f(1.5)
> runs fine, even when I have assume(abs(x) < 1).
>
The right side of "f(x)=sum..." is evaluated at the time where the
assumption holds. If you change assumptions after that the f(x) is already
set. If you want to have different behaviour use a Python function:
sage: def f(x): return sum(x^i, i, 0, oo)
sage: assume(abs(x)<1)
sage: f(x)
-1/(x - 1)
sage: forget()
sage: assume(abs(x)>1)
sage: f(x)
...
ValueError: Sum is divergent.
As to the integral I take back what I said because I get (both on a fresh
Sage):
sage: assume(abs(x)>1)
sage: integrate(1/(1-x),x,0,2)
...
ValueError: Integral is divergent.
and
sage: var('i')
i
sage: assume(abs(x)<1)
sage: f(x) = sum(x^i, i, 0, oo)
sage: integrate(f(x),x,0,2)
-I*pi
sage: forget()
sage: assume(abs(x)>1)
sage: integrate(f(x),x,0,2)
...
ValueError: Integral is divergent.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.