• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Jan 18th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. float delta = b*b-4*a*c;
2.         float topx_1;
3.         float topx;
4.         float topy;
5.         float topy_1;
6.
7.         if(b==0){
8.             topx = c;
9.             topy = a;
10.         }
11.         else if((c<0 && a<0) || (c>0 && a>0)) {
12.             topx_1 = 2 * a;
13.             topx = -(b / topx_1);
14.             topy = -(delta / (4 * a));
15.         }
16.         else {
17.             topx_1 = 2*a;
18.             topx = -(b/topx_1);
19.             topy_1 = -(delta/(4*a));
20.             topy = topy_1/4;
21.         }
22.
23.         double[] pointsx = {-abs(4*topx), -abs(3*topx), -abs(2*topx), -abs(topx), abs(topx), abs(2*topx), abs(3*topx), abs(4*topx)};
24.         double[] pointsy = {-abs(4*topy), -abs(3*topy), -abs(2*topy), -abs(topy), abs(topy), abs(2*topy), abs(3*topy), abs(topy)};
25.         for(int i =0; i < pointsx.length; i++){
26.             pointsx[i] *=100;
27.             pointsx[i] = Math.round(pointsx[i]);
28.             pointsx[i]/=100;
29.         }
30.         for(int i =0; i < pointsy.length; i++){
31.             pointsy[i] *=100;
32.             pointsy[i] = Math.round(pointsy[i]);
33.             pointsy[i]/=100;
34.         }
35.
36.         Graph graph = new Graph.Builder()
37.                 .addFunction(x -> a * x * x + b * x + c, Color.BLUE)
38.                 .setWorldCoordinates(-abs(topx*5), abs(topx*5), -abs(5*topy), abs(5*topy))
39.                 .setXTicks(pointsx)
40.                 .setYTicks(pointsy)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top