/fricas-seriessolve

Python replication of FriCAS seriesSolve functionality using SymPy

Primary LanguagePython

FriCAS seriesSolve Replication

A Python implementation replicating the power series differential equation solving functionality of FriCAS's seriesSolve function, built on top of SymPy.

Overview

This project provides tools for solving ordinary differential equations using power series methods, similar to the capabilities found in the FriCAS computer algebra system. The implementation focuses on finding series solutions around specified points with given initial conditions.

Features

  • Solve first and higher-order ordinary differential equations
  • Power series expansion around arbitrary points
  • Support for initial value problems
  • Integration with SymPy's symbolic computation capabilities
  • Educational examples demonstrating various ODE types

Installation

Prerequisites

  • Python 3.7+
  • SymPy

Setup

git clone https://github.com/Foadsf/fricas-seriessolve
cd fricas_seriessolve
pip install sympy

Usage

Basic Example

from seriessolve import solve_ode_series
import sympy as sp

x = sp.symbols('x')
y = sp.Function('y')

# Solve dy/dx + y = 0 with y(0) = 1
equation = sp.Eq(sp.diff(y(x), x) + y(x), 0)
solution = solve_ode_series(equation, y(x), x, 0, [1], precision=10)
print(solution)

Running Examples

python examples/000_basic_ode.py

Project Structure

fricas_seriessolve/
├── seriessolve.py          # Main library implementation
├── examples/               # Example scripts
│   └── 000_basic_ode.py   # Basic ODE examples
├── README.md              # This file
├── lessons_learned.md     # Development notes and lessons
└── .gitignore            # Git ignore patterns

Examples Included

  1. Exponential Decay: First-order linear ODE
  2. Harmonic Oscillator: Second-order ODE with cosine solution
  3. Sine Solution: Harmonic oscillator with different initial conditions
  4. Airy's Equation: Advanced example showing current limitations

Current Limitations

  • Airy's equation and similar cases require enhancement of the undetermined coefficients method
  • Complex differential equations may not always reduce to simple polynomial series
  • Limited to ODEs that SymPy can handle or simple recurrence relations

Contributing

This project is educational and focuses on replicating FriCAS functionality. Contributions should maintain compatibility with the original FriCAS seriesSolve behavior.

License

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.

Acknowledgments

  • FriCAS computer algebra system for the original seriesSolve implementation
  • SymPy project for providing the symbolic computation foundation