total = 0.0 x = 1.0 while (x <= 2000.0) { result = (5.4*Math.pow(x, 5) - 3.211*Math.pow(x, 4) + 100.3*Math.pow(x, 2) - 100 + 20*Math.sin(x) - Math.log(x)) * 20*Math.exp(-x/100.3) total += result / 0.0001 x += 0.0001 } print(total)