como eu posso calcular a raiz quadrada sem utilizar o math.sqrt
eu tinha feito com math.sqrt, tem como ajeitar esse aqui e baixo mas tirar os math.sqrt?
1. public class Baskara {
2.
3. public static void main(String[] args) {
4. try {
5. System.out.println("Expressao: 2x^2 + 5x + 1");
6. Baskara b = new Baskara(2, 5, 1);
7. System.out.println("Delta: " + b.getDelta());
8. System.out.println("x1 : " + b.getX1());
9. System.out.println("x2 : " + b.getX2());
10. }
11. catch (Throwable t) {
12. t.printStackTrace();
13. }
14. }
15.
16. private double termoA;
17. private double termoB;
18. private double termoC;
19.
20. public Baskara(double a, double b, double c) {
21. termoA = a;
22. termoB = b;
23. termoC = c;
24. }
25.
26. public double getDelta() {
27. return (termoB * termoB) - (4 * termoA * termoC);
28. }
29.
30. public double getX1() {
31. return ((-1 * termoB) + Math.sqrt(getDelta())) / (2 * termoA);
32. }
33.
34. public double getX2() {
35. return ((-1 * termoB) - Math.sqrt(getDelta())) / (2 * termoA);
36. }
37. }
vlw

