Skip to content

Are the real numbers a normed space? #89

@mgeier

Description

@mgeier

I'm very much not a mathematician, nor am I a Rust expert, so please forgive me if this is a silly question.

I'm working on a spline implementation which I will mostly use for 3D curves, but I would also like it to work for 2D curves and for 1D (I don't know if those can still be called "curves").

For 2D and 3D I'm using vector types from the nalgebra crate (which implement several alga traits).

Since my implementation is supposed to work on any vector space that has a norm, I think it would make sense to use the alga::linear::NormedSpace trait bound.

For the 1D case I could of course use a 1D vector from nalgebra, but I think it would be much nicer if I could also use a "normal" scalar type, like e.g. f64.

This doesn't work though, because NormedSpace doesn't seem to be implemented for f64 (it looks like it's only implemented for Complex<N>).

Now my question: are real numbers a normed space?
I would think so, but what do I know ...

If that makes at least some mathematical sense, would it be possible to implement NormedSpace for scalars?

I'm thinking about something like this:

impl<T: RealField> NormedSpace for T {
    type RealField = T;

    ...

    fn norm(&self) -> T {
        self.abs()
    }

    ...
}

Or probably this should use ComplexField instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions