[sage-support] Re: general legendre polynomials incorrect...

2018-07-29 Thread Ralf Stephan
See also https://trac.sagemath.org/ticket/25034

On Thursday, July 26, 2018 at 9:31:34 PM UTC+2, sss...@mst.edu wrote:
>
> I'm pretty convinced that the general legendre polynomials are incorrect 
> in some cases and lead to the associated legendre polynomials and spherical 
> harmonics to be incorrect in these cases.
> here is the legendre polynomial as calculated on this site: 
> https://paulmasson.github.io/sagemath-docs/functions/gen_legendre_P.html
> for n = 1 and m = 1:
>
>
> 
>
>
> which is what i get if i use in sagemath.
>
> but by using your definition that you state on this same website: I 
> computed what it and the reparameterized associated legendre polynomial 
> should be:
>
>> and this is the correct version 
>
> but when i try to calculate the reparameterized associated legendre 
> polynomial with sagemath using the general legendre polynomial function, i 
> get
>
>
> 
>
>
> if you check against outside sources like 
> https://en.wikipedia.org/wiki/Associated_Legendre_polynomials and 
> http://mathworld.wolfram.com/AssociatedLegendrePolynomial.html you can 
> clearly see that whatever actual definition of the gen_legendre_P() is not 
> what is described on the sagemath page and it is affecting spherical 
> harmonics function. 
>
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Automatic Differentiation in Sage?

2018-06-25 Thread Ralf Stephan
On Sunday, June 24, 2018 at 2:35:27 AM UTC+2, Matthias Goerner wrote:
>
> However, when I try 
> sage: sin(2 / (A((0.99, 1.01)) + dx + 3*dy))
> ValueError: Can only apply sin to formal power series with zero constant 
> term.
>

The result of such a series in general rings would contain expressions of 
the form sin(C), cos(D). Of course, in your case they would be immediately 
converted to RIFs, but the underlying general implementation would have to 
be over the symbolic ring. With the existing bias of mathematicians 
developing for Sage against symbolic expressions I'm pessimistic about an 
implementation in Sage.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Numeric Approximation with Symbolics

2018-05-20 Thread Ralf Stephan
On Saturday, May 19, 2018 at 11:12:57 PM UTC+2, slelievre wrote:
>
> Is there a tutorial about walking the expression tree and doing various
> operations there?
>

There isn't even a description of the possible parts of an expression in 
Sage. That's in the GiNaC tutorial but C++ centric.
The ExpressionTreeWalker class was also added only recently. In general,

https://trac.sagemath.org/ticket/9329

Regards, 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Numeric Approximation with Symbolics

2018-05-19 Thread Ralf Stephan
There is a function is_unit() in symbolic/units.py, so you just need to 
walk the expression tree using the ExpressionTreeWalker class in 
symbolic/expression_conversions.py.  I would first check for symbol with 
ex.is_symbol() which is very fast. See DefiniteSumExpander for example.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: order of variables in symbolic operations

2018-05-19 Thread Ralf Stephan
But have you tried using a polynomial ring?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: order of variables in symbolic operations

2018-05-19 Thread Ralf Stephan
This is not possible at the moment. If it's changeable somehow the change 
would not be high priority.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: laplace_transform hypergeometric?

2018-04-13 Thread Ralf Stephan
I confirm conversion of hypergeometric 2F1 to SymPy is broken---but 2F2 is 
not so the workaround would be to give an additional 1 argument in the 
second slot. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] laplace_transform hypergeometric?

2018-04-13 Thread Ralf Stephan
The transform is implemented via calling of SymPy but apparently something went 
wrong in the conversion to SymPy. I cannot say more as I'm not at my box but 
you can try to use SymPy directly as a workaround.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Mixing cython and Sage code

2018-03-23 Thread Ralf Stephan
On Wednesday, March 21, 2018 at 7:29:37 PM UTC+1, saad khalid wrote:
>
> ...For example, one of the Mathematica functions takes a polynomial in 2 
> variables as input and computes the value of the order in one of the 
> variables (ie for x1^3 + x1*x2^2 + x2, the order for x1 would be 3).
>

Not discouraging your efforts but did you try poly.degree(x1)?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: [sage-cell] Where Oh Where is my Divide By Zero Error?

2018-03-20 Thread Ralf Stephan
On Sunday, March 18, 2018 at 5:19:07 PM UTC+1, Johan S. H. Rosenkilde wrote:
>
> I don't have a better explanation for why this difference has been 
> adopted in Sage than the above: following IEEE standard vs doing the 
> mathematically safe-and-fail-early-solution. Perhaps someone more 
> knowledgeable about this can chime in. 
>

Historically throwing this specific error was introduced with the massive 
effort of adapting GiNaC to Sage (2008-2012). There are various errors you 
can get by triggering different code parts. Another in symbolics:

sage: SR(1)/0
...
ZeroDivisionError: Symbolic division by zero

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Is this a bug?

2018-02-28 Thread Ralf Stephan
Sorry for the noise, it already works fine, just not with characteristic 
polynomials of symbolic matrices. They messed up my Sage session, so the 
minpoly example seemed to fail too.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Is this a bug?

2018-02-28 Thread Ralf Stephan
It might not be necessary to (re)assign the global variable. Only if the 
user wants to do operations with the polynomial he wants an x to be that 
poly variable, and certainly not another x. So, the parser can do the part 
of figuring out what x is meant, maybe by checking all generator names. 
Example:

sage: charpoly()
x + 1
sage: _ - x
(parser sees underscore and operation, and an unassigned global, so it 
checks the object referred by the underscore for variable names)

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is this a bug?

2018-02-28 Thread Ralf Stephan
Why should I define x when Sage gives me a polynomial with x, doesn't it 
already know it?

That's what a user would ask and, frankly, s/he would be right.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is this a bug?

2018-02-28 Thread Ralf Stephan
On Wednesday, February 28, 2018 at 9:09:04 AM UTC+1, Dima Pasechnik wrote:
>
> I would be for dropping 'x' as the only "default" variable (defined at 
> start time).
>

I agree but does it solve the problem I demonstrated. Can you then add x to 
the minpoly?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is this a bug?

2018-02-27 Thread Ralf Stephan
On Tuesday, February 27, 2018 at 10:58:38 AM UTC+1, Dima Pasechnik wrote:
>
> This is now https://trac.sagemath.org/ticket/24853
>

While that fixes the infinite loop, it only works around another issue that 
is uncovered, namely that the x in the polynomial returned by charpoly() is 
not accessible to the user:

