Name for programming functions , i think

AI Thread Summary
The discussion focuses on finding a name for techniques that manipulate programming functions, particularly for cycling between values and generating odd numbers. A user seeks resources for tricks to achieve specific outputs, initially considering cycling between 1 and 2 and outputting odd numbers. Suggestions include using mathematical functions like f(n) = (-1)^n + 3 for cycling and f(n) = 2n - 1 for mapping natural numbers to odd numbers. The term "cyclic function" is proposed as a suitable name for these types of functions. The conversation emphasizes the blend of mathematical elegance and practical programming solutions.
trancefishy
Messages
75
Reaction score
0
name for "programming functions", i think...

I'm looking for the name of the class of techniques you use to get functions to do what you want. for example, if you wanted to cycle between odd and even, you would use -1^n. In particular, I want to cycle between 1 and 2, and also be able to output just odd numbers. A couple other things as well, but, this is for a problem I'm working on, and I'd like to just solve it myself. I'm just trying to find a resource that has perhaps a list of little tricks for functions. thanks.
 
Mathematics news on Phys.org
if it is a computer program, why not just have a variable, start at 0, increment by one and every n mod2 ==0 make your cycling variable 2, and when n mod2 == 1, set the variable to 1.

it is not as elegant as a simple mathematical function, but it is a nice solution.

to output just odd numbers, set it up simmilarly, but only output the incremented variable when n mod2 ==1.
 
If my problem were to be solved using a computer, it wouldn't even be a problem, simply an exercise. nope, this needs to be the good ol' f(n) form.

oh, and I've managed to simplify it, i no longer need to cycle 1 and 2 or get only odds, but, I've still got more complicated stuff than that, so, the question still stands.
 
oh, well I was confused then because you said "programming" in there.
 
f(n) = \frac{(-1)^n + 3}{2}

Cycles between 1 and 2.

Cyclic function is the only name that I can think of for this kind of function.


f(n) = 2n -1

maps the natutral numbers onto the odd numbers.
 
Last edited:
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top