Sorry, I want to do:
1. solve exercises to сhapters 1-7
2. solve TODOs
3. may be realise "The Coupled Differential System"

What do you think about it?

File with the solutions of the first chapter exercises attached.

понедельник, 15 апреля 2013 г., 4:04:57 UTC+4 пользователь Aaron Meurer 
написал:
>
> Sorry, but if you're asking me a question here, I'm not really catching 
> what you're saying. I can tell you that there are a lot of TODOs in the 
> code that are good places to start (also check the pull request queue, 
> because some of the issues have already been solved by cheatiiit).
>
> Aaron Meurer
>
>
> On Sun, Apr 14, 2013 at 8:17 AM, Iurii Demidov 
> <iurii....@gmail.com<javascript:>
> > wrote:
>
>> Aaron, 
>> I read first chapter of *Symbolic Integration I: Transcendental 
>> Functions. *I can do several exercises, because difficult to correct 
>> defects from the start.
>>
>>
>>
>> if it's all right with you, then which file would I do that? I also try 
>> to understand risch.py, rde.py, and prde.py files.
>> You've already done all the work. I have only more accurately describe 
>> some of the cases and writing tests
>>
>>  -- 
>> 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 sympy+un...@googlegroups.com <javascript:>.
>> To post to this group, send email to sy...@googlegroups.com <javascript:>
>> .
>> Visit this group at http://groups.google.com/group/sympy?hl=en-US.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


""" Tests from Manuel Bronstein's book "Symbolic Integration I: Transcendental Functions"."""
from sympy import (gcd, invert, pdiv, Rational, gcdex, Integer, ZZ, QQ, half_gcdex, Poly)


from sympy.utilities.pytest import XFAIL
from sympy.polys.rings import ring
from sympy.abc import x

R = Rational
# chapter 1

def test_a1():
    # Exercise 1.1. Use the Euclidean Algorithm to compute the gcd of 217 and 413 in Z.
    assert gcd(217, 413) == 7


@XFAIL
def test_a2():
    # Exercise 1.2. Find integers x, y such, that
    # (a) 12*x + 19*y = 1.
    # (b) 3*x + 2*y = 5.
    x = Symbol('x', integer=True)
    y = Symbol('y', integer=True)
    raise NotImplementedError("solve (12*x + 19*y - 1)")
    raise NotImplementedError("solve (3*x + 2*y - 5)")


def test_a3():
    # Exercise 1.3. Find the inverse of 14 in Z_37
    assert  invert(17, 37) == 24


def test_a4():
    # Exercise 1.4. Compute the gcd of 2*x**3 - (19/5)*x**2 - x + 6/5 and x**2 + (1/3)*x - 14/3 in Q[x]
    assert gcdex(2*x**3 - R(19, 5)*x**2 - x + R(6, 5), x**2 + R(1, 3)*x - R(14, 3), domain='QQ') == (R(45, 442), -45*x/221 + R(201, 442), x - 2)


def test_a5():
    # Exercise 1.5. Compute the pseudo-quotient and pseudo-remainder of x**4 - 7*x + 7 by 3*x**2 - 7 in Z[x]
    assert  pdiv(x**4 - 7*x + 7, 3*x**2 - 7, domain='ZZ') == (9*x**2 + 21, -189*x + 336)


@XFAIL
def test_a6():
    # Exercise 1.6. Compute the quotient and remainder (or pseudo-quotient and pseudo-remainder)of 7*x**5 + 4*x**3 + 2*x + 1 by 2*x**3 + 3 in Z_5[x], Z_11[x], Z[x], Q[x]
    # In each case determine over which kind of algebraic structure you are computing.
    # I'm not sure that it is correct
    assert pdiv(7*x**5 + 4*x**3 + 2*x + 1, 2*x**3 + 3, domain='ZZ(5)') == (28*x**2 + 16, -84*x**2 + 16*x - 40)
    assert pdiv(7*x**5 + 4*x**3 + 2*x + 1, 2*x**3 + 3, domain='ZZ(11)') == (28*x**2 + 16, -84*x**2 + 16*x - 40)
    assert pdiv(7*x**5 + 4*x**3 + 2*x + 1, 2*x**3 + 3, domain='ZZ') == (28*x**2 + 16, -84*x**2 + 16*x - 40)
    assert pdiv(7*x**5 + 4*x**3 + 2*x + 1, 2*x**3 + 3, domain='QQ') == (28*x**2 + 16, -84*x**2 + 16*x - 40)


@XFAIL
def test_a7():
    # Exercise 1.7. Compute the primitive PRS and the subresultant PRS of x**4 + x**3 - t and x**3 + 2*x**2 + 3*t*x - t + 1 Z[t][x].
    R, x, t = ring("x,t", ZZ)
    f = x**4 + x**3 - t
    g = x**3 + 2*x**2 + 3*t*x - t + 1
    raise NotImplementedError(" R.dup_primitive_prs(f, g)")


def test_a8():
    # Exercise 1.8.Compute the gcd of 4*x**4 + 13*x**3 + 15*x**2 + 7*x + 1 and 2*x**3 +x**2 - 4*x - 3 in a) Q[x]and b) Z[x]
    assert  half_gcdex(4*x**4 + 13*x**3 + 15*x**2 + 7*x + 1, 2*x**3 +x**2 - 4*x - 3, domain='QQ') == (R(2, 35), x**2 + 2*x + 1)


def test_a9():
    # Exercise 1.9. Compute a squarefree factorization of x**8 - 5*x**6 + 6*x**4 + 4*x**2 - 8
    f = x**8 - 5*x**6 + 6*x**4 + 4*x**2 - 8
    assert Poly(f).sqf_list() == (1, [(Poly(x**2 + 1, x, domain='ZZ'), 1), (Poly(x**2 - 2, x, domain='ZZ'), 3)])

Reply via email to