sage: P
x^4 - 5/4*t*x - 2*t
sage: P - x^4
x^4 - 5/4*t*x - x^4 - 2*t

The reason is apparently that the polynomial ring was not created by the 
user on the command line but by the charpoly() code. This shows for example 
also with:

sage: QQbar(sqrt(2)).minpoly()
x^2 - 2
sage: _ + x^2
x^2 + x^2 - 2

i would consider this a high priority bug. Is there a ticket?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Numeric Approximation with Symbolics

2018-02-26 Thread Ralf Stephan
On Tuesday, February 27, 2018 at 1:06:37 AM UTC+1, Pstrang Rzekle wrote:

> Is there a way to trick SageMath into presenting numeric approximations 
> with symbolics? In this specific case, handling numbers with units attached.
>

You will have to use an internal method and convert the number of digits to 
bits yourself, until that is fixed:

sage: x._convert({'parent':RealField(10)})
(1.0e-6)*centimeter

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to get special values of arccos

2018-02-26 Thread Ralf Stephan
On Monday, February 26, 2018 at 9:08:47 AM UTC+1, Simon King wrote:
>
> Question: How can one get the exact value of arccos(1/2*sqrt(sqrt(2) + 2)) 
> (which is pi/8)? I tried .simplify_full() and so on, but to no avail. 
>

First, there is no such ready functionality. There are probably several 
ways to enable this for you as user, the simplest being a function that 
builds up a dict with (expr : expr) pairs that gets pre-filled with things 
like (1/2*sqrt(sqrt(2) + 2) : pi/8) which you just look up. This is 
possible because the simplification from cos(pi/8) to 1/2*sqrt(sqrt(2) + 2) 
is one of only a finite number of cases implemented.

A more mathematical solution would be to convert 1/2*sqrt(sqrt(2) + 2) to 
an algebraic number (QQbar) and look at the degree d of its minimal 
polynomial. I'm not an expert but pretty sure that d divides n in 
cos(m/n*pi). From experience n / d is probably not greater than 4, so maybe 
it suffices to check d, 2d, and 4d as candidates for n, and loop through 
all m coprime to n. This algorithm is slow however, so it's better to put 
it in as part of ex.simplify_full().

Improvements appreciated,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Bug report-Sage

2018-02-12 Thread Ralf Stephan
It's the pattern sqrt(f(x)) with f containing trigonometric functions. Use 
giac for such integrals.

sage: integral(abs(sin(pi*x)), x, 0, 1, algorithm='giac')
2/pi

There is no meta ticket for this, you can find integration tickets 
at https://trac.sagemath.org/wiki/symbolics#Integrationtickets

It's not difficult to implement a heuristic to use giac, but we need a 
review of
https://trac.sagemath.org/ticket/24283

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Weird behavior of a divergent sum when using the assume() command

2018-01-17 Thread Ralf Stephan
Looking back to earlier posts in this thread I think the confusion was 
because of assuming x<1 not abs(x)<1.

Finally in your cocalc worksheet the assumption abs(x)<1 holds at the time 
the integral is done so you get the value.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Weird behavior of a divergent sum when using the assume() command

2018-01-17 Thread Ralf Stephan
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Weird behavior of a divergent sum when using the assume() command

2018-01-16 Thread Ralf Stephan
On Tuesday, January 16, 2018 at 3:23:16 AM UTC+1, saad khalid wrote:
>
> Hello everyone:
>
> So, I was just messing around with the assume command, and did:
>
> var('i')
> assume(abs(x) < 1)
> f(x) = sum(x^i, i, 0, oo )
>
> This is just 1/(1-x). I wanted to see what would happen when I tried using 
> x > 1, and it still evaluates properly
>

I cannot confirm that, I get:
sage: forget()
sage: assume(x-1>0)
sage: f(x) = sum(x^i, i, 0, oo )
...
ValueError: Sum is divergent.
 

> , even though the sum should be divergent for x > 1. How does this happen 
> behind the scenes exactly? Is Sage/Maxima substituting 1/(1-x) for my sum? 
> Further, I took the integral from 0 to 2:
>
> integrate(f(x),x,0,2)
>
> which returned -I*pi. 
>

I cannot confirm that either for f(x) = 1/(1-x) because I get
sage: integrate(1/(1-x),x,0,2)
...
ValueError: Integral is divergent.
regardless of assumptions.

My guess is you have done operations with f(x) in the meantime that change 
what you think you are doing.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] find_local_maximum of the absolute value of a polynomial with complex coefficients

2018-01-13 Thread Ralf Stephan


On Friday, January 12, 2018 at 4:51:32 PM UTC+1, Vegard Lima wrote:
>
> TypeError: unable to coerce to a real number 
>

Thanks. I opened
https://trac.sagemath.org/ticket/24536
https://trac.sagemath.org/ticket/24537

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Evaluation of sum function in callable expression

2017-12-18 Thread Ralf Stephan
Also I think that results other than 20 are wrong for both formulae because 
the binomial part always amounts to binomial(2-n,3-n), i.e. zero, and 
you're just adding 5 four times. But I'm not 100 per cent on that.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Evaluation of sum function in callable expression

2017-12-17 Thread Ralf Stephan
BTW instead of unhold() you can also use n() to get the value of an 
unevaluated definite sum.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Evaluation of sum function in callable expression

2017-12-17 Thread Ralf Stephan
This looks like a bug, you get the sum unevaluated. You can as a workaround 
evaluate it manually. I get:

print(h3(3,h3n=5).unhold())
20

Thanks for the report.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: integrals and algorithms

2017-11-13 Thread Ralf Stephan
On Sunday, November 12, 2017 at 11:30:51 AM UTC+1, Enrique Artal wrote:
>
> It seems that fresnels is defined in sympy but not in sagemath, Is it 
> possible to correct these errors? Thanks, Enrique.
>
>
 I opened https://trac.sagemath.org/ticket/24212

Thanks for the report,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error with simple integral, "CEXPT only defined for non-negative integral exponents."

2017-11-08 Thread Ralf Stephan
See also
https://trac.sagemath.org/ticket/12152
and
https://trac.sagemath.org/ticket/14821

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error with simple integral, "CEXPT only defined for non-negative integral exponents."

2017-11-08 Thread Ralf Stephan


On Tuesday, November 7, 2017 at 6:06:05 PM UTC+1, saad khalid wrote:
>
>
> integral(525.87*(x)^(-2.35),x,.1,1)
>
>
This is user error because this works fine:

sage: integral(52587/100*(x)^(-235/100),x,.1,1)
8331.031741769872

Never use inexact values in integral terms.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: formal sets

