Skip to content

Commit

Permalink
Incorporated msub identifier for state variables in first order ode (#…
Browse files Browse the repository at this point in the history
…438)

Added msub identifie support for state variables in first order ode.

Co-authored-by: Deepsana Shahi <[email protected]>
  • Loading branch information
deepsana and Deepsana Shahi authored Sep 6, 2023
1 parent 224228a commit a56fd99
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions skema/skema-rs/mathml/src/parsers/first_order_ode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,3 +1020,24 @@ fn test_first_order_ode() {
assert_eq!(lhs_var.to_string(), "S");
assert_eq!(rhs.to_string(), "(/ (* (* (- β) I) S) N)");
}

#[test]
fn test_msub_derivative() {
test_parser(
"<mfrac>
<mrow><mi>d</mi><msub><mi>S</mi><mi>v</mi></msub></mrow>
<mrow><mi>d</mi><mi>t</mi></mrow>
</mfrac>",
first_order_derivative_leibniz_notation,
(
Derivative::new(1, 1),
Ci::new(
None,
Box::new(MathExpression::Msub(
Box::new(MathExpression::Mi(Mi("S".to_string()))),
Box::new(MathExpression::Mi(Mi("v".to_string()))),
)),
),
),
);
}
1 change: 1 addition & 0 deletions skema/skema-rs/mathml/src/parsers/interpreted_mathml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ pub fn first_order_derivative_leibniz_notation(input: Span) -> IResult<(Derivati
r#type: Some(Type::Function),
content,
}),
ci_subscript,
)))(s)?;
let (s, _) = tuple((
etag!("mrow"),
Expand Down

0 comments on commit a56fd99

Please sign in to comment.