[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 105 KB, 900x920, math problems.jpg [View same] [iqdb] [saucenao] [google]
8771694 No.8771694 [Reply] [Original]

Is there a math formula which rounds down(floors) a number by simply using the number itself and basic math? By example: f(1,5)=1. Can we floor the number by only using the number itself and not picking out its decimal?

>> No.8771698

no

>> No.8771699

>>8771694
Yes, floor(x) is a simple fiction using basic math and only x

>> No.8771705

>>8771694
ceiling(x-1)

:^)

>> No.8771707

>>8771699
Using * / + - ^ etc. how would one do that?

>> No.8771709

f(n) = n - (n mod 1)
But that probably doesn't count for you.

>> No.8771711

>>8771707
Can't be done without logarithms

>> No.8771715

>>8771694

f(x) = x - (x % 1)

>> No.8771716

>>8771709
Sorry, you need to use ceil or floor for that and I don't know how to do those with "classic" math :/
Thanks for the try thought

>> No.8771717

Number - (number modulo 1).

Unless you meant in programming. In which case, just cast that shit to int.

>> No.8771727

>>8771711
Can do those by using ^
How do I do it with logarithms?

>> No.8771734

There's this but it's an infinite series and uses sin
https://en.wikipedia.org/wiki/Floor_and_ceiling_functions#Continuity_and_series_expansions

>> No.8771742

Step aside brainlettos, I got this

x-1/2+sin(2pi*x)/pi+sin(4pi*x)/(2pi)+sin(6pi*x)/(3pi)+...

>> No.8771753

>>8771742
can you make sin into it's basic formula too please?
Only +-*/^()

>> No.8771762

>>8771753
no that's dumb

>> No.8771766

>>8771753
not the guy but sin is also an infinite sum so you'll have infinite sums in an infinite sum and thats not rly cool

>> No.8771772

>>8771753
Change it to polynomial basis

>> No.8771785

>>8771762
That's sort of the point of it really, I'm trying to make a rediculousily long mathematical formula instead of default coding in a code I'm making.
So far I've got a replacement for if(a == a1 or b == b1 or c == c1...).
Now I'm trying to input many numbers as one, using 1,2453 as 1*2+4*5+3 etc.
Which is why it would be nice if it was completly basic math.

>> No.8771795

>>8771785
There's nothing you can do that isn't going to be absurdly more complicated than just solving it the natural way (either using the built-in function or if you aren't allowed for some reason just truncating the decimal)

>> No.8771806

>>8771795
>absurdly more complicated
I'm in

>> No.8771877

>>8771707
are you retarded?
*/+-^ are all continuous except at 0, so to make a floor function with discontinuities at every integer is impossible. The best you can do is an infinite sum using those operations in there somewhere.

>> No.8772211

>>8771694
Sure. [math]f(x) = \lfloor{x} \rfloor[/math]

>> No.8772228

>>8771705
not if x is already an integer you fucking stupid homophobic slur

>> No.8772292

>>8772211
What if the function maps from reals to the irrationals?

If you get a decimal number, multiply by powers of 10 to get an integer.
Then round that down to the nearest x where x is the power of 10 you used.
Finally, divide that number by 10^x to get your number.

>> No.8772299

>>8772292
Sorry, what I mean is if you have f(2) = 1.3,

Then multiply 1.3 by 10 to get 13.
Round 13 to the nearest 10, which is 10.
Divide 10 by 10 to get an answer of 1.