2017-11-06 Thread Ralf Stephan
On another note, while there is support for sets with maps from ZZ 
in EnumeratedSetFromIterator. How can for example the set under a function 
from the positive reals be formally represented? I'm looking for an 
equivalent of SymPy's ImageSet.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: formal sets

2017-11-05 Thread Ralf Stephan
Please review
https://trac.sagemath.org/ticket/24162

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: formal sets

2017-11-05 Thread Ralf Stephan
On Sunday, November 5, 2017 at 8:56:44 PM UTC+1, Eric Gourgoulhon wrote:
>
> sage: R = Set(RealSet(-oo,oo))
> sage: R.an_element()
> (-oo, +oo)
>

I see, R is a set with one element, so there is a difference to Set(ZZ)

In passing, we may also note that
> sage: RealSet(-oo,+oo).an_element()
> ...
> SignError: cannot add infinity to minus infinity
>
>
Thanks. I think this needs to be fixed. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] formal sets

2017-11-05 Thread Ralf Stephan
Hello,

The set of integers can be formally represented as
sage: Set(ZZ)
Set of elements of Integer Ring

A bit more tricky are the reals:
sage: Set(RealSet(-oo,oo))
Set of elements of (-oo, +oo)

How could one represent the complexes? Is it a cartesian product?

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: [piecewise] AttributeError: ComplexField_class_with_category object has no attribute complex_field

2017-10-30 Thread Ralf Stephan
On Sunday, October 29, 2017 at 11:14:54 AM UTC+1, Marcel Partap wrote:
>
> Is it that piecewise functions are not yet fully fledged out,
>

This, unfortunately.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Polynomial factorization over modular ring

2017-08-15 Thread Ralf Stephan
On Tuesday, August 15, 2017 at 4:21:03 PM UTC+2, chandra chowdhury wrote:
>
> x = var('x') 
> factor(x^5-x, IntegerModRing(25)['x'])
>

Look at the output of `factor??`. A ring argument is not supported. So you 
have to create the ring first (var gives you only the symbolic ring). Then 
create the polynomial and can try to find out if it has a factor() method. 
After all this you may start to understand what the other posters were 
talking about.

Regards,

>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Hold evaluation for division

2017-07-21 Thread Ralf Stephan
You don't write what u is in the first place so I cannot give a specific 
answer. However, holding division is possible using the mul method, by 
doing a mul with the inverse:
sage: x/(2*x)
1/2
sage: x.mul(1/(2*x), hold=True)
x*(1/2/x)
sage: _.unhold()
1/2

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error in graphic

2017-07-11 Thread Ralf Stephan
Thanks. Now please post all commands from start of Sage until this happens.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Misunderstanding or mistake with Coefficient function on multivariate taylor series

2017-07-10 Thread Ralf Stephan
There are several different issues. In your first example you write

((1/(1-x1^t)).taylor(x2,1,4).taylor(x1,1,4).coefficient(1/(x1-1))).
substitute(x2=1)

Note that contrary to your other examples x2 is not in the expression you 
expand the series from. A typo?

In the second example

((1/(1-x2*x1^t)).taylor(x1,1,4)).coefficient(1/(x1-1)).substitute(x2=1)

just look at the series you get, there is no term with 1/(x1-1) so you get 
0 as coefficient.

In the third example you are looking for the coefficient of s^n with s 
being a sum. This is not supported generally. Try to substitute the sum 
before taking the coefficient:

sage: ((1/(1-x2*x1^t)).taylor(x2,1,4).taylor(x1,1,4)).substitute(x2==1,x1-1
==y).coefficient(y)
-1/12*(t^6 - t^4)/t^5

Regards,


>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error plotting 3D

2017-07-03 Thread Ralf Stephan
The reason is the typo **299792458

You really want such a big power?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error in graphic

2017-07-03 Thread Ralf Stephan
There is no way around you getting a recent Sage
(or using the cloud) and posting a full session log.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error plotting 3D

2017-07-03 Thread Ralf Stephan
Well you are dealing with numerically exctreme values here.
Let's look at the factor of (x**2+y**2) inside the lambda:

sage: 
(exp(I*2000*(1.60217662*10**(-19))/(299792458*6.6260700*10**(-34)))-(sqrt(
: 
I*(1.60217662*10**(-19))/(4*6.62607004*10**(-34)*299792458*2000))-1.60
: 
217662*10**(-19))**2)*2000**2)/(((6.62607004*10**(-34))**2)**299792458**2)
: )))
+infinity + NaN*I

Using inexact numerics will not work if you exceed machine limits.
It is even impossible for Sage to compute the value using exact numerics:

