Struct F1D

Source
pub struct F1D(/* private fields */);
Expand description

Representation of a 1D function

Implementations§

Source§

impl F1D

Source

pub fn derive(&self, order: usize) -> Self

Computes the nth-derivative

use ruut_functions::{f1d, F1D};

let f = f1d!("x^log(x)");
let df = f.derive(1);
assert_eq!(df, f1d!("2ln(x)x^ln(x)/x"));
assert_eq!(df.derive(1), f.derive(2));
Source§

impl F1D

Source

pub fn eval(&self, x: f64) -> f64

Evaluates function at x

Source§

impl F1D

Source

pub fn integrate(&self, a: f64, b: f64, steps: u32) -> f64

Computes the definite integral of F1D

use ruut_functions::{F1D,f1d};

let func = f1d!("x^2+6");

assert!(func.integrate(0.,1., 10_000) - 6.33333 < 0.00001)
Source§

impl F1D

Source

pub fn set_par(&mut self, name: &str, val: f64)

Set param value by name

use ruut_functions::{f1d, F1D};

let mut f = f1d!("x+[a]^2");
f.set_par("a", 6.9);
assert!(f.eval(4.20) - 51.81 < 0.0001);
f.set_par("a", 1.2);
assert!(f.eval(4.20) - 5.64 < 0.0001);
Source§

impl F1D

Source

pub fn new(input: &str) -> Result<Self, ParsingError>

Creates a new function from a str

Source

pub fn latex(&self) -> String

Returns a string in latex format

Trait Implementations§

Source§

impl Add<F1D> for F2D

Source§

type Output = F2D

The resulting type after applying the + operator.
Source§

fn add(self, rhs: F1D) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<F1D> for F3D

Source§

type Output = F3D

The resulting type after applying the + operator.
Source§

fn add(self, rhs: F1D) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<F1D> for F2D

Source§

fn add_assign(&mut self, rhs: F1D)

Performs the += operation. Read more
Source§

impl AddAssign<F1D> for F3D

Source§

fn add_assign(&mut self, rhs: F1D)

Performs the += operation. Read more
Source§

impl Debug for F1D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for F1D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div<F1D> for F2D

Source§

type Output = F2D

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F1D) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<F1D> for F3D

Source§

type Output = F3D

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F1D) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<F1D> for F2D

Source§

fn div_assign(&mut self, rhs: F1D)

Performs the /= operation. Read more
Source§

impl DivAssign<F1D> for F3D

Source§

fn div_assign(&mut self, rhs: F1D)

Performs the /= operation. Read more
Source§

impl From<F1D> for F2D

Source§

fn from(value: F1D) -> Self

Converts to this type from the input type.
Source§

impl From<F1D> for F3D

Source§

fn from(value: F1D) -> Self

Converts to this type from the input type.
Source§

impl Mul<F1D> for F2D

Source§

type Output = F2D

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F1D) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<F1D> for F3D

Source§

type Output = F3D

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F1D) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<F1D> for F2D

Source§

fn mul_assign(&mut self, rhs: F1D)

Performs the *= operation. Read more
Source§

impl MulAssign<F1D> for F3D

Source§

fn mul_assign(&mut self, rhs: F1D)

Performs the *= operation. Read more
Source§

impl PartialEq for F1D

Source§

fn eq(&self, other: &F1D) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Sub<F1D> for F2D

Source§

type Output = F2D

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: F1D) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<F1D> for F3D

Source§

type Output = F3D

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: F1D) -> Self::Output

Performs the - operation. Read more
Source§

impl SubAssign<F1D> for F2D

Source§

fn sub_assign(&mut self, rhs: F1D)

Performs the -= operation. Read more
Source§

impl SubAssign<F1D> for F3D

Source§

fn sub_assign(&mut self, rhs: F1D)

Performs the -= operation. Read more
Source§

impl StructuralPartialEq for F1D

Auto Trait Implementations§

§

impl Freeze for F1D

§

impl RefUnwindSafe for F1D

§

impl Send for F1D

§

impl Sync for F1D

§

impl Unpin for F1D

§

impl UnwindSafe for F1D

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.