Code Monkey home page Code Monkey logo

Comments (6)

dbookstaber avatar dbookstaber commented on May 24, 2024

This is implemented in pull request #50

from py-ballisticcalc.

dbookstaber avatar dbookstaber commented on May 24, 2024

I implemented constant time-step calculation here: https://github.com/dbookstaber/py_ballistics/blob/time-step/py_ballisticcalc/trajectory_calc.py

However it looks like it will always take more iterations than the current method to achieve any particular level of precision, so I do not recommend pursuing this.

from py-ballisticcalc.

o-murphy avatar o-murphy commented on May 24, 2024

but in addition to the number of iterations, it is necessary to take into account the time for performing the calculation, it may turn out that due to a decrease in the number of calculations, the number of iterations can be increased without losing performance

we have to make a profiling and performance comparing
u can use timeit built-in module to got time some function are executing

from py-ballisticcalc.

dbookstaber avatar dbookstaber commented on May 24, 2024

By "iterations" I meant the number of passes through the #region Trajectory Loop to calculate any particular trajectory. (This is without regard to the zero-finding logic.)

I think the current method of setting the time step based on the velocity is optimal. Any other approach will create excess precision at some points and lower precision at others.

from py-ballisticcalc.

dbookstaber avatar dbookstaber commented on May 24, 2024

To improve efficiency, JBM recommends switching from this simple integration approach to something like RK4, which is what he uses.

from py-ballisticcalc.

dbookstaber avatar dbookstaber commented on May 24, 2024

I implemented RK4 integration in this branch. It is more robust than the Euler implementation we are running, meaning that as step_size increases errors grow more slowly. However on the example I studied it's not like orders of magnitude better.

This provides a foundation for some desirable improvements, including:

  1. Adaptive step_size
  2. I included two different RK4 implementations, one using time and the other using range.x as the independent variable. The latter (CalcMethod.RK_dx) version could particularly benefit TrajectoryCalc.zero_angle since, as long as zero_distance % step_size == 0 then it will end exactly at the distance of interest.

from py-ballisticcalc.

Related Issues (18)

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.