Alright so I'm coding a Quadratic Equation Solver to help with my Math Class. However the teacher requires each calculation to be written out. I have the solver working, however I'm not sure where to start when it comes to printing each step. I know I will need to `System.out.println()` each step. But how does Java interpret the equation? Does it do proper BEDMAS(Brackets, Exponents, Division, Multiplication, Addition, Subtraction)? if(disc == 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); System.out.println("One Root Found: " + x1); } else if(disc > 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); x2 = (-b-Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); //Output Results System.out.println("Two … |
+0 forum
3 | ||

Looking for how to write code to compute for quadratic equation on a vb.net application |
+0 forum
1 | ||

Code Snippet
Solving the cubic equation using the Complex struct Complex numbers are seldom used in daily life, altough you could say that every real number is complex, but with the imaginary part equal to zero. And btw. "complex" is a bit of a misnomer, perhaps we should call them "easies", because often they make it easier to perform certain math tasks. It all started in Italy, 13th century or so when mathematicians where trying to solve quadratic and cubic equations. Here is my solution in C# of the cubic. I used the rules found in wikipedia. Included a zip file with a small formsapplication that exercises the method given … |
+0 forum
2 | ||

Hi guys. First of all, I am aware that there is a somewhat similar thread over here. However, it was never really answered and the code given was obscure (I don't like copying stuff anyway) Either way... I want to balance a chemical equation. However, I don't need help on parsing a string or anything (which is what most other search results on Google turn up), because the compounds on either side are already separated into their constituent elements, as this is not a standalone app but part of a larger project I'm working on. I also know that I … |
+0 forum
1 | ||

I won't be asking for a source code yet. What I need to figure out is the process of a certain Math problem with the equation that seemed to be impossible to be converted to source code. Here it goes: **A certain waveform is 0 volts for time less than 2 seconds and 3 volts for time equal to or greater than 2 seconds. (These waveforms are referred to as step functions.) *Prompt the user accepts time in the variable named time and displays the appropriate voltage, depending on the input value.*** So the problem is asking for a program … |
+0 forum
9 | ||

I need a code which can solve the equations like this :- 56*78+(78/8) In this we know that brackets must be solved first and then divide/multiply and then add/subtract. So, i need a code for solving this kind of equations which contains multiple operators in single line. Thnks :) |
+0 forum
4 | ||

Hi, I'm trying to find a way to solve this equation with two unknowns using Python: [QUOTE](a * b) = (x * c) + (y * d) + e [/QUOTE] Where a, b, c, d and e are all floating numbers provided by the user and x and y are what the program should return. I'd really appreciate pointers to help me understand, some starting point if possible. Please bear in mind that my math is at the most basic level, I'd be totally helpless in front of a Wikipedia article on advanced algebra. |
+0 forum
8 | ||

Hello...just started learning C and i'm trying to write a program that solves quadratic equations...but every time i compile and run it and enter the 3 variables it crashes. I kept on looking but didn't find anything wrong with it...help? :P [CODE]#include <stdio.h> main(){ int a,b,c; float x1,x2; printf("Please enter a b c: \n"); scanf("%d %d %d",a,b,c); if (a == 1){ x1= (b/2) + sqrt(pow(b/2,2)-c); x2= (b/2) - sqrt(pow(b/2,2)-c); } else { x1= (b+ sqrt(pow(b,2) - 4*a*c))/(2*a); x2= (b- sqrt(pow(b,2) - 4*a*c))/(2*a); } printf("The solutions are: \n%f ja %f",x1,x2); getch(); }[/CODE] |
+0 forum
3 | ||

MY problem is related to entry of research data. The researchformula is entered into a textbox alongwith other usual form entries like title,subject,startdate etc. The formula consists of alzebra, trignometric, otherfunctions etc. Example [CODE] [B]x = 12; y = 24 + tit[x] + mixer[x]; z = x + sin(x) + tan(x+y) - max[x,y]; #final result is 24.778273666352;[/B][/CODE] The program is not concerned with the syntax or result of these formulas. The form must however display some details of the formula in the following format in textbox on buttonclick a) variableused name and characterlocation of variables like x(1,19) y(8,) since x … |
+0 forum
9 | ||

