I'm creating a program that solves for the angle at which the curves of two equations' lines intersect. I need the values at which the graphs intersect. One way to find those values is to set EQN1=EQN2 and solve for X. How might I incorporate that into a program?

```
:"Y1"->v //the y-var type v
:"Y2"->w //the y-var type w
```

EDIT: I realized that this only gets you the Y-coordinate…working on the x-coordinate now.

My program uses only the X-coordinate, so the above code won't make it into this program, but I will bookmark it, because I am sure I will need to use it in a future program.

Well, the easiest way I see it is to find the intersection outside the program, then ask for it in the program via an "Input" command.

To find the intersection of a graph, press [2nd] [TRACE] and scroll down to intersection. You need two lines to do this (obviously). Then press enter three times (It will ask for the Left Curve, Right Curve, and Guess, but the calculator should automatically redirect your cursor to the needed area.) and you will get the intersection.

From there, you could write in your program:

```
:Input "X-COORD:",X //or any other variable you want to use
://rest of program code
```

I am still trying to get the X-Coordinate, or find a program that will do it for you, but this method seems a bit easier. :)

A function to which you have access in a program is nDeriv(. By using this or a custom variation, you could find where Y1-Y2=0 with Newton's method.

**Edit:** I just threw this together:

```
0->I
Repeat I=10 or K<20
I+1->I
0->K
10rand->A
Ans+1
While K<20 and E-10<abs(A-Ans
Ans->A
K+1->K
A-(Y1(A)-Y2(A))/nDeriv(Y1-Y2,X,A
End
End
```

'E-10' is the engineering E, this controls the accuracy (error) of the result so modify accordingly. We only iterate 20 times because some functions don't play nice and can result in an infinite loop. Modify this as you like. We also only choose up to 10 starting values in case there is never an intersection.

If an intersection is found, it's returned in Ans. This code can be modified to give it a range and initial guess.

Z80 Assembly>English>TI-BASIC>Python>French>C>0

So I put together a 'test' program that uses the code you provided me with, and it worked the first time, but I haven't changed the code, and it no longer works. I get different answers every time now. Here is my 'test' program:

```
Input "Y1 ",Str1
Str1→Y1
Input "Y2 ",Str2
Str2→Y2
0→I
Repeat I=10 or K<20
I+1→I
0→K
10rand→A
Ans+1
While K<20 and E10<abs(A-Ans // using the engineering E (example: E2 is 100)
Ans→A
K+1→K
A-(Y1(A)-Y2(A))/nDeriv((Y1-Y2),X,A
End
End
Disp Ans // You said that when an intersection is foud, it's returned in Ans, so I had the program display the intersection
```

Let's suppose we have the equations Y1=X+3 and Y2=5x+2. If you graph the functions and use Intersection (as Battlesquid discussed) then you have the intersection point of (0.25, 3.25). The above program, however, says the result is 6.252104714. That is the answer I got just now. The previous answer was 2.092528959. What am I doing wrong?

It needs to be E-10 as in 10^{-10}

Z80 Assembly>English>TI-BASIC>Python>French>C>0

Oh, well that would do it, wouldn't it? I made that change and that fixed the complicated double-loop. I'll incorporate it into my angle of intersection program. Thank you so much!