An intelligent computational reasoning system for scientific research
Note: This project is an experiment and a work in progress. All contributions are welcome!
Scientists and engineers face a gap between what they want to compute and how to compute it:
- Traditional tools require specifying exact operations: "Differentiate xΒ² + 2x"
- But researchers think in goals: "Find where this function has extrema"
- Complex problems require chaining multiple tools across domains
- Manual verification is tedious and error-prone
- Results lack reasoning traces for reproducibility
Agentic Mathematical Engine bridges this gap with an intelligent agent that:
- Understands natural language mathematical queries
- Plans multi-step solutions automatically
- Executes computations across seven mathematical domains
- Verifies results for correctness and physical validity
- Explains reasoning traces for full transparency
- Describe your goal in natural language
- Agent decomposes the problem into sub-goals
- Tools execute the required computations
- Verification ensures correctness
- Explanation provides reasoning trace
using AgenticMathematicalEngine
# Natural language query
response = solve("Design a Hohmann transfer from Earth to Mars with minimum fuel")
# Get results with full explanation
println(response.result) # Ξv = 5.59 km/s, transfer time = 259 days
println(response.explanation) # Step-by-step reasoning
println(response.confidence) # 0.95| Domain | Capabilities |
|---|---|
| Symbolic | Algebra, calculus, equation solving, simplification |
| Numerical | ODEs, PDEs, integration, optimization, N-body simulation |
| Tensor | General relativity, differential geometry, index manipulation |
| Coordinate | Reference frames, orbital mechanics, unit conversion |
| Propulsion | Rocket equations, delta-v budgets, trajectory optimization |
| Linear Algebra | Eigenanalysis, decompositions, matrix calculus |
| Physics | Electromagnetism, thermodynamics, fluids, quantum mechanics |
- Dynamic Planning β Automatically decomposes complex problems
- Tool Selection β Chooses appropriate methods for each sub-goal
- Verification β Checks units, conservation laws, physical bounds
- Replanning β Adapts when approaches fail
- Explanation β Generates reasoning traces for reproducibility
- Solar system body data (planets, moons)
- Physical constants with units
- Material properties
- Reference values for verification
- Julia 1.9 or higher
- ~2GB disk space for dependencies
git clone https://github.com/agenisea/agentic-mathematical-engine.git
cd agentic-mathematical-engine
julia --project=. -e 'using Pkg; Pkg.instantiate()'Amy uses Ollama with DeepSeek-R1 for LLM-powered reasoning. Ensure Ollama is running locally:
# Install Ollama (macOS)
brew install ollama
# Pull the DeepSeek-R1 model
ollama pull deepseek-r1:latest
# Start Ollama server (runs on localhost:11434 by default)
ollama serveusing AgenticMathematicalEngine
# Simple query
response = solve("What is the derivative of xΒ³ + 2xΒ²?")
println(response.result) # 3xΒ² + 4x
# Trajectory design
response = solve("Design a Hohmann transfer from LEO (400km) to GEO")
println(response.result.delta_v_total) # ~3.9 km/s
# Stability analysis
response = solve("Is the L4 Lagrange point stable for the Sun-Earth system?")
println(response.result) # STABLE (with eigenvalue analysis)agent = Agent()
response1 = agent("Set up a simple harmonic oscillator with Ο = 5 rad/s")
response2 = agent("Now add damping with ΞΆ = 0.3")
response3 = agent("Find the damped natural frequency")config = AgentConfig(
max_tool_calls = 50,
verification_level = :thorough, # :minimal, :standard, :thorough
explanation_detail = :verbose, # :brief, :standard, :verbose
timeout_seconds = 300,
)
response = solve("Complex multi-step problem...", config=config)The examples/ directory contains comprehensive demonstrations:
| Example | Description |
|---|---|
llm_demo.jl |
Interactive LLM demo with real-time event streaming |
trajectory_design.jl |
Orbital mechanics, mission design, gravity assists |
stability_analysis.jl |
Eigenvalue analysis, Lagrange points, control systems |
physics_simulation.jl |
Heat transfer, E&M, quantum mechanics, N-body |
symbolic_derivation.jl |
Calculus, series expansions, tensor calculus |
Run an example:
julia --project=. examples/trajectory_design.jlβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER QUERY β
β "Design a Hohmann transfer from Earth to Mars" β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REASONING AGENT β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ βββββββββββββ β
β β UNDERSTAND ββ β PLAN ββ β EXECUTE ββ β VERIFY β β
β β β β β β β β β β
β β Parse β β Decompose β β Run tools β β Check β β
β β intent β β into goals β β Get resultsβ β results β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββ βββββββββββββ β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β WORKING MEMORY β β
β β β’ Goal stack β’ Intermediate results β’ Confidence β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TOOL SUITE β
β βββββββββββ βββββββββββ βββββββββββ βββββββββββ ββββββββββββ β
β βSYMBOLIC β βNUMERICALβ β TENSOR β βCOORD β βPROPULSIONβ β
β β β β β β β β β β β β
β βsimplify β βsolve_odeβ βriemann β βkepler β βhohmann β β
β βdiff β βoptimize β βgeodesic β βephemerisβ βlambert β β
β βintegrateβ βnbody β βcontract β βtransformβ βdelta_v β β
β βββββββββββ βββββββββββ βββββββββββ βββββββββββ ββββββββββββ β
β βββββββββββ βββββββββββ ββββββββββββββββββββββββββββββββββ β
β β MATRIX β β PHYSICS β β VERIFICATION β β
β β β β β β β β
β βeigen β βmaxwell β β check_units check_conservationβ β
β βdecomposeβ βheat β β check_bounds numerical_verify β β
β βjacobian β βquantum β β β β
β βββββββββββ βββββββββββ ββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β OUTPUT β
β Result: Ξv_total = 5.59 km/s, Transfer time = 259 days β
β Reasoning: Decomposed into orbital parameters, vis-viva... β
β Confidence: 0.95 (verified against reference data) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Amy uses 5 specialized LLM agents orchestrated by a supervisor:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LLM AGENT PIPELINE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββ βββββββββββββββ βββββββββββββββ β
β β INTERPRETER βββββΆβ PLANNER βββββΆβ EXECUTOR β β
β β β β β β β β
β β Parse query β β Decompose β β Map goals β β
β β Extract β β into goal β β to tools β β
β β intent β β DAG β β Execute β β
β βββββββββββββββ βββββββββββββββ ββββββββ¬βββββββ β
β β β
β ββββββββββββββββββββββββββ΄βββββββββββββββββββββ β
β β β β
β βΌ βΌ β
β βββββββββββββββ βββββββββββββββ β
β β VERIFIER β β EXPLAINER β β
β β β β β β
β β Validate β β Generate β β
β β results β β natural β β
β β Check units β β language β β
β β & bounds β β explanation β β
β βββββββββββββββ βββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Agent | Role | Output Format |
|---|---|---|
| INTERPRETER | Parse natural language, extract intent & entities | Structured JSON intent |
| PLANNER | Decompose problem into goal DAG | Goal nodes with dependencies |
| EXECUTOR | Map goals to tools, prepare parameters | Tool call specifications |
| VERIFIER | Validate results against physical laws | Pass/Warn/Fail verdict |
| EXPLAINER | Generate human-readable explanations | Summary with LaTeX equations |
Amy uses a DAG-based parallel execution model to maximize throughput when goals are independent:
βββββββββββββββββββββββββββββββββββββββ
β PLANNER β
β Creates Goal DAG with deps β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββ
β PARALLEL SCHEDULER β
β Identifies independent goals β
β Groups into execution batches β
βββββββββββββββββββββ¬ββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FAN-OUT PHASE
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β GOAL 1 β β GOAL 2 β β GOAL 3 β
β (no deps) β β (no deps) β β (no deps) β
β β β β β β
β Execute β β Execute β β Execute β
β Tool A β β Tool B β β Tool C β
ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬βββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β VERIFIER β β VERIFIER β β VERIFIER β
β (parallel) β β (parallel) β β (parallel) β
ββββββββ¬βββββββ ββββββββ¬βββββββ ββββββββ¬βββββββ
β β β
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FAN-IN PHASE
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β THREAD-SAFE MEMORY β
β Collects results from all goals β
β Tracks verification status β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β NEXT BATCH β
β Goals with satisfied deps β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β GOAL 4 β β GOAL 5 β β GOAL 6 β
β (deps: 1,2) β β (deps: 2,3) β β (deps: 1) β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β EXPLAINER β
β Generates unified explanation β
βββββββββββββββββββββββββββββββββββββββ
| Feature | Description |
|---|---|
| DAG Scheduling | Goals form a directed acyclic graph; independent goals run concurrently |
| Batch Execution | Goals grouped into batches based on dependency satisfaction |
| Thread-Safe Memory | Concurrent writes protected with ReentrantLock |
| Parallel Verification | Each goal verified independently, can run alongside next batch |
| Automatic Fallback | Falls back to sequential execution for single-goal plans |
| Budget Management | Token budgets tracked per-agent with atomic counters |
# Automatic mode selection based on goal count and dependencies
config = PipelineConfig(
enable_parallel_execution = true, # Enable parallel when beneficial
max_concurrent_goals = 4, # Max parallel goals
enable_parallel_verification = true # Verify concurrently
)When Parallel Execution is Used:
- Plan has 2+ goals
- Goals have independent dependencies (can run in parallel batches)
- Budget permits concurrent LLM calls
When Sequential Execution is Used:
- Single goal plans
- Strictly linear dependencies (each goal depends on previous)
- Fallback mode (budget/circuit breaker constraints)
agentic-mathematical-engine/
βββ Project.toml # Julia package manifest
βββ Manifest.toml # Dependency lock file
βββ README.md # This file
βββ CONTRIBUTING.md # Contribution guidelines
βββ CODE_OF_CONDUCT.md # Community standards
βββ SECURITY.md # Security policy
β
βββ src/
β βββ AgenticMathematicalEngine.jl # Main module
β β
β βββ types/ # Core type definitions
β β βββ goals.jl # Goal & GoalStatus
β β βββ plans.jl # Plan & PlanStatus
β β βββ memory.jl # WorkingMemory
β β βββ tools.jl # ToolDefinition
β β βββ results.jl # AgentResponse, Explanation
β β
β βββ agent/ # Agent components
β β βββ core.jl # Main agent loop
β β βββ understanding.jl # Intent parsing
β β βββ planning.jl # Problem decomposition
β β βββ execution.jl # Tool invocation
β β βββ verification.jl # Result checking
β β βββ explanation.jl # Reasoning traces
β β
β βββ tools/ # Mathematical tools
β β βββ registry.jl # Tool registry
β β βββ symbolic.jl # Symbolic math
β β βββ numerical.jl # Numerical methods
β β βββ tensor.jl # Tensor algebra
β β βββ coordinate.jl # Coordinate systems
β β βββ propulsion.jl # Propulsion tools
β β βββ matrix.jl # Linear algebra
β β βββ physics.jl # Physics tools
β β βββ verification.jl # Verification tools
β β
β βββ strategies/ # Problem-solving strategies
β β βββ base.jl # Strategy interface
β β βββ trajectory.jl # Trajectory design
β β βββ stability.jl # Stability analysis
β β βββ derivation.jl # Mathematical derivation
β β βββ simulation.jl # Physics simulation
β β βββ optimization.jl # Optimization problems
β β
β βββ knowledge/ # Built-in knowledge
β β βββ constants.jl # Physical constants
β β βββ bodies.jl # Celestial body data
β β βββ materials.jl # Material properties
β β βββ references.jl # Reference values
β β
β βββ util/ # Utilities
β β βββ units.jl # Unit handling
β β βββ latex.jl # LaTeX generation
β β βββ logging.jl # Logging utilities
β β
β βββ llm/ # LLM Integration Layer
β β βββ client.jl # Ollama client
β β βββ events.jl # Event streaming
β β βββ parser.jl # Response parsing
β β βββ prompts.jl # Agent prompts
β β βββ fallback.jl # Fallback handlers
β β
β βββ orchestration/ # Multi-Agent Orchestration
β β βββ supervisor.jl # Pipeline supervisor
β β βββ parallel.jl # Parallel execution
β β βββ budget.jl # Token budget management
β β βββ resilience.jl # Circuit breakers
β β
β βββ prompts/ # Agent System Prompts
β βββ interpreter.md # Intent parsing prompt
β βββ planner.md # Goal decomposition prompt
β βββ executor.md # Tool invocation prompt
β βββ verifier.md # Result validation prompt
β βββ explainer.md # Explanation generation prompt
β
βββ examples/ # Example scripts
β βββ trajectory_design.jl
β βββ stability_analysis.jl
β βββ physics_simulation.jl
β βββ symbolic_derivation.jl
β
βββ test/ # Test suite
βββ runtests.jl
βββ unit/
βββ integration/
βββ validation/
- Julia 1.9+ β High-performance scientific computing
- Symbolics.jl β Computer algebra system
- DifferentialEquations.jl β ODE/PDE solvers
- Unitful.jl β Physical units with type safety
- Optim.jl β Optimization algorithms
- LinearAlgebra β Matrix operations
- ForwardDiff.jl β Automatic differentiation
This repo includes the original planning and agent-design docs used to architect the systemβshared intentionally for transparency and reuse. These documents are optional; the engine runs independently of them.
docs/blueprompt.mdβ App design spec (blueprompt.app)docs/agenisea.mdβ Multi-agent architecture spec
- Core agent architecture
- Seven mathematical domains
- Verification system
- Comprehensive examples
- LLM integration (Ollama/DeepSeek-R1)
- Multi-agent orchestration (5 specialized agents)
- Parallel execution with fan-out/fan-in
- Token budget management
- Circuit breaker resilience
- Web interface
- Jupyter notebook integration
- GPU acceleration for N-body
- More physics domains (plasma, relativity)
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone and setup
git clone https://github.com/agenisea/agentic-mathematical-engine.git
cd agentic-mathematical-engine
julia --project=. -e 'using Pkg; Pkg.instantiate()'
# Run tests
julia --project=. -e 'using Pkg; Pkg.test()'
# Run examples
julia --project=. examples/trajectory_design.jlMIT License - see LICENSE for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built by Ageniseaβ’ πͺΌ