sage: 
(exp(I*2000*(160217662/1*10**(-19))/(299792458*66260700/1000*1
: 
0**(-34)))-(sqrt(I*(160217662/1*10**(-19))/(4*662607004/1*
: 
10**(-34)*299792458*2000))-160217662/1*10**(-19))**2)*2000**2)
: /(((662607004/1*10**(-34))**2)**299792458**2
sage/src/sage/rings/rational.pyx in sage.rings.rational.Rational.__pow__ 
(build/cythonized/sage/rings/rational.c:24103)()
   2575 return x
   2576 elif nn > 0:
-> 2577 sig_on()
   2578 mpz_pow_ui(mpq_numref(x.value), 
mpq_numref(_self.value), nn)
   2579 mpz_pow_ui(mpq_denref(x.value), 
mpq_denref(_self.value), nn)

MemoryError: failed to allocate 617894185381562160 bytes
 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Error in graphic

2017-06-30 Thread Ralf Stephan
On Friday, June 30, 2017 at 9:21:18 AM UTC+2, HG wrote:
>
> http://arachnoid.com/sage/differential1.html
>
> ValueError: Variable 't' not found
>
>
If you look at that arachnoid webpage you'll find this:
var('r c t')

Without defining a variable you cannot use it, even if it's bound.

Regards, 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Converting expressions from sage to sympy

2017-06-30 Thread Ralf Stephan
On Thursday, June 29, 2017 at 8:38:36 PM UTC+2, Jacob Pelletier wrote:
>
> I am trying to mix sage and sympy code via Jupyter Notebooks.
> Is there an easy way to overload the _sympy_() or _sage_() methods for 
> vars,symbols, and functions?
>

Not without Sage recompilation.
 

> Also, when I try the _sympy_() method on sage functions I get the 
> following error:
> "AttributeError: 'NewSymbolicFunction' object has no attribute '_sympy_'"
>
 
There is recent work on this:
https://trac.sagemath.org/ticket/22802

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: A possible slight addition to symbolic sum operations

2017-04-26 Thread Ralf Stephan


On Wednesday, April 26, 2017 at 8:35:30 AM UTC+2, Emmanuel Charpentier 
wrote:
>
> Sage can (awkwardly) do some simplifications of symbolic sums. For example
>
> sage: var("j,p", domain="integer")
> (j, p)
> sage: X,Y=function("X,Y")
> sage: (sum(X(j),j,1,p)+sum(Y(j),j,1,p)).maxima_methods().sumcontract()
> sum(X(j) + Y(j), j, 1, p)
>
> but, to the best of my (limited) knowledge, the reverse operation, useful 
> in sime situations (trivial example : derive maximum likelihood estimators 
> of the parameters of some distributions) is not possible (in other words, 
> sum does not distribute over +).
> ...
> (the Maxima version also works (not shown)). Hence a few questions :
>
>1. Did I oversee an existing way to do this ?
>
> Nearly. SymPy can do these things via simplify and expand.  However, Sage 
cannot translate your sums into SymPy via sympify because 1. there is no 
conversion atm for Function_sum (trivial to fix), and 2. anonymous 
functions like X here cannot be translated either (not so trivial). I 
didn't check the backwards route but expect similar problems.

>
>1. Is that a worthwile addition to Sage ?
>
> Of course.

>
>1. Should it be implemented in Sage (probably as a method for SR), or 
>via Maxima (like other sum functions) ?
>
> I would do like SymPy and put it as subfunction into expand() (check for 
existence of Function_sum then call). 

>
>1. Should this be a special case of the expand() method ?
>
> Not a special case, a default service. 

>
>1. Are there possible improvements (I think so : for example, I have 
>been unable to find the "right" designation of the operators : op_sum 
>might be sage.functions.other.symbolic_sum, but I found nothing usable 
>for op_add, hence the ridiculous re-computation of these constants at 
>each call...).
>
>  Yes, and sage.symbolic.operators.add_vararg.

Best,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Problem with an integral

2017-04-09 Thread Ralf Stephan


On Sunday, April 9, 2017 at 5:37:55 AM UTC+2, Andrey Novoseltsev wrote:
>
> As reported, 
>
> var('r') 
> assume(r>0) 
> integrate(r * sqrt( (2*r*cos(x)/sqrt(3))^2 + ( 2/3 + 4*r*sin(x)/3 )^2 ), 
> x) 
>
> gives 
>
> -1/12*(2*r*x - r*sin(2*x))*r 
>
> which is indeed incorrect. Is the root cause known? 


sqrt(trig) seems to be problematic in general with the Maxima integrator.
https://trac.sagemath.org/ticket/18821
https://trac.sagemath.org/ticket/18599

FriCAS does not better. I stopped SymPy after a minute.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Why factor(6*x+3) doesn't give 3*(2*x+1) in SageCell?

2017-04-07 Thread Ralf Stephan
On Friday, April 7, 2017 at 5:29:39 PM UTC+2, Chris Seberino wrote:
>
> I *agree* that the answer should be expanded in your example.
> But when you use the factor function it should have an effect no!?
>

That's why I gave the link to the ticket, which you can follow or 
participate in. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Why factor(6*x+3) doesn't give 3*(2*x+1) in SageCell?

2017-04-07 Thread Ralf Stephan
Because in the symbolic ring 3*(2*x+1) is immediately expanded again. Try 
yourself:

sage: 2*(1+3*x)
6*x + 2

But see also https://trac.sagemath.org/ticket/21067

Regards,

On Thursday, April 6, 2017 at 5:47:28 PM UTC+2, Chris Seberino wrote:
>
> Why factor(6*x+3) doesn't give 3*(2*x+1) ?
>
> Thanks!
>
> cs
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to treat (multiple) zeta values as real symbolic constants?

2017-03-30 Thread Ralf Stephan
On Thursday, March 30, 2017 at 10:38:49 AM UTC+2, Brent Pym wrote:
>
> Thank you very much!  By opening these tickets, you have certainly 
> answered my questions.  Is the etiquette to mark this thread as complete 
> now, or wait until the tickets have been closed?
>

Threads in sage-devel or -support are mostly open-ended. Developers use 
trac tickets as todo list.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to treat (multiple) zeta values as real symbolic constants?

2017-03-30 Thread Ralf Stephan
I also opened https://trac.sagemath.org/ticket/22713

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to treat (multiple) zeta values as real symbolic constants?

2017-03-30 Thread Ralf Stephan
On Thursday, March 30, 2017 at 9:08:24 AM UTC+2, Brent Pym wrote:
> Do I understand correctly that multiple polylogs and multiple zeta values 
are implemented in GiNaC/Pynac but not yet wrapped in SageMath?

They are in GiNaC but the code in Pynac is degenerated for various reasons, 
eg the numerics use CLN which is not in Sage.

See also https://trac.sagemath.org/ticket/10050

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How to treat (multiple) zeta values as real symbolic constants?

2017-03-28 Thread Ralf Stephan
On Tuesday, March 28, 2017 at 7:44:14 PM UTC+2, kcrisman wrote:
>
> On Tuesday, March 28, 2017 at 10:15:22 AM UTC-4, Brent Pym wrote:
>>
>> For a real number *s*, the value* zeta(s)* of the Riemann zeta function 
>> is real, but SageMath does not seem to recognize this fact.  Here is an 
>> example (SageMath 7.5.1):
>>
>> sage: conjugate(zeta(3))
>> conjugate(zeta(3))
>>
>> One might hope to simply get zeta(3)as output. 
>>
>
> One would have to hard-code that into Pynac, is my guess. 
>

Yes, the elementary functions had this implemented only recently, and I'm 
happy to add more knowledge like that.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Reconstructing a symbolic expression with derivative from the string representation

2017-02-22 Thread Ralf Stephan
On Wednesday, February 22, 2017 at 7:11:50 PM UTC+1, Nils Bruin wrote:
>
> Clearly, SR('diff(...)') operates in a scope where "diff" isn't bound to 
> the toplevel "diff".
>

Yes, there is no symbolic diff function and so it does not appear
in the dictionary for translating strings to expressions. It has other
consequences too so I consider writing a dummy function like
Function_sum a good idea.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Squaring the sine function

2017-02-19 Thread Ralf Stephan
Or in other words, are you typesetting, or is the sin^4 part of the result of a 
computation?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Unexpected behaviour of derivatives on power series

2017-01-15 Thread Ralf Stephan
I would have expected that with Laurent series but
they don't do the expected, either:
sage: R.=LaurentSeriesRing(SR)
sage: f = 1 + O(x^2)
sage: f.derivative(1)
O(x^1)
sage: f.derivative(2)
0
sage: f.derivative(3)
0


-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: simplifying radicals of trigonometric expressions

2017-01-15 Thread Ralf Stephan
We need documentation on symbolic simplification...

sage: sin(x/(x^2 + x)).normalize()
sin(1/(x + 1))

sage: factor(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6)
(cos(x)^2 - cos(x) - 3)*(cos(x) - 2)
sage: factor(sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6))
sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6)

