Giter Site home page Giter Site logo

Chebyshev in-place evaluation about anise HOT 2 CLOSED

nyx-space avatar nyx-space commented on June 12, 2024
Chebyshev in-place evaluation

from anise.

Comments (2)

ChristopherRabotin avatar ChristopherRabotin commented on June 12, 2024

chbint.c should work!

from anise.

ChristopherRabotin avatar ChristopherRabotin commented on June 12, 2024

Woop! This works, I just had to figure out where exactly to fetch the data. The velocity is still wrong, but the position is as good as what the other test has!

        let interval_length: f64 = exb_states.window_duration;

        let epoch_jde = epoch.as_jde_tdb_days();
        let delta_jde = epoch_jde - start_mod_julian_f64;

        let index_f = (delta_jde / interval_length).floor();
        // let mut offset = delta_jde - index_f * interval_length;
        // let index_f = (delta_jde / interval_length).floor();
        let mut offset = delta_jde - delta_jde.floor();

        // let mut offset = delta_jde - (delta_jde / interval_length).floor() * interval_length;

        let mut index = (delta_jde / interval_length).floor() as usize;
        if index == exb_states.position.len() {
            index -= 1;
            offset = interval_length;
        } else if index > exb_states.position.len() {
            return Err(NyxError::NoInterpolationData(format!(
                "No interpolation data for date {}",
                epoch
            )));
        }
        let pos_coeffs = &exb_states.position[index];

        let rcrd_radius_s = interval_length / 2.0;
        let s = (epoch_jde - (start_mod_julian_f64 + index_f * interval_length + rcrd_radius_s))
            / rcrd_radius_s;

        let s2 = 2.0 * s;
        let mut j = coefficient_count;
        let mut w = [0.0_f64; 3];
        let mut dw = [0.0_f64; 3];

        while j > 1 {
            w[2] = w[1];
            w[1] = w[0];
            w[0] = pos_coeffs.x[j - 1] + (s2 * w[1] - w[2]);

            dw[2] = dw[1];
            dw[1] = dw[0];
            dw[0] = w[1] * 2. + dw[1] * s2 - dw[2];
            j -= 1;
        }

        let x = pos_coeffs.x[0] + (s * w[0] - w[1]);
        let vx = w[0] + s * dw[0] - dw[1];

With code above, for X and VX:

[src/cosmic/cosm.rs:1120] ven2ear_state.x - 2.051_262_195_720_077_5e8 = -0.0004665851593017578
[src/cosmic/cosm.rs:1121] ven2ear_state.vx - 3.605_137_427_817_783e1 = 258.123891015126

Nominal code:

running 1 test
[src/cosmic/cosm.rs:1115] ven2ear_state.x - 2.051_262_195_720_077_5e8 = -0.0004665553569793701
[src/cosmic/cosm.rs:1116] ven2ear_state.vx - 3.605_137_427_817_783e1 = 1.9305446130601922e-10
test cosmic::cosm::tests::test_debug ... ok

from anise.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.