Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 0 additions & 81 deletions packages/catlog/src/simulate/ode/linear_ode.rs

This file was deleted.

82 changes: 0 additions & 82 deletions packages/catlog/src/simulate/ode/lotka_volterra.rs

This file was deleted.

6 changes: 0 additions & 6 deletions packages/catlog/src/simulate/ode/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,7 @@ pub(crate) fn textplot_mapped_ode_result<Sys>(
}

pub mod kuramoto;
#[allow(non_snake_case)]
pub mod linear_ode;
#[allow(non_snake_case)]
pub mod lotka_volterra;
pub mod polynomial;

pub use kuramoto::*;
pub use linear_ode::*;
pub use lotka_volterra::*;
pub use polynomial::*;
17 changes: 17 additions & 0 deletions packages/catlog/src/simulate/ode/polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::ops::{Add, Neg};

use derivative::Derivative;
use indexmap::IndexMap;
use itertools::Itertools;
use nalgebra::DVector;
use num_traits::{One, Pow, Zero};

Expand Down Expand Up @@ -115,6 +116,21 @@ where
})
.collect()
}

/// Converts to a single aligned LaTeX environment.
pub fn to_latex_string(&self) -> String
where
Var: Display,
Coef: Display + PartialEq + One + Neg<Output = Coef>,
Exp: Display + PartialEq + One,
{
let equations = self
.to_latex_equations()
.into_iter()
.map(|p| p.lhs + " &= " + &p.rhs)
.join("\\\\\n");
format!("$$\n\\begin{{align*}}\n{}\n\\end{{align*}}\n$$\n", equations)
}
}

#[derive(Debug, PartialEq, Eq)]
Expand Down Expand Up @@ -184,6 +200,7 @@ where
///
/// Such a system is ready for use in numerical solvers: the coefficients are
/// floating point numbers and the variables are consecutive integer indices.
#[derive(PartialEq, Debug)]
pub struct NumericalPolynomialSystem<Exp> {
/// Components of the vector field.
pub components: Vec<Polynomial<usize, f32, Exp>>,
Expand Down
Loading
Loading