Синус, косинус, квадратный корень FixedPoint

Вероятно, в сети, можно найти множество статей, касательно вычислениям с фиксированной точкой. По роду своей деятельности, я разработчик электроники и программист микроконтроллеров. Математика, с фиксированной точкой в моих задачах практически не встерчалась. Имеется фрезерный станок ЧПУ. Было принято решение, переделать его систему управления, используя ядро Cortex M3. Вобщем и целом, существуют программные пакеты, позволяющие сделать это. Например GRBL. Однако, у меня своя специфика. Для реализации ПО, потребовались математичесике операции sin(x), cos(x), sqrt(x). И я задумался над их реализацией в формате фиксированной точки. Для начала приступил к реализации функций sin(x), cos(x). Да, конечно, можно использовать табличные методы, но я пошел другим путем и решил реализовать апроксимацию, используя ряд Тейлора. Оценил участок, на котором буду раскладывать в ряд и приступил к реализации. Для разложения в ряд был выбран отрезок [0..PI/4], так как на этом отрезке, значение аргумента функции укладывается в промежуток [0..1], так и результат функции укладывается в отрезок от 0 до 1, таким образом со всеми числами можно работать как с 32-битными положительными дробными числами на интервале [0..0.9999(9)]. Единственное, значение cos(0), принимает значение 1.0., но я ограничился значением 0.9999(9). Таким образом удалось расширить диапазон значений на два бита. Бит знака и бит единичного разряда.Т.е. при вычислениий sin(x), cos(x), на этом отрезке, эффективно используются все 32-бита.

https://habr.com/ru/articles/904176/

#фиксированная_точка #sin #cos #sqrt

Синус, косинус, квадратный корень FixedPoint

Вероятно, в сети, можно найти множество статей, касательно вычислениям с фиксированной точкой. По роду своей деятельности, я разработчик электроники и программист микроконтроллеров. Математика, с...

Хабр

Have you ever told your teacher the dog ate your homework even though it was you who ate it.

Whoever came up with 'dont run around the house with scissors' had the same idea. And Jesus, with the rocks. Unless someone wants to eat them.

#sqrt

One day, one decomposition
A088007: Numbers n such that abs(sigma(n) - 2n) <= sqrt(n)

3D graph, threejs - webGL ➡️ https://decompwlj.com/3Dgraph/A088007.html
2D graph, first 500 terms ➡️ https://decompwlj.com/2Dgraph500terms/A088007.html

#decompwlj #maths #mathematics #OEIS #javascript #php #3D #numbers #abs #sigma #sqrt #graph #threejs #webGL

Decomposition into weight × level + jump of A088007 in 3D - three.js webGL - Rémi Eismann

Decomposition into weight × level + jump of A088007 in 3D. Made with three.js webGL. Rémi Eismann

One day, one decomposition
A064052: Not sqrt(n)-smooth: some prime factor of n is > sqrt(n)

3D graph, threejs - webGL ➡️ https://decompwlj.com/3Dgraph/Unusual_numbers.html
2D graph, first 500 terms ➡️ https://decompwlj.com/2Dgraph500terms/Unusual_numbers.html

#decompwlj #maths #mathematics #sequence #OEIS #javascript #php #3D #numbers #sqrt #smooth #prime #factor #graph #threejs #webGL

One day, one decomposition
A048098: Numbers k that are sqrt(k)-smooth: if p | k then p^2 <= k when p is prime

3D graph, threejs - webGL ➡️ https://decompwlj.com/3Dgraph/A048098.html
2D graph, first 500 terms ➡️ https://decompwlj.com/2Dgraph500terms/A048098.html

#decompwlj #maths #mathematics #sequence #OEIS #javascript #php #3D #numbers #sqrt #smooth #primenumbers #graph #threejs #webGL

@chrisheunen @JacquesC2 @rkaarsgaard i think the #sqrt(NOT) converted me to classical reversible computing many many moons ago .
brute force testing of 1/sqrt functions

brute force testing of 1/sqrt functions. GitHub Gist: instantly share code, notes, and snippets.

Gist

One day, one decomposition
A035336: a(n) = 2*floor(n*phi) + n - 1, where phi = (1+sqrt(5))/2

3D graph, threejs - webGL ➡️ https://decompwlj.com/3Dgraph/A035336.html
2D graph, first 500 terms ➡️ https://decompwlj.com/2Dgraph500terms/A035336.html

#decompwlj #maths #mathematics #sequence #OEIS #javascript #php #3D #numbers #floor #phi #sqrt #graph #threejs #webGL

#python #numpy #sqrt

The numpy.lib.scimath module provides a workaround for some of the limitations of the math module in Python. It includes a sqrt function that can handle negative numbers and returns complex results for negative inputs. A simple use case would be to calculate the square root of a negative number without raising a ValueError.

I wrote a #C implementation of the #SquareRoot #sqrt #algorithm , in binary, with 64.0 integer input and 32.32 fixed point output.

https://mathr.co.uk/web/square-root.html#C-Implementation

Square Root :: mathr

Methods for finding square roots.