These are chat archives for symengine/symengine

3rd
Jun 2015
Isuru Fernando
@isuruf
Jun 03 2015 01:37

@certik, I will make sure __dealloc__ works before making the changes.

Sage has some kind of a directional infinity, but no ComplexInfinity.

sage: (3+4*I)*oo
(4/5*I + 3/5)*Infinity

Sympy doesn't have it, but has a ComplexInfinity

In [19]: (3+4*I)*oo
Out[19]: oo + oo*I

What should SymEngine implement?

Sumith Kulal
@Sumith1896
Jun 03 2015 11:45
Why is the method is_canonical() a member function of classes?
Say if I wrote the is_canonical() for Polynomial, how do I test it?
Sumith Kulal
@Sumith1896
Jun 03 2015 12:03
I think I've understood it now
Sumith Kulal
@Sumith1896
Jun 03 2015 12:12
It is used only in constructor assertion, right?
As of now, the Polynomial doesn't require any special checks for is_canonical() but I am adding it so that we can modify it later, as and when needed.
Sumith Kulal
@Sumith1896
Jun 03 2015 13:43
Given a mpz_class number and a Symbol, how do I generate the Mul of them?
Isuru Fernando
@isuruf
Jun 03 2015 13:45
mul(integer(a), b) where a is the mpz_class and b is the Symbol is the easiest way
Sumith Kulal
@Sumith1896
Jun 03 2015 13:47
But we have to use rcp(new Mul instead of mul, right?
Will rcp(new Mul(integer(a), b)) do?
Isuru Fernando
@isuruf
Jun 03 2015 13:48
No. mul(integer(a), b) is a slower but convenient way for users, but for speed you should use,
Mul::from_dict(integer(a), {{b, one}})
Sumith Kulal
@Sumith1896
Jun 03 2015 13:52
If it's a*b**c, then Mul::from_dict(integer(a), {{b, integer(c)}}) would do right?
Isuru Fernando
@isuruf
Jun 03 2015 13:54
Yes, as long as b**c cannot be simplified more
Sumith Kulal
@Sumith1896
Jun 03 2015 13:55
Yes
Pow doesn't have from_dict, so does Pow::Pow(b, integer(c) work for Symbol b and mpz_class c to generate b**c
or should I use pow(b, integer(c))?
Sumith Kulal
@Sumith1896
Jun 03 2015 14:06
Compiler is complaining as we cannot call constructor directly, so I am using the latter now.
Thanks @isuruf for the help.
Isuru Fernando
@isuruf
Jun 03 2015 14:17
Pow(b, integer(c)) should work
Sumith Kulal
@Sumith1896
Jun 03 2015 14:33
I'll try
Ondřej Čertík
@certik
Jun 03 2015 14:54
@isuruf You know, I always thought things like (4/5*I + 3/5)*Infinity or oo + oo*I are funky. I would just do Infinity (positive infinite quantity) and ComplexInfinity (infinite magnitude, undetermined complex phase), just like Mathematica (https://reference.wolfram.com/language/ref/Infinity.html, https://reference.wolfram.com/language/ref/ComplexInfinity.html). So both (4/5*I + 3/5)*Infinity and oo + oo*I become ComplexInfinity.
Well, WolframAlpha multiplies by 1/5 out of the blue: http://www.wolframalpha.com/input/?i=%283%2B4*I%29*oo
So it looks like Mathematica doesn't really simplify either. So I wouldn't worry about this too much right now.
@shivamvats yes, I think the rings can be extended for negative exponents
Ondřej Čertík
@certik
Jun 03 2015 15:00
@Sumith1896 yes, what @isuruf said is correct.
Isuru Fernando
@isuruf
Jun 03 2015 15:01
The result in WolframAlpha is because (4/5*I+3/5) is the unit vector in the direction of (4*I+3)
Ondřej Čertík
@certik
Jun 03 2015 15:02
@Sumith1896 The idea is that if you know your expression is already canonical, just construct the class directly (from_dict, or Pow(a, b)). As long as there are thorough tests (which are run in Debug mode), any problems will be caught by the is_canonical test in the constructor. If you do not know that your expression is canonical, then you need to use mul or pow, which will make it canonical (and thus they are slower).
@isuruf I see, good point.
I never found the arithmetic with infinities useful, so anything that is consistent I think is ok.
Sumith Kulal
@Sumith1896
Jun 03 2015 15:38
sympy/symengine#454 PR doesn't seem to have Travis build going on now?
Isuru Fernando
@isuruf
Jun 03 2015 15:40
Notice from travis:
Linux build processing stalled for .org jobs for a brief period of time. Your builds may experience longer delay before starting.
Sumith Kulal
@Sumith1896
Jun 03 2015 15:41
Ohh Thanks
Shivam Vats
@shivamvats
Jun 03 2015 16:24
@certik I've ported all the functions with Taylor expansions. Should I send create separate PRs for Taylor expansions and for Laurent series functions? The Taylor series PR can be merged early, then.
Ondřej Čertík
@certik
Jun 03 2015 18:16
@shivamvats split it into PRs as you see fit. It's better to split big work into small PRs, so that we can merge them independently, if possible. Also it's much easier to review smaller PRs than one big one. But sometimes it's not possible to split it, so just use your best judgement.
Ondřej Čertík
@certik
Jun 03 2015 18:25
@shivamvats ping me once it is ready for review
Sumith Kulal
@Sumith1896
Jun 03 2015 20:47
@certik If I take in parameter as const Polynomial &a, is a mutable?
If yes, then how do I change it?
Sumith Kulal
@Sumith1896
Jun 03 2015 20:57
My basic concern is this:
I take in const Polynomial &a, in the function I want to convert a to -a using neg_poly() how do I go about?