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

Discussion Overview

The discussion revolves around identifying a suitable name for a class of techniques related to programming functions, particularly those that cycle between values or generate specific sequences, such as odd numbers. Participants explore various mathematical representations and programming approaches to achieve these goals.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant seeks a resource for techniques to manipulate functions, specifically for cycling between values and generating odd numbers.
  • Another participant suggests a programming approach using a variable and modulo operations to achieve cycling, noting it may lack elegance compared to a mathematical function.
  • A participant emphasizes the need for a mathematical function form (f(n)) rather than a programming solution, indicating a shift in their requirements away from cycling between 1 and 2.
  • A mathematical expression is provided (f(n) = \frac{(-1)^n + 3}{2}) that cycles between 1 and 2, along with a suggestion that "cyclic function" could be a name for such functions.
  • Another mathematical expression (f(n) = 2n - 1) is presented as a mapping of natural numbers to odd numbers.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to the problem, with some advocating for programming solutions while others prefer mathematical formulations. The discussion remains unresolved regarding the optimal naming and techniques for the functions in question.

Contextual Notes

Participants have shifted their requirements throughout the discussion, indicating evolving problem constraints and a lack of consensus on the most effective methods or terminology.

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 [tex]-1^n[/tex]. 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.
 
[tex]f(n) = \frac{(-1)^n + 3}{2}[/tex]

Cycles between 1 and 2.

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


[tex]f(n) = 2n -1[/tex]

maps the natutral numbers onto the odd numbers.
 
Last edited:

Similar threads

  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · 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
4K