Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

cyberdemon93

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 y-intercept 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.

  • one year ago
  • one year ago

  • This Question is Closed
  1. 03225186213
    Best Response
    You've already chosen the best response.
    Medals 0

    from the first part make equation now for y intercept put x==0 in equation u will gwt intercepts

    • one year ago
  2. FabienToune
    Best Response
    You've already chosen the best response.
    Medals 0

    If 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 y-intercept asked.

    • one year ago
  3. myndless
    Best Response
    You've already chosen the best response.
    Medals 1

    the 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 y-intercept 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

    • one year ago
    • Attachments:

See more questions >>>

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.