我试着计算积分-1到6 sinx,但下面给出的结果接近-1,14,正确的解是-0.41987。哪里出错了?如何使我的代码看起来更好、更清晰?float MonteCarlo ( float a , float b, long long int N ) // MonteCarlo(-1,6,200) integral -1 to 6 sinxnumber of random (x,y) srand(time(NULL));
float positive = 0; // number
有人能告诉我我在我的“虚空的sinx”功能中做了什么吗?我应该得到27.7714的答案,但它却是返回0。这是我要计算的公式。#include <iostream>using namespace std;
double fraction, final;
cout<<"Enter your values for x and n:
我写了一个使用Maclaurin级数计算sin(x)的程序,但当我尝试调试它时,它给出了一个溢出错误。这是代码,有人能帮我吗?Public Class Form1 Dim sinx, radx, abcAs Double radx = x * Math.PI / 180
For i = 1 To 20 Step 2abc = (Math.Pow
/*PURPOSE: This program uses the infinite series for sin(x) and evaluates theinfinite series to the value of sin(x)
as determined by the pre-defined functions inside C+= 0; //initialize sinx so it is available