On Sat, Nov 15, 2014 at 10:07 AM, ast wrote:
> Hi
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
>x = x - floor(x)
>return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.7
On Sat, 15 Nov 2014 18:07:30 +0100, ast wrote:
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
> x = x - floor(x)
> return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)
ast wrote:
> Hi
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
> x = x - floor(x)
> return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1
> -
Hi
I needed a function f(x) which looks like sinus(2pi.x) but faster.
I wrote this one:
--
from math import floor
def sinusLite(x):
x = x - floor(x)
return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1
--
then i used module timeit