Metadata-Version: 2.1
Name: inteq
Version: 0.2.0
Summary: Solve various integral equations using numerical methods.
Home-page: https://github.com/mwt/inteq
Author: Matthew Wildrick Thomas
Author-email: matthew.thomas@northwestern.edu
License: MIT License
Project-URL: Bug Tracker, https://github.com/mwt/inteq/issues
Description: # Solve Volterra and Fredholm integral equations
        
        This Python package estimates Volterra and Fredholm integral equations using known techniques.
        
        ## Volterra
        
        ![plot generated by package](https://raw.githubusercontent.com/mwt/inteq/main/assets/volterra-example.svg)
        
        This package provides the function `SolveVolterra` which approximates the solution, g(x), to the Volterra Integral Equation of the first kind:
        
        ![f(s) = \int_a^s K(s,y) g(y) dy](https://raw.githubusercontent.com/mwt/inteq/main/assets/volterra-equation.svg)
        
        using the method in [Betto and Thomas (2021)](https://mattwthomas.com/papers/asymmetric-all-pay-contests-with-spillovers/). 
        
        See the "Trapezoid and Midpoint Rules" section for a discussion of these two rules.
        
        ### Parameters
        
        ```
        k : function
            The kernel function that takes two arguments.
        f : function 
            The left hand side (free) function with f(a) = 0.
        a : float
            Lower bound of the integral, defaults to 0.
        b : float
            Upper bound of the estimate, defaults to 1.
        num : int
            Number of estimation points between zero and `b`.
        method : string
            Use either the 'midpoint' (default) or 'trapezoid' rule.
        ```
        
        ### Returns
        
        ```
        grid : 2-D array
            Input values are in the first row and output values are in the second row.
        ```
        
        ## Fredholm
        
        ![Fredholm plot generated by package](https://raw.githubusercontent.com/mwt/inteq/main/assets/fredholm-example.svg)
        
        This package provides the function `SolveFredholm` which approximates the solution, g(x), to the Fredholm Integral Equation of the first kind:
        
        ![f(s) = \int_a^b K(s,y) g(y) dy](https://raw.githubusercontent.com/mwt/inteq/main/assets/fredholm-equation.svg)
        
        using the method described in [Twomey (1963)](https://doi.org/10.1145/321150.321157). It will return a smooth curve that is an approximate solution. However, it may not be a good approximate to the true solution.
        
        ### Parameters
        
        ```
        k : function
            The kernel function that takes two arguments.
        f : function 
            The left hand side (free) function that takes one argument.
        a : float
            Lower bound of the of the Fredholm definite integral, defaults to -1.
        b : float
            Upper bound of the of the Fredholm definite integral, defaults to 1.
        num : int
            Number of estimation points between zero and `b`.
        smin : float
            Optional. Lower bound of enforcement values for s.
        smax : float
            Optional. Upper bound of enforcement values for s.
        snum : int
            Optional. Number of enforcement points for s.
        ```
        
        ### Returns
        
        ```
        grid : 2-D array
            Input values are in the first row and output values are in the second row.
        ```
        
        # Trapezoid and Midpoint Rules
        
        Volterra integral equations are typically solved using the midpoint rule. However, the trapezoid rule often converges faster. See below an example of the trapezoid rule performing well with just six grid points.
        
        ![example of trapezoid rule converging faster](https://raw.githubusercontent.com/mwt/inteq/main/assets/trap-vs-mid1.svg)
        
        Thus, the trapezoid rule typically performs better. However, the trapezoid rule is less stable than the midpoint rule. An example where this this instability is an issue is provided below.
        
        ![example of trapezoid rule having issues](https://raw.githubusercontent.com/mwt/inteq/main/assets/trap-vs-mid2.svg)
        
        This can be remedied by smoothing the function. For example, with `inteq.helpers.smooth()`.
Platform: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.4
Description-Content-Type: text/markdown