sage: from sympy import factor as sfactor
sage: sfactor(sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6))
sqrt((cos(x) - 2)*(cos(x)**2 - cos(x) - 3))


On Friday, January 13, 2017 at 11:12:26 AM UTC+1, Enrique Artal wrote:
>
> I would like to know how to handle with this issue. Consider a function 
> f=sqrt(cos(x)^3 - 3*cos(x)^2 - cos(x) + 6). It is possible to deal with 
> this function for standard procedures like numerical_integral in (-1,1). If 
> one considers f.canonicalize_radical() it is presented as sqrt(cos(x)^2 - 
> cos(x) - 3)*sqrt(cos(x) - 2), which avoids numerical integration in 
> particular since each factor is complex in (-1,1). It is not solved if x is 
> declared as a real variable (with domain='real'). For this particular 
> function, it is not hard to avoid the issue, but if it appears in more 
> complex expressions, it is less obvious.
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: apply substitution only at specific summand

2016-12-12 Thread Ralf Stephan
On Monday, December 12, 2016 at 10:55:32 AM UTC+1, Daniel Krenn wrote:
>
> (I can only think of very complicated and long workarounds, so what is 
> the best way to do this?) 
>

As you can see from
sage: a = ((z^3 - 10*z^2 + 17*z - 8)/(z^4 + z^3 + z^2 + z + 1)).integrate(z) 
sage: a.operator()
integrate
sage: type(_)

sage: a.operands()
[(z^3 - 10*z^2 + 17*z - 8)/(z^4 + z^3 + z^2 + z + 1), z]

and the source in src/sage/symbolic/integration/integral.py
you must walk the expression tree and apply subs to the first operand of 
all instances of
integrate which is a symbolic function (operator). To do such walks in 
Python you usually
create a subclass of one of the classes 
in symbolic/expression_conversions.py

An example can be seen at
https://github.com/sagemath/sage/blob/master/src/sage/symbolic/expression.pyx#L5467
where sums with all-numeric arguments inside an expression are expanded. 
The rest of
the expression is just copied. Note the class is defined inside the 
function where it's used.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Getting Core dumped in Sage code for weil-pairing

2016-11-29 Thread Ralf Stephan
On Tuesday, November 29, 2016 at 4:25:35 PM UTC+1, slelievre wrote:
>
>
> The segfault boils down to a problem when dividing symbolic
> expressions involving finite field elements.
>

See also
https://trac.sagemath.org/ticket/21391

This would have resulted in:
TypeError: Multiplication of symbolic variable and an element of a ring 
with positive characteristic.

Regards,

>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-24 Thread Ralf Stephan
Please review
https://trac.sagemath.org/ticket/21754

On Monday, October 24, 2016 at 8:44:35 AM UTC+2, vdelecroix wrote:
>
> On 24 October 2016 at 08:33, Ralf Stephan > 
> wrote: 
> > On Monday, October 24, 2016 at 8:03:37 AM UTC+2, vdelecroix wrote: 
> >> 
> >> Something like this. But then it is not possible to do anything with 
> >> this expression (like numerical approximation)... 
> > 
> > 
> > Since you say pow is special we can fix this for the special case 
> > exponent in QQbar. Useful? 
>
> It would be useful to fix it in general: a real number power a 
> positive real number is something that is always well defined. And 
> actually, the following does work 
>
> sage: a = SR(2) ^ cos(3) 
> sage: a 
> 2^cos(3) 
> sage: a.numerical_approx() 
> 0.503480393603062 
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-23 Thread Ralf Stephan
On Monday, October 24, 2016 at 8:03:37 AM UTC+2, vdelecroix wrote:
>
> Something like this. But then it is not possible to do anything with 
> this expression (like numerical approximation)... 
>

Since you say pow is special we can fix this for the special case
exponent in QQbar. Useful? 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-23 Thread Ralf Stephan
On Sunday, October 23, 2016 at 6:33:30 PM UTC+2, vdelecroix wrote:
>
> But it would be better with SR(2) ^ SR(QQbar(3).sqrt() + 
> QQbar(2).sqrt()) working 
>

You mean this?
sage: SR(2).power(SR(QQbar(3).sqrt() + QQbar(2).sqrt()), hold=True)
2^3.146264369941973?

 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
On Saturday, October 22, 2016 at 6:28:58 PM UTC+2, vdelecroix wrote:
>
> ... The behavior of any operation in Sage is that 
> the parent of op(a, b) should only depend on the operator op, 
> parent(a) and parent(b). Powers are a bit special but not enough to 
> use conversion instead of coercion. 
>

Reference, please? This seems quite important but I cannot find
it in the developer manual.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
On Saturday, October 22, 2016 at 4:04:55 PM UTC+2, John Cremona wrote:
>
> So Ralf,  do you want to catch the case where the exponent in QQbar is 
> actually rational and then do what QQbar already knows how to do 
> (raise to a rational power), returning an element of QQbar;  and raise 
> an Error of some kind in the other case?


Exactly, if noone is objecting.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
I see, you're thinking algebraically not computationally. The latter view
would try to convert to QQ, and only then try to coerce, in order to catch
the rational case first and not give an error where none is expected.

On Saturday, October 22, 2016 at 3:11:50 PM UTC+2, John Cremona wrote:
>
> On 22 October 2016 at 09:37, Ralf Stephan > 
> wrote: 
> > sage: 2*(QQbar(1)) 
> > 2 
> > sage: 2^(QQbar(1)) 
> > ... 
> > TypeError: no canonical coercion from Algebraic Field to Rational Field 
> > 
> > Why does the one work, the other not? Is it a bug? 
>
> I don't see that as a bug.  Any product of an integer and an element 
> of QQbar is defined, and is again an element of QQbar, but not any 
> integer raised to a QQbar exponent.  I think it is a rather hard 
> question to determine for which algebraic numbers a is 2^a algebraic! 
>
> John Cremona 
>
> > 
> > Regards, 
> > 
> > -- 
> > 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 sage-support...@googlegroups.com . 
> > To post to this group, send email to sage-s...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] QQbar coercion question

