pub struct VectorFieldOperations;Expand description
Vector field operations for divergence, curl, and Laplacian
Implementations§
Source§impl VectorFieldOperations
impl VectorFieldOperations
Sourcepub fn divergence(
vector_field: &[Expression],
variables: Vec<Symbol>,
) -> Expression
pub fn divergence( vector_field: &[Expression], variables: Vec<Symbol>, ) -> Expression
Compute divergence ∇ · F for vector field F = [P, Q, R, …]
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::calculus::derivatives::Derivative;
use mathhook_core::calculus::derivatives::PartialUtils;
use mathhook_core::calculus::derivatives::VectorFieldOperations;
use mathhook_core::calculus::derivatives::ConservativeFields;
use mathhook_core::calculus::derivatives::FluidDynamicsOperations;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let z = symbol!(z);
let vector_field = vec![
Expression::symbol(x.clone()),
Expression::symbol(y.clone()),
Expression::symbol(z.clone())
];
let div = VectorFieldOperations::divergence(&vector_field, vec![x, y, z]);Sourcepub fn curl(
vector_field: &[Expression],
variables: &[Symbol],
) -> Vec<Expression>
pub fn curl( vector_field: &[Expression], variables: &[Symbol], ) -> Vec<Expression>
Compute curl ∇ × F for 3D vector field F = [P, Q, R]
§Examples
use mathhook_core::calculus::derivatives::VectorFieldOperations;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let z = symbol!(z);
let vector_field = vec![
Expression::symbol(y.clone()),
Expression::symbol(x.clone()),
Expression::integer(0)
];
let curl = VectorFieldOperations::curl(&vector_field, &[x, y, z]);Sourcepub fn laplacian(expr: &Expression, variables: Vec<Symbol>) -> Expression
pub fn laplacian(expr: &Expression, variables: Vec<Symbol>) -> Expression
Compute Laplacian ∇²f = ∂²f/∂x² + ∂²f/∂y² + … for scalar field f
§Examples
use mathhook_core::simplify::Simplify;
use mathhook_core::calculus::derivatives::Derivative;
use mathhook_core::calculus::derivatives::VectorFieldOperations;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let f = Expression::add(vec![
Expression::pow(Expression::symbol(x.clone()), Expression::integer(2)),
Expression::pow(Expression::symbol(y.clone()), Expression::integer(2))
]);
let laplacian = VectorFieldOperations::laplacian(&f, vec![x, y]);Sourcepub fn gradient_magnitude(
expr: &Expression,
variables: Vec<Symbol>,
) -> Expression
pub fn gradient_magnitude( expr: &Expression, variables: Vec<Symbol>, ) -> Expression
Compute gradient magnitude |∇f| = √(∂f/∂x)² + (∂f/∂y)² + …
§Examples
use mathhook_core::calculus::derivatives::VectorFieldOperations;
use mathhook_core::{Expression};
use mathhook_core::symbol;
let x = symbol!(x);
let y = symbol!(y);
let f = Expression::pow(Expression::symbol(x.clone()), Expression::integer(2));
let grad_mag = VectorFieldOperations::gradient_magnitude(&f, vec![x, y]);Auto Trait Implementations§
impl Freeze for VectorFieldOperations
impl RefUnwindSafe for VectorFieldOperations
impl Send for VectorFieldOperations
impl Sync for VectorFieldOperations
impl Unpin for VectorFieldOperations
impl UnsafeUnpin for VectorFieldOperations
impl UnwindSafe for VectorFieldOperations
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