pub struct ConservativeFields;Expand description
Conservative field analysis
Implementations§
Source§impl ConservativeFields
impl ConservativeFields
Sourcepub fn is_conservative(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> bool
pub fn is_conservative( vector_field: &[Expression], variables: Vec<Symbol>, ) -> bool
Check if a vector field is conservative (curl = 0)
§Examples
use mathhook_core::calculus::derivatives::ConservativeFields;
use mathhook_core::{Expression, symbol};
let x = symbol!(x);
let y = symbol!(y);
let conservative_field = vec![
Expression::symbol(x.clone()),
Expression::symbol(y.clone())
];
let is_conservative = ConservativeFields::is_conservative(&conservative_field, vec![x, y]);Sourcepub fn find_potential(
vector_field: &[Expression],
variables: &[Symbol],
) -> Option<Expression>
pub fn find_potential( vector_field: &[Expression], variables: &[Symbol], ) -> Option<Expression>
Find potential function φ such that F = ∇φ
§Examples
use mathhook_core::calculus::derivatives::ConservativeFields;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let conservative_field = vec![
Expression::mul(vec![Expression::integer(2), Expression::symbol(x.clone())]),
Expression::mul(vec![Expression::integer(2), Expression::symbol(y.clone())])
];
let potential = ConservativeFields::find_potential(&conservative_field, &[x, y]);Sourcepub fn is_irrotational(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> bool
pub fn is_irrotational( vector_field: &[Expression], variables: Vec<Symbol>, ) -> bool
Check if field is irrotational (curl = 0)
§Examples
use mathhook_core::calculus::derivatives::PartialUtils;
use mathhook_core::calculus::derivatives::VectorFieldOperations;
use mathhook_core::calculus::derivatives::ConservativeFields;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let z = symbol!(z);
let irrotational_field = vec![
Expression::symbol(x.clone()),
Expression::symbol(y.clone()),
Expression::symbol(z.clone())
];
let is_irrotational = ConservativeFields::is_irrotational(&irrotational_field, vec![x, y, z]);Sourcepub fn is_solenoidal(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> bool
pub fn is_solenoidal( vector_field: &[Expression], variables: Vec<Symbol>, ) -> bool
Check if field is solenoidal (divergence = 0)
§Examples
use mathhook_core::calculus::derivatives::ConservativeFields;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let solenoidal_field = vec![
Expression::symbol(y.clone()),
Expression::mul(vec![Expression::integer(-1), Expression::symbol(x.clone())])
];
let is_solenoidal = ConservativeFields::is_solenoidal(&solenoidal_field, vec![x, y]);Auto Trait Implementations§
impl Freeze for ConservativeFields
impl RefUnwindSafe for ConservativeFields
impl Send for ConservativeFields
impl Sync for ConservativeFields
impl Unpin for ConservativeFields
impl UnsafeUnpin for ConservativeFields
impl UnwindSafe for ConservativeFields
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more