2016-10-22 Thread Ralf Stephan
sage: 2*(QQbar(1))
2
sage: 2^(QQbar(1))
...
TypeError: no canonical coercion from Algebraic Field to Rational Field

Why does the one work, the other not? Is it a bug?

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: How do I make assume conclude basic consequences?

2016-10-08 Thread Ralf Stephan
On Saturday, October 8, 2016 at 12:14:23 PM UTC+2, Rob H. wrote:
>
> sage: var('A,B')
> sage: assume(A>1)
> sage: assume(B>A)
> sage: bool(2*B>A)
> False
>

Maxima 5.37.2:

(%i1) assume(a>1);
(%o1)   [a > 1]
(%i2) assume(b>a);
(%o2)   [b > a]
(%i3) is(2*b>a);
(%o3)   unknown
 
SymPy:

In [4]: ask(Q.is_true(2*y>x), Q.is_true(x>1) & Q.is_true(y>x))

In [5]:

There is no SMT solver capability in Sage, nor its subsystems.
I know there are plans for this in SymPy. Plans we have too:
https://trac.sagemath.org/ticket/19162

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: possible regression in piecewise plotting?

2016-10-05 Thread Ralf Stephan
On Thursday, September 29, 2016 at 7:34:37 PM UTC+2, kcrisman wrote:
>
> P = piecewise([((0,2),x),((2,6),2)])
> print P
> plot(P)
>

However, previously plotting piecewise functions by default plotted the 
> entire thing (since they didn't go out to infinity).  I understand the 
> consistency, but also suspect this might have just been overlooked.  Any 
> thoughts?
>

It has been overlooked because the only plotting doctest has x in (-1,1).
Please review https://trac.sagemath.org/ticket/21618 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: sage crash report

2016-09-16 Thread Ralf Stephan
Looks like C++ ABI mismatch. While gcc-4.8.4 should work
you maybe want to install a newer version. What Sage version
is this?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Easy way to combine fractions in Sage?

2016-09-12 Thread Ralf Stephan
On Monday, September 12, 2016 at 9:26:34 PM UTC+2, saad khalid wrote:
>
> I couldn't find a better solution, so I made this:
>
> https://trac.sagemath.org/ticket/21477
>

That has nothing to do with combining fractions. Also, numerics alone in the
denominator can in principle not be combined because the resulting 
expression
will be immediately expanded again (try it).

The ex.combine() member function will combine symbolic denominators.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Simple Equation Substitution Fails

2016-09-07 Thread Ralf Stephan
On Wednesday, September 7, 2016 at 11:10:48 AM UTC+2, slelievre wrote:
>
> The problem is that subtracting `r2 - 3 * r^2` yields an expression
> whose expression tree no longer contains `(x^2 + y^2 + z^2)`.
>

I consider it a bug and an equivalent case is substituting in the
denominator, the fix of which needs review:
https://trac.sagemath.org/ticket/21071

sage: ((1+x^2)/x^2).subs({x^2: 42})
43/x^2


Thanks for the report.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Conversion of incomplete gamma function to sympy not working

2016-09-03 Thread Ralf Stephan
Please review

https://trac.sagemath.org/ticket/21407

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] how to factor elements in a list

2016-07-20 Thread Ralf Stephan
On Tuesday, July 19, 2016 at 8:46:36 PM UTC+2, John Cremona wrote:
>
> On 19 July 2016 at 19:37, saad khalid > 
> wrote: 
> >  50 
> > 
> > 
> > Why won't it factor it? 
>
> Because your number is in the symbolic ring: 
>
> sage: n = SR(50) 
> sage: factor(n) 
> 50 
>

Yes, and because the symbolic factor() converts the argument to
a polynomial ring element of a ring which doesn't do integer factorisation.
I consider this a bug of the symbolic factor().

https://trac.sagemath.org/ticket/21067

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: substituting into a Sage/Python function

2016-06-16 Thread Ralf Stephan
On Tuesday, June 14, 2016 at 10:07:30 PM UTC+2, john_perry_usm wrote:
>
> sage: f(t) = t^2 + 2
> sage: test_subs(f, 1, t)
> ...
> TypeError: no canonical coercion from  to Callable function 
> ring with argument t
>
>
I am not sure why you didn't try:
sage: test_subs(f(t),1,t) 
3

Of course it cannot work if you don't give a dependent var. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Substituting values for variables

2016-06-13 Thread Ralf Stephan
It's a bit unclear to me what you want, but have you tried
substituting your expressions, or writing a Python function
instead of a symbolic function gamma?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Possible bug in numerical integration

2016-06-07 Thread Ralf Stephan
In an SMC terminal session:

~$ sage
┌┐
│ SageMath Version 6.10, Release Date: 2015-12-18│
│ Enhanced for SageMathCloud.│
└┘

Really half a year behind, William?

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Getting Sage to give symbolic output with Variables

2016-06-06 Thread Ralf Stephan
On Thursday, June 2, 2016 at 10:19:21 PM UTC+2, saad khalid wrote:
>
> Thanks for the quick reply! Could you explain, or tell me what to search, 
> what exactly "SR("y%s"%i)" does?
>

It's SR("y%s"%i) or better SR("y%s" % i). The % is Python format string 
substitution, like C's sprintf.
 

> Is SR Symbolic Ring? Also, the output for the sum is close to perfect, 
> though it gives me:
>
> y1 + y10 + y11 + y12 + y13 + y14 + y15 + y16 + y17 + y18 + y19 + y2 + y20 + 
> y3 + y4 + y5 + y6 + y7 + y8 + y9
>
>
Yes. This is a feature because any fancy string detection during ordering 
would slow symbolic calculations considerably.

So, the order is a bit messed up. I wasn't sure if there was an easy way to fix 
that. 
>
>
If you think we need a pretty print function then please open a ticket.
 

> Also, running it with 
>
> R. = InfinitePolynomialRing(QQ)
> sum([5^k*y[k] for k in [1..20]])
>
> Seems to run for a very long time
>

Tell us too please how long. I get with 7.3beta3:
sage: %timeit sum([5^k*y[k] for k in [1..20]]) 
The slowest run took 5.17 times longer than the fastest. This could mean 
that an i
ntermediate result is being cached. 
1000 loops, best of 3: 264 µs per loop 
sage: %timeit sum([5^k*y[k] for k in [1..20]]) 
1000 loops, best of 3: 268 µs per loop 
sage: %timeit sum([5^k*y[k] for k in [1..20]]) 
1000 loops, best of 3: 263 µs per loop


Fast enough, I should say.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Possible bug in numerical integration

