Series Summation C # LANMDA notation

Source: Internet
Author: User

#pragma once#include "stdafx.h" #define MAXK 1e7//class Algomath {//public://algomath () {}//virtual ~algomath () {}//};// Series summation//pseudo LANMDA notation//double series= (double base, int limit, int Constant) + int Constant + sigma{base^i/i |  (1 <= i <=)};//constant constant term, base radix, limit limit upper bound double Series (double base, int limit, int Constant) {double sum = 0.0;int I;//limit is 1 to 100for (i = 1; I <= limit; i++) {sum + = POW (base, i)/I;} Sum initial value is 1sum + = Constant;return sum;}  Series summation, withtempdouble serieshavetemp (int Constant, double base, int limit) {Double sum = 1.0;double temp = 1;int I;//limit is 1 to 100for (i = 1; I <= limit; i++) {temp = POW (base, i); sum = sum + temp/i;} return sum;} void Main () {//int i;//clock_t start, end;//double duration;//used to stored top-end//start = clock ();//for (i = 0; i < maxk; i++) {//FUN1 (1.1),//}//end = Clock (),//duration = ((double) (End-start))/clk_tck/maxk;//printf ("Every Method fun 1 using Average time:%f\n ", duration);/start = Clock ();//for (i = 0; i < maxk; i++) {//fun2 (1.1);//}//end = Clock ();//duration = ((double) (End-start)) /clk_tck/maxk;//printf ("Every method fun2 using Average time:%f\n", duration),////}//c# series summation,//pseudo LANMDA notation//double Ser ies= (double base, int limit, int Constant) = int Constant + sigma{base^i/i | (1 <= i <=)};//constant constant term, base radix, limit limit upper bounds//double Series (double baseX, int limit, int Constant) {//D ouble sum = 0.0;//int i;////limit is 1 to 100//for (i = 1; I <= limit; i++) {//Sum + = Math.pow (base X, i)/i;//}////sum initial value is 1//sum + = constant;//return sum;//}////c# lanmda myseries notation////progression summation C # true LANMDA notation// /CONSTANT constant term, base radix, limit limit upper bound//double basex;//int limit;//int constant;//delegate double del (double baseX, int limit, int Constant);//del myseries = (BaseX, limit, Constant) = > {//double sum = 0.0;//int i;////limit is 1 to 100//for (i = 1; I <= limit; i++) {//sum + = Math.pow (BaseX, i)/i;//}/Sum initial value is 1//sum + = Constant;//return sum;//}; 

  

Series Summation C # LANMDA notation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.