Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

cyberdemon93

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

  • This Question is Closed
  1. 03225186213
    • 2 years ago
    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

  2. FabienToune
    • 2 years ago
    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.

  3. myndless
    • 2 years ago
    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

  4. Not the answer you are looking for?
    Search for more explanations.

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find 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
  • 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.