Phase 2 of the GSoC coding period is coming to an end. !! I and Sartaj had a meeting on the 18th of July, about the timeline of the next 4 weeks. Here are the deliverables that have been completed in this week, including the minutes of the meeting.

  • The FiniteFormalPowerSeries underwent a lot of changes. Firstly as had been discussed in the earlier meetings, that the order term in the compose, inverse and product functions need to be removed, so that the existing methods in FormalPowerSeries work upon it. So, I introduced three new subclasses of FiniteFormalPowerSeries, which were FormalPowerSeriesCompose, FormalPowerSeriesInverse, and FormalPowerSeriesProduct respectively. Now the three functions returned these three classes respectively.

All the three classes had a custom _eval_terms function, which basically contains the logic of changing the various infinite sequences into terms. Note that all functions of FormalPowerSeries were based on point by point logic, i.e. if you give a pt, you will get the ptth term. Here the calculation is based on term by term logic, i.e., given n you can get n terms upto that specified order.

The documentation for the three classes will give you much more clarity. The following is for FormalPowerSeriesProduct. The examples are given for the eval_terms function described in the class.

class FormalPowerSeriesProduct(FiniteFormalPowerSeries):
    """Represents the product of two formal power series of two functions.
    
    No computation is performed. Terms are calculated using a term by term logic,
    instead of a point by point logic.
    
    There are two differences between a `FormalPowerSeries` object and a
    `FormalPowerSeriesProduct` object. The first argument contains the two
    functions involved in the product. Also, the coefficient sequence contains
    both the coefficient sequence of the formal power series of the involved functions.
    
    See Also
    ========
    
    sympy.series.formal.FormalPowerSeries
    sympy.series.formal.FiniteFormalPowerSeries
    
    Examples
    ========
    
    >>> from sympy import fps, sin, exp, convolution
    >>> from sympy.abc import x
    >>> f1 = fps(sin(x))
    >>> f2 = fps(exp(x))
    >>> fprod = f1.product(f2, x)
    
    >>> fprod._eval_terms(4)
    x**3/3 + x**2 + x
    
    """

The following is for FormalPowerSeriesCompose. The examples are given for the eval_terms function described in the class.

class FormalPowerSeriesCompose(FiniteFormalPowerSeries):
    """Represents the composed formal power series of two functions.
    No computation is performed. Terms are calculated using a term by term logic,
    instead of a point by point logic.
    
    There are two differences between a `FormalPowerSeries` object and a
    `FormalPowerSeriesCompose` object. The first argument contains the outer
    function and the inner function involved in the omposition. Also, the
    coefficient sequence contains the generic sequence which is to be multiplied
    by a custom `bell_seq` finite sequence. The finite terms will then be added up to
    get the final terms.
    
    See Also
    ========
    
    sympy.series.formal.FormalPowerSeries
    sympy.series.formal.FiniteFormalPowerSeries
    
    Examples
    ========
    
    >>> from sympy import fps, sin, exp, bell
    >>> from sympy.abc import x
    >>> f1 = fps(exp(x))
    >>> f2 = fps(sin(x))
    
    >>> fcomp = f1.compose(f2, x)
    
    >>> fcomp._eval_terms(6)
    -x**5/15 - x**4/8 + x**2/2 + x + 1
    
    >>> fcomp._eval_terms(8)
    x**7/90 - x**6/240 - x**5/15 - x**4/8 + x**2/2 + x + 1

    """

The following is for FormalPowerSeriesInverse. The examples are given for the eval_terms function described in the class.

class FormalPowerSeriesInverse(FiniteFormalPowerSeries):
    """Represents the Inverse of a formal power series.
    
    No computation is performed. Terms are calculated using a term by term logic,
    instead of a point by point logic.
    
    There is a single difference between a `FormalPowerSeries` object and a
    `FormalPowerSeriesInverse` object. The coefficient sequence contains the
    generic sequence which is to be multiplied by a custom `bell_seq` finite sequence.
    The finite terms will then be added up to get the final terms.
    
    See Also
    ========
    
    sympy.series.formal.FormalPowerSeries
    sympy.series.formal.FiniteFormalPowerSeries
    
    Examples
    ========
    
    >>> from sympy import fps, exp, cos, bell
    >>> from sympy.abc import x
    >>> f1 = fps(exp(x))
    >>> f2 = fps(cos(x))
    >>> finv1, finv2 = f1.inverse(), f2.inverse()
    
    >>> finv1._eval_terms(6)
    -x**5/120 + x**4/24 - x**3/6 + x**2/2 - x + 1
    
    >>> finv2._eval_terms(8)
    61*x**6/720 + 5*x**4/24 + x**2/2 + 1
    
    """

For more changes, you are welcome to look into PR #17134. Note that these are subclasses of FiniteFormalPowerSeries class, which actually contains the common polynomial function, and also the NotImplemented functions as well.

That’s it for this week. See you in the next week and the last phase. Till then, Adios!!