Name for programming functions , i think

  • Context: High School 
  • Thread starter Thread starter trancefishy
  • Start date Start date
  • Tags Tags
    Functions Programming
Click For Summary
SUMMARY

The discussion centers on identifying the class of techniques used to manipulate programming functions, particularly cyclic functions. The user seeks to cycle between values (1 and 2) and output odd numbers using mathematical expressions. The proposed functions include f(n) = (-1)^n + 3/2 for cycling and f(n) = 2n - 1 for mapping natural numbers to odd numbers. The term "cyclic function" is suggested as a suitable name for this type of function.

PREREQUISITES
  • Understanding of mathematical functions and their properties
  • Familiarity with programming concepts such as variables and incrementing
  • Knowledge of modular arithmetic (modulus operation)
  • Basic experience with function notation (f(n) representation)
NEXT STEPS
  • Research the concept of cyclic functions in mathematics
  • Explore modular arithmetic and its applications in programming
  • Learn about function manipulation techniques in programming languages
  • Investigate mathematical expressions for generating sequences of numbers
USEFUL FOR

Mathematicians, programmers, and computer scientists interested in function manipulation and mathematical modeling in programming contexts.

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:

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
65
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K