LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

function for summation

Obviously the formulaic approach is the best (bow to the master.....Smiley Wink), but in thinking about optimizing the iterative approach, you could remove the iterative +1 altogether, and just sum all the array elements then add N, since the summation result is one off for each iteration........
0 Kudos
Message 11 of 15
(790 Views)


Mellobuck wrote:
 
-Mello says math is fun

Try telling Ben that. Smiley Wink

___________________
Try to take over the world!
Message 12 of 15
(781 Views)
Just to summarize it all up, let's remember that Johann Carl Friedrich Gauss (1777 - 1855) got in trouble in elementary school when the teacher wanted to keep the students busy for a while by having them add the numbers 1...100. He solved it basically in an instant.
 
 
Too bad Gauss did not have LabVIEW. 😉
 
0 Kudos
Message 13 of 15
(775 Views)

In the story I heard it was Einstein... but I make no claims to it's truthfulness.

 

"I don't think that can be considered a mathematical proof, since you only show it on a single number. You have to do it with n and show that it's correct."

You are correct of course.  I should have said "a more intuitive illustration."  (I often run out of patience before working through proofs, but examples illustrate the concept for me in a much more concrete manner.)

0 Kudos
Message 14 of 15
(739 Views)
The moral of the story is a good algorithm beats a fast hack any day, and will often save you time (and math really is fun Smiley Very Happy).  I can't count the times I have mindlessly typed in a quick formula only to have the computer crunch for hours.  After killing the process and a quick trip to the CRC Standard Mathematical Tables (yes, I am showing my age, but it is still on my desk), the process would take minutes.
Message 15 of 15
(715 Views)