opensrdk_symbolic_computation/expression/transcendental_expression/functions/
sin.rs1use std::collections::HashMap;
2
3use crate::{BracketsLevel, Expression, TranscendentalExpression};
4
5impl Expression {
6 pub fn sin(self) -> Self {
7 if let Expression::Constant(mut v) = self {
8 v.elems_mut().into_iter().for_each(|v| *v = v.sin());
9 return v.into();
10 }
11
12 TranscendentalExpression::Sin(self.into()).into()
13 }
14}
15
16impl TranscendentalExpression {
17 pub(crate) fn tex_code_sin(arg: &Box<Expression>, symbols: &HashMap<&str, &str>) -> String {
18 format!(
19 r"\sin\right({}\left)",
20 arg._tex_code(symbols, BracketsLevel::None)
21 )
22 }
23}