Awesome
How do I make an awesome?
What is a awesome? How do you make a awesome? This script and codes were developed by Samarth Desai on 08 January 2023, Sunday.
Awesome - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>awesome</title>
</head>
<body> <form name="quadraticFormulaForm"> <input type="number" name="a" size="20"/>x<sup>2</sup> + <input type="number" name="b"/>x + <input type="number" name="c"/> = 0 <input type="button" value="Find x" onClick="quadraticFormulaFinal()"/>
</form>
<div id="solution"></div> <script src="js/index.js"></script>
</body>
</html>
Awesome - Script Codes JS Codes
//Radical simplifying function
var A
var B
function fPart(num){ return num-Math.floor(num);
}
function checkgt(numone,numtwo){ if(numone>numtwo){ return 1; } else{ return 0; }
}
function simplify(rad){ var Form = document.input; var index = 2 var rad rad = Math.floor(Math.abs(rad)); index = Math.floor(Math.abs(index)); if(isNaN(index) || isNaN(rad)){ A= "ERROR"; B = "Enter both fields."; index = "."; } else if(index == 0){ A = "UNDEF = "; B = rad; } else { A = 1; I = 2; B = rad; while(Math.pow(I,index) <= B){ while(0 == fPart(B/Math.pow(I,index))){ B = B/Math.pow(I,index); A = A*I; } I = I+1+checkgt(I,2); } var Ans = index; while(Ans != 1){ Ans = index/Ans+1; while(0 != fPart(index/Ans)){ Ans++; } var L = index/Ans; Ans = L; switch(Ans){ case 1: break; case fPart(Math.pow(B,1/Ans))+Ans: index = index/Ans; B = Math.pow(B,1/Ans); Ans = index; break; default: break; } } }
};
var quadraticFormulaFinal = function() { //Variables a, b, and c var a = document.quadraticFormulaForm.a.value; var b = document.quadraticFormulaForm.b.value; var c = document.quadraticFormulaForm.c.value; var discriminant = b * b - 4 * a * c; //If a is 0, alert that this isn't a quadratic equation. if(a == 0) { alert("Please input a value for a. If a = 0, that means that this equation is not quadratic but linear."); } else { //The function for the ADDITION version of the quadratic formula var quadraticFormulaAddition = function() { //Calculate the numerator and the denominator. var numerator = -b + Math.sqrt(b * b - 4 * a * c); var denominator = 2 * a; return numerator / denominator; }; //The function for the SUBTRACTION version of the quadratic formula var quadraticFormulaSubtraction = function() { //Calculate the numerator and the denominator. var numerator = -b - Math.sqrt(b * b - 4 * a * c); var denominator = 2 * a; return numerator / denominator; }; //Two solutions: solutionAddition and solutionSubtraction var solutionAddition = quadraticFormulaAddition(); var solutionSubtraction = quadraticFormulaSubtraction(); //If solution is imaginary, alert that we can't do imaginaries yet. if(isNaN(solutionAddition) || isNaN(solutionSubtraction)) { alert("Sorry, the solution to the equation you gave us is imaginary, and we can't do imaginary numbers right now! Please check back later."); //If the solution is a double root, have x equal only one number. } else if(solutionAddition == solutionSubtraction) { var solution = "<div><em>x</em> = " +solutionAddition+ " (double root)</div>"; document.getElementById("solution").innerHTML += solution; //If the solution isn't imaginary or a double root, just give the two solutions. } else { //quadratic1 is the -b part. var quadratic1 = -b simplify(discriminant); //Now that we've simplified the radical discriminant, we can use the variables A, B, and C. //quadratic 3 is the 2a part. var quadratic3Addition = 2 * a; var quadratic3Subtraction = 2 * a; //If the rad is just the sqrt(1), take out that part, add 'em up, and simplify. if(B == 1) { //addition and subtraction are the two numerators. var addition = quadratic1 + A; var subtraction = quadratic1 - A; //for loop simplifies the fractions (addition/quadratic3) and (subtraction/quadratic3). for(i = 1; i < 98; i++) { //Goes through all the numbers i and tries to divide (addition/quadratic3) by it) if(addition % i == 0 && quadratic3Addition % i == 0) { addition /= i; quadratic3Addition /= i; } //Goes through all the numbers i and tries to divide (subtraction/quadratic3) by it. if(subtraction % i == 0 && quadratic3Addition % i == 0) { subtraction /= i; quadratic3Addition /= i; } } //If the denominatorAddition ends up being 1... if(quadratic3Addition == 1) { //If the denominatorSubtraction ALSO ends up being 1... if(quadratic3Subtraction == 1) { var solution = "<div><em>x</em> = " +addition+ ", " +subtraction+ "</div>"; document.getElementById("solution").innerHTML += solution; //else if the subtraction denominator is NOT also 1 } else { var solution = "<div><em>x</em> = " +addition+ ", <sup>" +subtraction+ "</sup>/<sub>" +quadratic3Subtraction+ "</sub></div>"' document.getElementById("solution").innerHTML += solution; } } } } }
};
Developer | Samarth Desai |
Username | samarthpd |
Uploaded | January 08, 2023 |
Rating | 3 |
Size | 2,901 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
GPA Calculator | 2,422 Kb |
Rock, Paper, Scissors | 2,060 Kb |
Density | 1,949 Kb |
Nature of the roots | 1,862 Kb |
Coding with Mitch and Samarth | 2,028 Kb |
A Pen by Samarth Desai | 1,393 Kb |
Specific Heat | 2,332 Kb |
Ideal Gas Law | 2,472 Kb |
Dimensional Analysis | 2,881 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Break Out | AzazelN28 | 12,431 Kb |
Shop Talk logo made in CSS | Hugo | 19,368 Kb |
Nested flexbox layout for library catalog | Boycetrus | 3,271 Kb |
Old calculator | Gnarfugh | 2,815 Kb |
Minimal Material Design Form Input | Koenigsegg1 | 3,076 Kb |
Commuter Line Tokyu 8500 | Pedox | 7,031 Kb |
CSS3 iPad | Vikvarg | 1,766 Kb |
Testimonial Fancy tabs responsive | Amit-webdesigner | 3,056 Kb |
A Pen by Alex Edwards | Exards | 8,218 Kb |
Shopping List | Markmurray | 6,015 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!