How would you do this?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Feb 28 01:44:57 EST 2013
On Wed, 27 Feb 2013 19:32:40 -0800, eli m wrote:
> How would you find the slope, y intercept, and slope-intercept form
> equation for a line in python?
I would post a message to a Python forum and ask a vague question that
gives no detail about the problem, and hope somebody answers.
But if I actually wanted an answer, I'd give the post a sensible subject
line, and make an effort to explain my actual problem. For instance:
"I have an equation written as a string, like '2y - 6x + 3 = 0'. How
should I parse the string to extract the slope and intercept from the
equation, and re-write it in the form 'y = mx+c'?"
Or:
"I have a bitmap image of a line graph. How do I detect the lines in the
image, decide which ones are the axes, and determine the slope and
intercept of the plotted line?"
Or:
"How do I get the slope and intercept of a Line object from the
FancyLinearAlegbra module I downloaded from http://some-random-place-on-
the-internet.com?"
Or:
"Can somebody google the formula for slope and intercept of a line for
me, 'cos I can't be bothered."
The answers you get will depend on which question you actually ask.
--
Steven
More information about the Python-list
mailing list