Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 15 Online
OpenStudy (anonymous):

hello i am solving this problem in python IDLE ? Positive root of the following equation: 34*x^2 + 68*x - 510 i wrote this >>>import math math.sqrt(34*x^2 + 68*x - 510) and press enter but it came out error...could anyone tell me where wrong, is it not sqrt ?

OpenStudy (anonymous):

From where does Python get the value of x? Do you know what operator precedence is?

OpenStudy (anonymous):

what kind of error msg do you get? did you define x? also make sure you got positive number in you math.sqrt().

OpenStudy (anonymous):

the exercise asks to calculate the positive root of 34*x^2 + 68*x - 510, i don't know what operator precedence is i'm new to all of this, the error say "name x is not defined" so how do i define "x"

OpenStudy (anonymous):

just make a line above your formula: x = 8 for example. Python use "=" to define variables. you will get there shortly...

OpenStudy (anonymous):

True Man you can't use Python to solve mathematical problems without coding. use Microsoft mathematics instead.

OpenStudy (anonymous):

The roots of a quadratic expression are the solutions when the equation equals zero. For this particular expression, there is one negative root and one positive root. I won't tell you what they are, as I don't know exactly what your problem is. Simply taking the square root of the expression will not do the job. To use python to find the roots, I imagine that you will need to use the quadratic formula. \[x = \left( -b \pm \sqrt{b ^{2}-4ac} \right)/2a\] Where a, b and c are the coefficients in the expression: \[ax ^{2}+bx+c\] So coefficient a = 34, b = 68 and c = -510 for this case. I hope that helps? Or has it just made you more confused. I am only beginning in this too, so I am going to take up this challenge and write some code! :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!