Git Product home page Git Product logo

Comments (6)

hannorein avatar hannorein commented on August 30, 2024

The syntax is:

var_dx = sim.add_variation()
var_dx.particles[j].x = 1

from rebound.

JonathanHammer2 avatar JonathanHammer2 commented on August 30, 2024

from rebound.

hannorein avatar hannorein commented on August 30, 2024

she was concerned that the variational equations implementation in Rebound only work with celestial variables, not with Cartesian variables.

That's not correct. The "vary" function is a convenience function that allows you to vary orbital elements. The function exists because it's non-trivial to map these variations to cartesian coordinates. Varying cartesian coordinates on the other hand is trivial. See below.

I’m wondering what the 1 signifies in initializing var_dx.particles[j].x = 1?

This is varying the x coordinate of the j-th particle. This is what you want for the Jacobian you mentioned. The "1" is just a normalization. You can use another other non-zero number. That would give you the same result if you divide it out again at the end. This is just coming from the fact that variational equations are invariant under multiplications with a constant. But really, there is no good reason to use a number other than 1 here.

then I should be able to get the derivate of earth eccentricity

Your setup looks good. But you want to keep a reference to all the var_dx, var_dy, ... variables. Right now you are overwriting them in the loop. Use an array and set var_dx[j]. After the integration you can get the matrix elements:

$$ \begin{bmatrix} \frac{dx_i}{dx_j} & \frac{dy_i}{dx_j} & \ldots \\ \frac{dx_i}{dy_j} & \frac{dy_i}{dy_j} & \\ \ldots & & \end{bmatrix} $$

using the syntax

var_dx[j].particles[i].x        var_dx[j].particles[i].y     ...
var_dy[j].particles[i].x        var_dy[j].particles[i].y
...

From that you can calculate

$$ \begin{bmatrix} \frac{de_i}{dx_j} & \frac{de_i}{dx_j} & \ldots \\ \frac{de_i}{dy_j} & \frac{de_i}{dy_j} & \\ \ldots & & \end{bmatrix} $$

using the chain rule. Just write down $e$ as a function of $x, y, z, \ldots$. The take the derivative of $e$ with respect to all the cartesian coordinates, multiply each derivate with the relevant matrix element, and add them up.

I hope that helps.

from rebound.

JonathanHammer2 avatar JonathanHammer2 commented on August 30, 2024

from rebound.

hannorein avatar hannorein commented on August 30, 2024

I'll close this issue for know, but feel free to re-open if you have more questions.

from rebound.

JonathanHammer2 avatar JonathanHammer2 commented on August 30, 2024

from rebound.

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.