2016-06-06 Thread Ralf Stephan
On Friday, June 3, 2016 at 9:45:02 AM UTC+2, Peter Luschny wrote:
>
> plot([tanh(exp(i*t)).real(), 
> (exp(exp(i*t))/cosh(exp(i*t))-1).real()],t,0,2*pi) 
> The two functions are identical, the plot shows different functions. 
>

Your Sage is too old, this Pynac bug (existing for years) was fixed
months ago and should be in 7.2.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Speed comparison to Mathematica

2016-05-03 Thread Ralf Stephan
Even with (or especially because of) my CS background I would do it step by
step.

On Wed, May 4, 2016, 03:57 saad khalid  wrote:

> Thanks everyone for the responses. I guess I didn't know if there would be
> a speed difference between Cython and Mathematica the way there's a
> difference between C and Java(Even if it's less pronounced). I like the
> idea of implementing it in Sage to get a better grasp of sage/open-source
> development, that would be really good. On that end, would you recommend
> implementing it in C/python and then trying to add it as a function to
> Sage, or simply implement it within a sage worksheet? I've never done
> anything like this before, so I'm sorry if that's a rudimentary question.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/0PEjhQQ1AAE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Speed comparison to Mathematica

2016-05-03 Thread Ralf Stephan
sage -gdb will start Sage with the ability to fall to gdb when interrupted
with ctrl-c. If you have your C file handy produced from Cython you can set
breakpoints there and so on.  As said it's easy to see which Cython command
is represented by the C code.

On Tue, May 3, 2016, 19:30 john_perry_usm  wrote:

> On Monday, May 2, 2016 at 1:56:55 PM UTC-5, Ralf Stephan wrote:
>>
>> That you can't trace Cython is fortunately not true.
>> I do it from time to time using gdb when I trace pynac code.
>>
>
> Can you trace Cython *in Sage*? If so, I was genuinely unaware of that
> (or forgot).
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/0PEjhQQ1AAE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Speed comparison to Mathematica

2016-05-02 Thread Ralf Stephan
That you can't trace Cython is fortunately not true.
I do it from time to time using gdb when I trace pynac code.
Of course it's not C/Python but its cythonization, the
translated C code. The associated Cython is handily shown
in comments with the translation so you won't be lost. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Cannot integrate expanded expression

2016-03-11 Thread Ralf Stephan
It is always advisable to try Sympy or (if installed) Fricas on integrals.

sage: integrate(f,x,algorithm='fricas')
arctan(log(x))

SymPy however:

sage: integrate(f,x,algorithm='sympy')
...
AttributeError: 'RootSum' object has no attribute '_sage_'
which would need ticket #16816 implemented to work

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Order of multiple assumptions and is_positive/is_integer methods

2016-02-27 Thread Ralf Stephan
Assumptions in Sage matter only when using Maxima functionality.
The is_ functions query flags in the Pynac subsystem and only recently
we added support for changing of domain using the assume function.
There is however no positive integer domain in Pynac.

You will find that this missing ability doesn't affect Maxima functionality.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Problem solving an ode system

2016-01-04 Thread Ralf Stephan
Cannot confirm. Please always give all Sage commands you need for the case.
A cut-and-paste of your terminal session (including the sage: prompt) would 
be fine.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: ring series sqrt

2015-12-26 Thread Ralf Stephan
I have explained it better in
http://trac.sagemath.org/ticket/3354

but I'm still not sure if this is a bug, or the extend
keyword behaves as expected, so please comment.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] ring series sqrt

2015-12-25 Thread Ralf Stephan
How is the extend keyword to sqrt() of ring series supposed to be used?
I tried:

sage: K. = PowerSeriesRing(QQ, 5)
sage: two = K(2)
sage: sqrt2 = two.sqrt(extend=True, name='sqrt2')   
sage: (t+sqrt2^2).sqrt()
---
NotImplementedError   Traceback (most recent call last)


In any case I would expect the result to be

sqrt2 +sqrt2/4*t +sqrt2/32*t^2...

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] RealSet Problem

2015-10-22 Thread Ralf Stephan
On Wednesday, October 21, 2015 at 8:47:58 PM UTC+2, William wrote:
>
> sage: RLF(pi+1) < RLF(pi) 
> True   # umh, no! 


As long as symbolics gets ignored by most devs such errors will persist.
The above is due to

sage: (pi+1).__cmp__(pi)
-1

The main ticket for this is
http://trac.sagemath.org/ticket/16397

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: integral() bug report

2015-10-17 Thread Ralf Stephan
You should always try the other options Sage offers:

sage: integral(cos(x)/(1+sin(x)), x, -pi/6, pi/6, algorithm='sympy')
log(3)

Regards.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] A problem with doing integrations on cloud.sagemath.com

2015-10-15 Thread Ralf Stephan
On Wednesday, October 14, 2015 at 6:28:16 PM UTC+2, kcrisman wrote:
>
> Just as a point of info, "n" is not a variable by default, but rather 
> numerical approximation.  So you may want to do var('n') first.  This is 
> probably the issue.
>

As a data point, with var('n') I get here:

sage: f.integrate(p,-pi,pi)
2*pi*z*log(a^2 + z^2)*tanh(pi*z)

 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Is this an error in the math renderer?

2015-10-03 Thread Ralf Stephan
On Friday, October 2, 2015 at 10:54:11 AM UTC+2, Greg Sonnenfeld wrote:
>
> a3(a1,a0,a2)=(a2*a0^2)/(a1) + 1
> to(a1,a0,a2)=1/a0 * ( lambert_w(-1*e^(-1*a3(a1,a0,a2))) + a3(a1,a0,a2))
> show(to)
>
> Where as if i changed that lambert_w to a sin or a log, it rendered nice 
> and pretty. 
>

 Thanks, you found a bug: there are braces missing around %s in this line:
 in lambert_w._print_latex_ line 769:

return r"\operatorname{W_0}(%s)" % z


see http://trac.sagemath.org/ticket/19336

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Wrong indefinte integral

2015-07-18 Thread Ralf Stephan
On Friday, July 17, 2015 at 11:01:52 AM UTC+2, Johannes Lippmann wrote:
>
> What should I do now?
>

If the (default) Maxima subroutine does not satisfy, always try SymPy:

sage: integrate(x/(x^2+1),(x,0,infinity),algorithm='sympy')
+Infinity

Maxima when started without Sage says:

(%i1) integrate(x/(x^2+1),x,0,+inf);
defint: integral is divergent.

so you found an error in Sage's interface to Maxima.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: bug in == operator?

