形如
这样的多元函数,求[x1,x2]区间的积分。即求解
的值。java代码如下:
这里写代码片public class MulFunctionIntegral {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("输入a的值:");
int a=sc.nextInt();
System.out.println("输入b的值:");
int b=sc.nextInt();
System.out.println("输入c的值:");
int c=sc.nextInt();
System.out.println("输入n的值:");
int n=sc.nextInt();
System.out.println("输入m的值:");
int m=sc.nextInt();
System.out.println("输入x1的值:");
double x1=sc.nextDouble();
System.out.println("输入x2的值:");
double x2=sc.nextDouble();
double value=Integral(a,b,c,n,m,x1,x2);
}
public static double Integral(int a,int b,int c,int n,int m,double x1,double x2){
double y1=a/(n+1)*Math.pow(x1, n+1)+b/(m+1)*Math.pow(x1, m+1)+c*x1;
double y2=a/(n+1)*Math.pow(x2, n+1)+b/(m+1)*Math.pow(x2, m+1)+c*x2;
double y=y2-y1;
return y;
}