0
\$\begingroup\$

I was bored and sketched out this idea in pseudocode( I will try to turn it into C++ later) for taking a set of numeric data and manipulating it. I ran through it manually and it seems to put the data in a range [0, something]

count =
data[count] = { d_0, d_1, … , d_(count -1) }
sigma = $Σ_{a∈ℕ} data_a$
avg = sum / count

newData[count] = {}

for x in data
  append (x · avg)/count to newData

What I am curious about, is if this "doodle" has any potential uses, or if it can be extended somehow?

\$\endgroup\$
1
  • \$\begingroup\$ Also: I am very sorry that the MathJax will not render,my device dislikes markdown... \$\endgroup\$
    – Jordan
    Feb 24, 2020 at 3:27

1 Answer 1

1
\$\begingroup\$

Your computer will get bored, too, dividing (over?) by count over and again. Use
avg_count = sum / count / count - or
scale = something / sum

\$\endgroup\$
2
  • \$\begingroup\$ So... useless, I think is what you are saying? \$\endgroup\$
    – Jordan
    Feb 24, 2020 at 5:19
  • \$\begingroup\$ I guess I fail to see algorithm, and I'm not sure I like to see pseudocode here. From What topics can I ask about here?: actual code from a project rather than pseudo-code. \$\endgroup\$
    – greybeard
    Feb 24, 2020 at 5:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.