A community for students.
Here's the question you clicked on:
 0 viewing
cyberdemon93
 3 years ago
As an exercise, write a function slope(x1, y1, x2, y2) that returns
the slope of the line through the points (x1, y1) and (x2, y2). Then use
this function in a function called intercept(x1, y1, x2, y2) that
returns the yintercept of the line through the points (x1, y1) and
(x2, y2). I have done the first part but i keep getting confused when i reach the second part.
cyberdemon93
 3 years ago
As an exercise, write a function slope(x1, y1, x2, y2) that returns the slope of the line through the points (x1, y1) and (x2, y2). Then use this function in a function called intercept(x1, y1, x2, y2) that returns the yintercept of the line through the points (x1, y1) and (x2, y2). I have done the first part but i keep getting confused when i reach the second part.

This Question is Closed

03225186213
 3 years ago
Best ResponseYou've already chosen the best response.0from the first part make equation now for y intercept put x==0 in equation u will gwt intercepts

FabienToune
 3 years ago
Best ResponseYou've already chosen the best response.0If you consider the generic equation of a line : y = ax + b when you get the slope, you actually get the 'a' of your equation. You also have an x and an y (you can take for exemple x1 and y1). All you need to do is to infer the value of b, which is precisely the yintercept asked.

myndless
 3 years ago
Best ResponseYou've already chosen the best response.1the equation of a line is \[y=mx+b\], where m is the slope of the line, and b is the offset from the origin along the y axis. The yintercept is the value of y where x = 0, so\[y = 0m + b\]\[y = b\] For any point that you know exists on the line, you can solve for b. \[y_1 = mx_1 + b\]\[b = y_1  mx_1\]So all intercept(x1,y1,x2,y2) has to do is return y1  slope(x1,y1,x2,y2) * x1
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.