# How to code summation function?

• May 19th, 2011, 02:52 AM
Beginner2011
How to code summation function?
Hello, I am new to programming

Can you please help me make code on C# for the equation on the attachment.! any help will be greatly appreciated.

• May 19th, 2011, 06:39 AM
HanneSThEGreaT
Re: How to code summation function?
That's nice, why not go to rentacoder.com.
• May 19th, 2011, 01:34 PM
fcronin
Re: How to code summation function?
If you understand that equation, you are way ahead of the game on most of us (I presume, sorry if there are more of you out there that do infact understand it, kudos if you do!). Look up aritcles on c# math library, besides that, just know it uses ( ) to help order mathmatical operations, * = times, / = divide, + = plus, - = minus, ^ = power of ... think thats about all i can provide.
• May 19th, 2011, 07:33 PM
Beginner2011
Re: How to code summation function?
Thanks a lot guys for your input.
Well i could do with just a simple general solution for coding a summation notation.

sorry for the complex equation.!!

thanks again!!
• May 19th, 2011, 07:44 PM
fcronin
Re: How to code summation function?
You don't have to apologize for the complex formula... if you understand what a summation notation is, you could just describe how you figure it out in english, then maybe I (or somebody else here) could translate what it would take in C#.

All I could find on 'summation' google wise were things similar to just summing sequential set of values, like...

Code:

```/* C#: The Complete Reference by Herbert Schildt Publisher: Osborne/McGraw-Hill (March 8, 2002) ISBN: 0072134852 */ // Use byte.   using System;   public class Use_byte {      public static void Main() {        byte x;     int sum;       sum = 0;     for(x = 1; x <= 100; x++)       sum = sum + x;       Console.WriteLine("Summation of 100 is " + sum);   }    }```
• May 19th, 2011, 08:09 PM
Beginner2011
Re: How to code summation function?
Thanks..!!

I want to get a value at every iteration,
e.g. if the loop runs for 10 times, i want to get the resultant then add it to a constant
so at every iteration, the program will return (loop value + constant)

The code is for least squares method, curve fitting