#sqrt — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #sqrt, aggregated by home.social.
-
@peterluschny also, could you explain how you arrived upon your 2011 Maple program in https://oeis.org/A090674? I already knew a bit about the series for W(x) about x=-1/e (or as I prefer, Cayley/Euler T(x) about x=1/e) in https://oeis.org/wiki/User:Natalia_L._Skirrow/Euler's_tree_function#expansion_about_the_vertical_point, but have no idea how it relates to.
Here also is a SymPy translation of said program (I have found that ring_series operations are much more efficient than the regular series ones (taking a matter of centiseconds instead of seconds); its rs_LambertW primitive doesn't allow expanding about other points so I inverted it directly); I will next try likewisely expanding the Laplace transform to get a similar formula in Gregories, but the fact that this process should coincide with that threw me off considerably.from sympy import fraction,factorial2
from sympy.polys.domains import QQ
from sympy.polys.rings import ring
from sympy.polys.ring_series import rs_exp as exp,rs_nth_root,rs_series_reversion as invertdef A090674_A090675(N):
M=2*N+3
R,u,x = ring('u,x', QQ)
f = u*rs_nth_root(2*(1+exp(u,u,M)*(u-1))/u**2, 2,u,M) #sqrt(2*(1+exp(u)*(u-1)))
y = exp(invert(f,u,M,x),x,M).to_dict() #exp(1 + LambertW((x^2/2-1)/e))
return [-y.get((0,2*n+1))*factorial2(2*n+1) for n in range(1,N+1)] -
Синус, косинус, квадратный корень 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-бита.
-
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
-
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
-
@chrisheunen @JacquesC2 @rkaarsgaard i think the #sqrt(NOT) converted me to classical reversible computing many many moons ago .
-
Last few days, I ripped all #string #sqrt and mem #functions from my #antibrowser thin client. Not sure why puts is still there it must be embedded in a not-my-macro? dunno. No big surprise, the notstrtol state machine kicks the standard #gcc's at least I think it does. I had to add dummy writes to dev/null to coerce the compiler to not collapse a 10million iteration loop. Really happy with the result.
-
One day, one decomposition
A007066: a(n) = 1 + ceiling((n-1)*phi^2), phi = (1+sqrt(5))/23D graph #threejs #webGL ➡️ https://decompwlj.com/3Dgraph/A007066.html
2D graph, first 500 terms ➡️ https://decompwlj.com/2Dgraph500terms/A007066.html#decompwlj #math #mathematics #sequence #OEIS #javascript #php #3D #numbers #ceiling #phi #sqrt #graph
-
TL;DR: -fno-math-errno should always be set in C/C++ land. (unless you're using VC, then: I'm sorry)
libm is "still" burdened with language where some functions (most importantly sqrt & sqrtf) will set 'errno'. Compilers "respect" this by default. IEEE-754 won a long time ago. It's WAY past time to flip math-errno to default to off.
-
Comparison of basic 1/sqrt implementations. Short versions. Next is a version by Carlos F. Borges' which is correctly rounded except for 1 value per 2 power-of-two intervals (1 per 2 exponent values...like [1,4])
Test driver (& references to Borge) are in this gist: https://gist.github.com/Marc-B-Reynolds/9fb24a7a4ee915e6e973bf9f4d08c404
The driver also includes:
• 1/sqrt(x) - which I had forget to include.
• correctly rounded versions
• SSE rsqrt approx
• old skool quake approx (added a modernized one)