飞道的博客

用Java学高数:函数极限与连续(一)

208人阅读  评论(0)

1、第一道题


对应的Java代码

public class MyMath {
   
    public static void main(String[] args) {
   
        System.out.println(f(-1));
        System.out.println(f(0));
        System.out.println(f(1));
        System.out.println(f(3));
    }
    public static double f(double x){
   
        double y = (x * Math.sin(x - 3))/((x-1) * Math.pow((x - 3),2) );
        return y;
    }
}


答案选择A


2、第二道题



Java代码
A选项:

package com.itzheng1.test3;
public class MyMath {
   
    public static void main(String[] args) {
   
        double a = 0;
        while (a <= Math.PI){
   
            System.out.println(A(a));
            a = a+0.1;
        }
    }
    public static double A(double x){
   
        double y = Math.sin(x) / x;
        return y;
    }
}

x从0 到π值从1越来越接近0所以A是错误的

B选项

package com.itzheng1.test3;
public class MyMath {
   
    public static void main(String[] args) {
   
        double a = 0;
        while (a <= 10){
   
            System.out.println(B(a));
            a = a+0.1;
        }
    }
    public static double B(double x){
   
        double y = x * Math.sin(1/x);
        return y;
    }
}

x从0到10,其结果的值逐渐趋向于1正确答案选择B



C选项

package com.itzheng1.test3;

public class MyMath {
   
    public static void main(String[] args) {
   
        double a = 0;
        while (a <= 10){
   
            System.out.println(B(a));
            a = a+0.1;
        }

    }
    public static double B(double x){
   
        double y = (1/x) * Math.sin(1/x);
        return y;
    }
}

x从0到10其值越来越趋向于0



D选项

package com.itzheng1.test3;

public class MyMath {
   
    public static void main(String[] args) {
   
        double a = 0;
        while (a <= 10){
   
            System.out.println(B(a));
            a = a+0.1;
        }

    }
    public static double B(double x){
   
        double y = Math.sin(x) / x;
        return y;
    }
}

的值越来越趋向于0



数学解析,正确答案选择B

3、第三道题


package com.itzheng1.test3;
public class MyMath {
   
    public static void main(String[] args) {
   
        double a =10;
        while (a >= 1){
   
            System.out.println(B(a));
            a = a-0.1;
        }
    }
    public static double B(double x){
   
        double y = 2 * Math.pow(Math.E,1/(x-1));
        return y;
    }
}

当x为10趋向于1的时候其值不断的增大直到无穷


当x从-10到1的时候

package com.itzheng1.test3;
public class MyMath {
   
    public static void main(String[] args) {
   
        double a =-10;
        while (a < 1){
   
            System.out.println(B(a));
            a = a+0.1;
        }
    }
    public static double B(double x){
   
        double y = 2 * Math.pow(Math.E,1/(x-1));
        return y;
    }
}

其值不断趋向于0

总结上述只有一个极限达到无穷,另外一个没有达到无穷因此答案选择D

4、第四道题




5、第五道题



Java代码:

package com.itzheng1.test3;
public class MyMath2 {
   
    public static void main(String[] args) {
   
        double x = 0;
        while (x < 20){
   
            System.out.println(f(x));
            x = x + 0.1;
        }
    }
    public static double f(double x){
   
        return  Math.pow(((x + 2)/(x - 1)),x);
    }
}

运行结果接近E三次方

6、第六道题


package com.itzheng1.test3;
public class MyMath2 {
   
    public static void main(String[] args) {
   
        double a = 0;
        while ( a < 100){
   
            System.out.println(f3(a));
            a = a + 0.1;
        }
    }
    public static double f1(double x){
   
        return x - 2;
    }
    public static  double f2(double x){
   
        return  (x * x) + 2 * x + 1;
    }
    public static  double f3(double x){
   
        return  (f2(f1(x)) / (x * x));
    }
}

运行结果接近1

7、第七道题



Java代码

package com.itzheng1.test3;
public class MyMath3 {
   
    public static void main(String[] args) {
   
       double x = 10;
       while (x > 0){
   
           System.out.println(f1(x));
           x = x - 0.001;
       }
    }
    public static double f1(double x){
   
          double y =  1 - Math.pow(Math.E,Math.tan(x))/Math.asin(x/2);
          return  y;
    }
}

当x从10 到0的时候其值越来越接近-2所以a=-2

f(0)=a

8、第八道题


Java程序

package com.itzheng1.test3;
public class MyMath3 {
   
    public static void main(String[] args) {
   
        double x = 10;
        while (x > 0){
   
            System.out.println(f(x));
            x = x - 0.01;
        }
    }
    public static double f(double x){
   
        double y = (2 * ( Math.pow(Math.E,(-1/x)) )) / ( (Math.pow(Math.E,(2/x))  - (Math.pow(Math.E,(-1/x))) ) ) ;
        return y;
    }
}

运行结果接近0

9、第九道题


Java代码

package com.itzheng1.test3;
public class MyMath3 {
   
    public static void main(String[] args) {
   
        double x = 10;
        while (x > 0){
   
            System.out.println(f(x));
            x = x - 0.01;
        }
    }
    public static double f(double x){
   
        double y = (  (  Math.sin(x) + x*x * Math.sin(1/x) ) / (2 + x * x) * Math.log(1+x) );
        return  y;
    }
}

运行结果接近1/2

10、第十道题


11、第十一道题

x=1   x= - 1   x = 0
分别为x趋近于  1
x     趋近于  -1
x     趋近于   0

Java程序1
当中x趋近于1的时候

package com.itzheng1.test3;
public class MyMath4 {
   
    public static void main(String[] args) {
   
        double x = 10;
        while (x > 1){
   
            System.out.println(f(x));
            x = x - 0.1;
        }
    }
    public static double f(double x){
   
        double y = (x*x - x)/(x*x - 1) * Math.abs(x);
        return y;
    }
}

其值趋近于1/2


Java程序2
当中x趋近于-1的时候

package com.itzheng1.test3;
public class MyMath4 {
   
    public static void main(String[] args) {
   
        double x = -10;
        while (x < -1){
   
            System.out.println(f(x));
            x = x + 0.001;
        }
    }
    public static double f(double x){
   
        double y = (x*x - x)/(x*x - 1) * Math.abs(x);
        return y;
    }
}

其值趋近于正无穷

Java程序3
当中x趋近于0负的时候

package com.itzheng1.test3;
public class MyMath4 {
   
    public static void main(String[] args) {
   
        double x = -10;
        while (x < 0){
   
            System.out.println(f(x));
            x = x + 0.001;
        }
    }
    public static double f(double x){
   
        double y = (x*x - x)/(x*x - 1) * Math.abs(x);
        return y;
    }
}

其值趋近于-1


Java程序4
当中x趋近于0正的时候

package com.itzheng1.test3;
public class MyMath4 {
   
    public static void main(String[] args) {
   
        double x = 10;
        while (x > 0){
   
            System.out.println(f(x));
            x = x - 0.001;
        }
    }
    public static double f(double x){
   
        double y = (x*x - x)/(x*x - 1) * Math.abs(x);
        return y;
    }
}

其值取决于1


转载:https://blog.csdn.net/qq_44757034/article/details/115432120
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场