And to make it even faster

Jump to navigation Jump to search
Revision as of 23 September 2017 at 15:56.
The highlighted comment was created in this revision.

And to make it even faster

       double x = bulletSpeed;
       double a = -3.508129323E-5;
       double b = 2.460363294E-3;
       double c = -6.666318894E-2;
       double d = 8.545020365E-1;
       double e = -3.337830707;
       double angle = a * x * x * x * x + b * x * x * x + c * x * x + d * x + e;
       return Math.sin(angle) / (bulletSpeed / 8 - Math.cos(angle));
    Xor (talk)13:33, 23 September 2017

    btw, you can try newton's method to find the max value ;)

      Xor (talk)13:40, 23 September 2017

      I know. But calculated numbers weren't exact and Wolfram Alpha's computation time exceeds.

        Dsekercioglu (talk)13:43, 23 September 2017
         

        Precision is up to 9 numbers. I think that it is enough.

          Dsekercioglu (talk)13:45, 23 September 2017
           

          Sorry, I didn't see that you changed the code. In my robot I did it like that but it is more understandable with Math.pow(x, y).

            Dsekercioglu (talk)13:55, 23 September 2017

            Math.pow makes me think something like e^x, but it turned out to be polynomial.

              Xor (talk)13:59, 23 September 2017
               

              Wow, I had no idea that the escape angle could be 15% bigger than traditional MEA calculation at the most common bulletspeed of 1.9 . . . Seems like my list of things to do for GresSuffurd to become top-10 again, gets bigger and bigger.

                GrubbmGait (talk)16:56, 23 September 2017