2015-07-14 Thread Ralf Stephan
On Monday, July 13, 2015 at 7:24:36 PM UTC+2, Volker Braun wrote:
>
> I suppose __nonzero__ should try to cast to QQbar and AA first before 
> trying maxima.
>

Fixed and needs review:
http://trac.sagemath.org/ticket/18896

With this Sage would also pass one more test from Wester's paper. 

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: a sage bug

2015-07-12 Thread Ralf Stephan
On Sunday, July 12, 2015 at 2:34:56 PM UTC+2, Stein William wrote:
> -- Forwarded message --
> From: ruiming zhang 
> Date: Sunday, July 12, 2015
> Subject: a sage bug
> To: wst...@math.washington.edu
> 
> ...
> e=x+1<=x-2
> e*(-1)
> -x-1<=-x+2,

This is known and has a fix. Only the review is missing.

If someone wants to review the fix, please see this ticket:
http://trac.sagemath.org/ticket/7660

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: [sage-cloud]: abs return negative value

2015-07-06 Thread Ralf Stephan
On Monday, July 6, 2015 at 8:15:54 PM UTC+2, Dima Pasechnik wrote:
>
> On Monday, 6 July 2015 18:05:18 UTC+1, Maurizio Parton wrote:
>>
>> On cloud.sagemath.com, on a brand new notebook, if I evaluate
>>
>> abs(-2^(1/2))
>>
>> the result is
>>
>> -sqrt(2)
>>
>> Expected result: sqrt(2) or abs(-sqrt(2))
>>
>> In my local installation (SageMath Version 6.6, Release Date: 2015-04-14, 
>> Ubuntu 15.04) it works fine. Any idea where could be the problem?
>>
>
> this is a bug...
> Note that -sqrt(2) is a symbolic expression, and taking its abs somehow 
> fails on recent Sage versions; 
> e.g on the latest 6.8.beta.
>

Fixed in Pynac-0.4.1, backport in Pynac-0.3.9.1 (it was there in 0.3.8
actually already but review is lagging) 

http://trac.sagemath.org/ticket/18537

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: X and Y values of plot points generated when using implicit_plot

2015-07-03 Thread Ralf Stephan
The OP now was able to post on ask.sagemath, and the
question was answered.
http://ask.sagemath.org/question/27249/x-and-y-values-of-plot-points-using-implicit_plot/

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Algebraic Field or Symbolic Ring ?

2015-06-30 Thread Ralf Stephan
On Tuesday, June 30, 2015 at 1:24:23 PM UTC+2, tdumont wrote:
>
> Why is xxc in Symbolic Ring and not in Algebraic Field? 
> mxx and xxc are essentialy the same thing, no ? 
>
> When you input sqrt(2) it is not clear which object you want,
Sage traditionally decides in favor of a symbolic. If you specifically
need the number field element you must say so with

sage: K. = QuadraticField(2)
sage: sqrt2^5
4*sqrt2

That said, I think the sqrt function of Rational (which is called here)
could be enhanced with an option to return a number field element
for convenience.

Regards,  

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Induction method

2015-06-10 Thread Ralf Stephan

>
> n = var('n',domain='integer')
> res = solve([n^2 == 3],n); print "res = ",res
>
> returns the weird answer :
>
> res =  [
> n == -sqrt(3),
> n == sqrt(3)
> ]
>
>
 But
sage: assume(n,'integer')
sage: solve(n^2-3,n)
[]

so it seems variable domains are not interpreted
as assumptions.

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: (Bug?) conjugate ignored by solve()

2015-05-25 Thread Ralf Stephan


On Monday, May 25, 2015 at 10:23:28 AM UTC+2, gschi...@gmail.com wrote:
>
>
> sage: sage: var('z'); conjugate(z+i)
> conjugate(z) - I
> # (as expected)
>
> # But:
> conjugate(z+i==0)
> z + I == 0
> # expected: conjugate(z) - I == 0
>
> Here's another example showing that the conjugate is simply dropped when 
> applied to an equality:
>
> sage: conjugate(conjugate(z)==0)
> conjugate(z)==0
>
> sage: conjugate(conjugate(z))
> z
>
> The equalities I'm criticizing are of course logically equivalent to the 
> original equalities, but simply dropping the conjugate is not what I 
> expected as a result.
> IMHO the conjugate of an equality should return the equality of the 
> conjugates of both sides. (Or leave the conjugate unevaluated.)
>

I think so too and so I have tried to fixed this in general months ago:
http://trac.sagemath.org/ticket/7660
Needs review.

Regards, 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: (Bug?) conjugate ignored by solve()

2015-05-24 Thread Ralf Stephan
Thanks for the report. I have opened
 http://trac.sagemath.org/ticket/18488

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Wrong symbolic integral.

2015-05-12 Thread Ralf Stephan
On Tuesday, May 12, 2015 at 10:06:56 AM UTC+2, Kristoffer Ryhl-Johansen 
wrote:
>
> Yeah, I was the one who posted that question, I don't know how maxima 
> works internally, but isn't it a bug that the asymptotic expansion is 
> missing, then?
>

In principle no, since there is no error or wrong output. It rather
depends on what is advertised---I haven't seen any CAS making claims
about minimal or simplest solutions.

So it's a missing feature/enhancement. 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Wrong symbolic integral.

2015-05-10 Thread Ralf Stephan
On Monday, May 11, 2015 at 7:57:40 AM UTC+2, Kristoffer Ryhl-Johansen wrote:
>
> What stops Maxima from evaluating the limit?
>

Missing asymptotic expansion of dilog, for example.

For the math see 
also http://math.stackexchange.com/questions/1275176/limit-with-polylog
 

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Wrong symbolic integral.

2015-05-10 Thread Ralf Stephan
On Saturday, May 9, 2015 at 1:47:46 PM UTC+2, Ruslan Abramchuk wrote:
>
> Ok, I see. But it is not very obvious.
> Technically topic is closed?
>
 
No, technically there are two bugs triggered in Sage. First, the limit is
given in the form compatible with Maxima not Sage (input the limit by
hand will give an error). This is known but unresolved, see
http://trac.sagemath.org/ticket/17892

Secondly, even if Sage could understand what Maxima says it couldn't
simplify the expression (via Maxima). This is a Maxima bug and should
be reported there. I don't think we have tickets tracking this, either.

Regards,

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sym Py vs Maxima for symbolic computation

2015-04-29 Thread Ralf Stephan
The main problem facing Sympy may be performance, because they explicitly 
use Python for everything. It shows for example 
in https://github.com/sympy/sympy/issues/2635

-- 
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 sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


  1   2   >