好像不只是一个问题把?
NO.1
写一个方法
(((an *  x + an-1) * x + an-2) * …) * x + a0 
注:n, n-1, n-2, 0都是a的下标,不是相乘关系。按照下面示例代码来写Java的方法:用一个数组来存储多项式的系数ai, i大于等于0小于等于n其实就是咱们北宋时期的秦九韶算法
package WentiOnCsdn;/*
 * 
 * @author [email protected]
 * 实现秦九韶算法计算多项式
 * 
 */
  
public class QinJiuShao { public static void main(String[] args) {
int [] a={1,2,3};//存放多项式的系数:a[i]X^i
int x=10;//变量的取值
int result=QinJiuShaoM(a,x);
System.out.println(result);

}
 
private static int QinJiuShaoM(int[] a, int x) {
int n=a.length;
int S=a[a.length-1];//将结果 S 赋初值 最高次幂 x^n的系数
for (int i = n; i >=0;i--) {
S=a[n-1]+x*S;
}
return S;
}
}

解决方案 »

  1.   

    你剩下的几个问题都可以调用Math类中的相应的静态方法
    比如算 a 的 b 次方 :a^b
    可以这么算
    double a=~~;
    double b=~~;
    double result=Math.pow(a,b);
    但是这个算法究竟是怎么实现的我也不清楚
    好像是JDK调用本地方法吧!
      

  2.   

    第1题
    import java.math.*;
    class Bignum
    {
    public static void main(String [] args)
    {
    BigInteger p = new BigInteger("665857");
    BigInteger q = new BigInteger("470832");
    p = p.multiply(p);
    q = q.multiply(q);
    q = q.add(q);
    p = p.subtract(q);
    System.out.println(p.toString());
    }
    }
      

  3.   

    第二题
    import java.math.*;
    class problem2
    {
    public static void main(String [] args)
    {
    //求解9x4-y4+2y2  其中 x=10864.0  y=18817.0
    BigInteger x = new BigInteger("10864");
    BigInteger y = new BigInteger("18817");
    BigInteger z = null;
    BigInteger result = null;
    x = x.pow(4);
    x = x.multiply(new BigInteger("9"));
    System.out.println(x);//x = 125372283822342144

    BigInteger y1 = y.pow(4);
    System.out.println(y1);//y1 = 125372284530501121

    z = y.pow(2);
    z = z.add(z);
    System.out.println(z);//z = 708158978

    result = x.subtract(y1);
    result = result.add(z);
    System.out.println(result);//result = 1

    }
    }