hi, I am trying to make a variable equation solver using DEV-C++. I just need to know how to get C++ to solve an equation inputed by the user. So you input something like 1+1 and i need it to solve the problem and output the answer. heres an example: [CODE]#include<iostream> using namespace std; int main (char argc) { string n1; cin >> n1; // i input 1+1 int n2; solve n1 = n2; cout << n2 << endl; // it outputs 2 }[/CODE] thanks |
+0 forum
75 | ||

Wrote this for my college open evening just to give prospective students a taste of python. added a little "information" section just to bulk it out a bit (this section is slightly messy i know). Not sure if it works in command line, definitely works in IDLE but the command line is outdated on the college machines so bugs such as the trailing return (/r on the end of inputs) still apply so it is hard to validate. Hope this is helpful for beginners etc (commented in places so prospective students can at least understand some of what's going on) … |
+0 forum
1 | ||

hi, i am using DEV-C++ and i have two problems with this code: [CODE]#include<iostream> #include<string> #include<sstream> using namespace std; int main (char argc) { string n1; getline(cin,n1); int len; len = n1.length(); int len1 = -2; int len2 = -1; for(int t = len; t>0; t--) { len1 = len1 + 2; len2 = len2 + 2; cout << "number "<< n1[len1] << endl; cout << "operator "<< n1[len2] << endl; } system("pause"); } [/CODE] i want the output to never end with an operator and whenever i enter a number larger than 9, it ends with an operator. my … |
+0 forum
9 | ||

Hi. Can you help me how to balance a chemical equation using linear algebra. I know how to do it on a piece of paper using the usual method of balancing. I just don't get the principle how to do it on the other method. Please give me a step by step procedure on how to do it, the basic ones. This is how far I have gone. Ex: Fe + Cl2 = FeCl3 Set a variable for each [A]Fe + [B] Cl2 = [C] FeCl3 Count the number of coefficients Fe: A = C Cl: 2B = 3C And … |
+0 forum
2 | ||

Hey, everybody, I'm a newbie at Python (2.7.1), and new to DaniWeb as well. and the apparent simplicity of Python got me interested in programming (seriously, the only thing before this was HTML). Anyway... I was taking a test and thought that after I was finished I could make an equation calculator. I've got a few simple equations slapped on there, for proof-of-concept, and they work fine. However, I would like to go back to the user input line of code. How do I go about doing this? I've Googled it, and there's no "goto" function like there is in … |
+0 forum
30 | ||

Hello there! :) How should i solve for x in this equation: p*e^-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x^2 + u = 0 with the user to input the values of p,q,r,s,t and u. i'm thinking of looping from 0.0001 until i-dont-know-what and then testing each value of x that will satisfy the equation. but i dont think that's very efficient... especially if the given p,q,r,s,t and u values would yield to no possible value of x... Post for this prob is right here: [url]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1282[/url] |
-1 forum
9 | ||

Code Snippet
Quadratic Solver I have written this for my math class, as it saved me an accumulated time of three hours over a week of homework that involved the quads. I a posting it here for anyone who wants to use, modify or otherwise use to go ahead and do so. Standard Quadratic Form applies here, Ax2 * Bx * C, and sometimes Ax2 * Bx = C, etc. Thanks, And enjoy, -Stev Täal |
+0 forum
6 | ||

how do i solve this problem r+5(r-2)=28 3(r+4)+5(r+2)=102 |
-1 forum
9 | ||

Hi guys.. I am currenly coding a program which outputs the next state table for flip flop circuits. I have already finished the the generator for one type of flip flop, and I have 3 more to go.. So far, my arithmetic parser is working good but I suddenly remembered that it is included in our specifications that the user could also input XOR operations, which my parser couldn't handle. So now, I am looking for existing codes in expanding XOR equations so that the expanded equation would just be the one to be substituted and processed by the parser. … |
+0 forum
0 | ||

Code Snippet
A C# class to solve a quadratic equation [TEX]Solve an equation of the form Ax^2 + Bx + C = 0.[/TEX] The class is commented, but if you have any questions don't be affraid to ask. You may exercise this class in a console application with the following snippet : [CODE]QuadraticEquation z = new QuadraticEquation(1, 3, 3); z.Solve(); Console.WriteLine("D={0}",z.Discriminant()); Console.WriteLine(z.Root1RealPart); Console.WriteLine(z.Root2RealPart); Console.WriteLine(z.Root1ImagPart); Console.WriteLine(z.Root2ImagPart);[/CODE] |
+0 forum
0 |

The End.