general
Jump to date
Tuesday, March 2, 2021
using only the basic operations +, -, *, /, and ^, is it possible to make a function that outputs '1' if input x = a, and '0' if input x != a?
I assume you do not want the obvious answer of a piecewise defined function
it would have to be a piecewise defined function now that I think about it, because what you are asking for is a function f(x) = 0 except at a, where f(a) = 1
there is no continuous way to do that
i c
Yes hello
would it be possible for only integers though
it is actually not possible
let me draw you a graph
what you are asking for is this pirate
addition, subtraction, division (except with zero), multiplication, and exponents are all continuous operations
so any combination of them would yield a continuous function
this is not continuous
ergo, you cannot have a function made of those continuous operations that gives you what you want
tragic
If you allow piecewise functions its trivial
this only uses those operations (specifically none of them)
and is a function
I can make a function that arbitrarily approaches what you want though
my dreams and ambitions are already shattered so it's fine
although if you could make one that is 0/1 for whole numbers but continous between them
that would be a little cool at least
as d -> infinity, this will look more and more like what you want
that looks like this with d=100000
but when you zoom in its clearly not exactly what you want
this demonstrates the dynamics of the problem though
so full marks
what do you mean by 0/1
do you mean 0 or 1,
something like
for every whole number besides 1 it's 0
feels like that would be possible
but it can be continous inbetween
so f(2) = f(3) = ... = 0
but f(1) =/= 0
well f(a) =/= 0, meant 1 as in one of the numbers
oh you are saying, for all integers except one integer a, f = 0
okay
I am struggling to think of an example that would work for that. It cannot be a polynomial equation (except if you allow for an infinite polynomial)
for example
like, this would be zero for all positive integers greater than 1
oh wait
i was asking about that because someone else I asked had come up with something
but turns out they cheated and used an infinite product
that makes more sense
the graph of what I wrote is actually kind of ridiculous though
if you allow infinite sums instead of infinite products, and accept all integers being zero
taylor series for sinx but replace x with pi x
but I don't think there is a finite way to ensure it holds for all whole numbers
pirate why did this topic come up
there's a person in another server who asked me for 'ridiculous math problems'
the first one i gave was
actually the month/day/year thing from here
that one was fun
I still have that code
they ignored leap years so they were off by a bit
I ignored them too
interesting
leap years are a pain to code around
they said 26.9% of days would be unique
let me get my code
while yours was 29
iirc
oh you had that saved
still i wonder which one is the most accurate
I only ran it from year 1 to 2020
