1
6 public class FunktionPlot {
7 public static void main(String[] args) {
8
9 double a = -2.0;
10 double b = 3.0;
11 double dx = 0.25;
12
13 double x;
14 double y;
15
16 double pos;
18 x = a;
19 while (x <= b) {
21
22 y = f(x);
23
24 pos = 0.0;
25 while ( pos < y ) {
27
28 System.out.print(' ');
29
30 pos = pos + dx/2.0; }
32
33 System.out.println('*');
35 x = x + dx; }
37
38 }
39
40
43 static double f(double x) {
44 return -0.01*x*x*x*x*x + 0.08*x*x*x*x - 0.26*x*x*x - 0.31*x*x + 1.4*x + 2.36;
45 }
46
47 }
48