How do I detect which order of x?
On Tuesday, July 9, 2024 at 5:41:50 AM UTC-4 [email protected] wrote:
> Doesn't matter :
>
> ```
> >>> from sympy import *
> >>> x=symbols("x")
> >>> sin(x).series(x,0,10).args
> (x, -x**3/6, -x**7/5040, x**5/120, x**9/362880, O(x**10))
> ```
>
> The arguments tuple doesn't order `x` powers (and this isn't a problem,
> since (complex) multiplication is commutative. But
>
> ```
> >>> sin(x).series(x,0,10)
> x - x**3/6 + x**5/120 - x**7/5040 + x**9/362880 + O(x**10)
> ```
>
> The expression is still printed with ordered powers of `x`.
>
> HTH,
>
> Le mardi 9 juillet 2024 à 05:59:20 UTC+2, [email protected] a écrit :
>
>> Hi, I am a new user of SymPy. I wonder if the following result is a
>> bug? Anyway, the following code is a nuance. I am using the latest SymPy
>>
>> class TestSymPy (unittest.TestCase):
>> def testSin(self):
>> '''
>> The expansion is not ordered by x**n: x**7 before x**5
>> '''
>> x = sympy.Symbol('x')
>> sin = sympy.sin(x)
>> self.assertTupleEqual(sin.args, (x,))
>> e = sin.series(x, 0, 10)
>> self.assertTupleEqual(e.args, (x, -x**3/6, -x**7/5040, x**5/120,
>> x**9/362880, sympy.O(x**10)))
>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/3c745098-a32f-47b2-a5a9-24d859e9e5cfn%40googlegroups.com.