Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calculate and show the intersection of two curves

    I draw two functions on a graph:
    graph twoway (function y=x^(-0.5)) (function y=8-(1/3)*x). I want to know how to calculate and show the coordinates of the intersection of these two curves. Thank you!

  • #2
    You can set the two functions equal and solve for x by hand. Since you have a polynomial, you might end up with multiple values of x. You can then substitute each x in one of the original equations to get a y coordinate for each.

    I started working by hand and then gave up because it was looking messy. I instead used an online equation solver (https://www.mathpapa.com/equation-solver/) to get the x coordinates by solving for x in the following:
    Code:
    x^{-\frac{1}{2}}=8-\frac{1}{3}x
    Then I substituted the x values into the first function yielding the matching y coordinates.

    When graphing the functions, use the -range()- option to show all intersections (fill in the ?? with the range you want):

    Code:
    graph twoway (function y1=x^(-0.5), range(?? ??) n(10000)) (function y2=8-(1/3)*x , range(?? ??) n(10000))
    I increased the number of points that are graphed with -n(10000)- so that both graphs show enough points to clearly show the intersections. It is necessary in this case.
    Last edited by Carole J. Wilson; 18 Aug 2018, 14:51.
    Stata/MP 14.1 (64-bit x86-64)
    Revision 19 May 2016
    Win 8.1

    Comment


    • #3
      Thank you so much Wilson!

      Comment

      Working...
      X