Skip to content

codedthinking/SaddlePaths.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SaddlePaths.jl

Build Status Coverage

A Julia package for solving saddle-path problems in continuous-time macroeconomic models using stable manifold methods.

Features

  • Ergonomic DSL for declaring continuous-time macro models with Unicode notation
  • Automatic Variable Classification - States, costates, and parameters detected automatically
  • Isolated Namespaces - Each solution instance has its own variable namespace
  • Modular Backend System - Extensible architecture for different numerical methods
  • Comprehensive Testing - 242 parser + 75 namespace + 95 computation tests passing
  • 🔄 Backend Abstraction - Ready for spectral methods, finite differences, etc.
  • 🔄 Test-Driven Development - Extensive test suite with 60+ computation tests written

Installation

using Pkg
Pkg.add("SaddlePaths")

Quick Example

using SaddlePaths

# Define a Ramsey growth model with automatic variable classification
@model ramsey begin
    # c(k) notation automatically marks c as costate variable
    # Greek letters (α, δ, ρ) automatically detected as parameters
    # k is automatically classified as state variable
    𝑑c = c(k) ** k^- 1) - δ - ρ)
    𝑑k = k^α - δ * k - c(k)
end

# Model structure is automatically created:
# - state = [:k]
# - costate = [:c]
# - params = [:α, :δ, :ρ]

# Create numerical solution with isolated namespace
solution = NumericalSolution(ramsey, [0.3, 0.1, 0.05])  # α, δ, ρ

# Evaluate ODEs at specific points
state_vals = [1.5]    # k = 1.5
costate_vals = [0.8]  # c = 0.8
dk, dc = evaluate_all_odes(solution, state_vals, costate_vals)

# Clean up namespace when done
cleanup!(solution)

Current Implementation Status

  • Parser: Fully implemented with 242 tests passing
  • Namespace Management: Complete isolation system for multiple solutions (75/75 tests)
  • Backend Abstraction: Modular system for numerical methods
  • Numerical Solution: Complete with 95/95 tests passing
  • 🔄 Spectral Methods: Backend ready, awaiting library integration

Architecture

SaddlePaths.jl follows a clean, modular architecture:

  • Parser Module: DSL for model specification with automatic variable classification
  • Namespace Module: Isolated variable scopes for multiple solution instances
  • Backend Module: Abstract interface for different numerical methods
  • Computation Module: Numerical solution framework with ODE evaluation

Testing

The project uses comprehensive test-driven development:

# Run all tests
make test

# Run specific test suites
julia --project=. test/test_parser.jl     # 242/242 tests passing
julia --project=. test/test_namespace.jl  # 75/75 tests passing
julia --project=. test/test_computation.jl # 95/95 tests passing

Development Status

  • Lines of Code: ~2,900 total
  • Test Coverage: All modules fully tested with comprehensive test suites
  • Dependencies: None currently (ready for spectral method libraries)
  • Julia Version: 1.10+

Contributing

This project uses a test-driven development approach. New features should:

  1. Add comprehensive tests first
  2. Implement the functionality
  3. Ensure all tests pass

Documentation

For detailed documentation, see the docs.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published