1
$\begingroup$

I have two equations consisting of two variables and I'm plotting those two functions in 3D by defining the range of the two variables. I need to find the points of intersection of these two functions. I tried using Graphics'Mesh'FindIntersections but its not working for 3D plots. Can anyone help me with this? I need to get the data of the intersection points.

The code is as follows:

e1= -0.0492101+(0.00982664*l3*Sec[147.557*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.00982664*l8*Sec[147.557*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139*l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8])==0;
e2= 0.00629091 +(0.113333*l3*Sec[152.139*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.113333*l8*Sec[152.139*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139 l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8])==0 
plot=Plot3D[{e1,e2}, {l3, 0.008, 0.012}, {l8, 0.008, 0.012}] 

I have got a 3D plot as shown here. plot

Any help is highly appreciated.

$\endgroup$
3
  • $\begingroup$ The equation f[l3,l8]==0 can only define a contour in plane. $\endgroup$
    – cvgmt
    Mar 20, 2021 at 7:30
  • $\begingroup$ The intersection is symmetric about the diagonal line l3==l8. z=Numerator[Together[Rationalize[e1[[1]]-e2[[1]],0]]]; ContourPlot[z==0,{l3,0.008,0.012},{l8,0.008,0.012}] and FindRoot[Simplify[z==0/.l3->.0112],{l8,.0105}] finds an l8 given a good estimate of the location, but I do not trust that. Look at z==0/.l3->.0112 to see why I am skeptical. $\endgroup$
    – Bill
    Mar 20, 2021 at 7:34
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Mar 20, 2021 at 18:15

1 Answer 1

2
$\begingroup$

Perhaps ContourPlot helps to find the intersection points! Try

e1= -0.0492101+(0.00982664*l3*Sec[147.557*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.00982664*l8*Sec[147.557*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139*l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8]) ;

e2= 0.00629091 +(0.113333*l3*Sec[152.139*l3]^2*(Tan[147.557*l8]+3.34665*Tan[152.139*l8]))/(Tan[152.139*l3]*Tan[147.557*l8]-Tan[147.557*l3]*Tan[152.139*l8])+(0.113333*l8*Sec[152.139*l8]^2*(Cot[147.557*l8]*Tan[147.557*l3]+3.34665*Cot[147.557*l8]*Tan[152.139*l3]))/(-Tan[152.139 l3]+Cot[147.557*l8]*Tan[147.557*l3]*Tan[152.139*l8]);

plot = ContourPlot[ 
   e1 == e2  , {l3, 0.008, 0.012}, {l8, 0.008, 0.012}, 
   MaxRecursion -> 4, PlotPoints -> 50 ] // Quiet 

enter image description here

intersectionpoints=plot[[1]] [[1]][[1]]
(*{{0.008, 0.0106924}, {0.00800158, 0.0106923}, {0.00800352,0.0106923}, {0.0080051, 0.0106923},...}*)
$\endgroup$
6
  • $\begingroup$ Here are several other solutions: $$ [[\mathit{l3} = - 0.928876965234335, \mathit{l8} = 0.322423141027989] , [\mathit{l3} = 2.97284035794540, \mathit{l8} = 0.311944493392789] , [\mathit{l3} = - 21.6616722319277, \mathit{l8} = - 8.27489640495406] , [\mathit{l3} = - 55.0458668808167, \mathit{l8} = 30.2464029070779]] $$ $\endgroup$
    – user64494
    Mar 20, 2021 at 14:19
  • $\begingroup$ @user64494 Might be, I restricted the solution range to the range OP asked for! $\endgroup$ Mar 20, 2021 at 15:40
  • $\begingroup$ Thank you so much. How can I substitute those (intersectionpoints) values back into the equations? And also I want to substitute all these points into another two expressions. I can use ReplaceAll by using /. {l3-> ,l8-> } but how to represent each point respectively in that case? $\endgroup$
    – sunanda
    Mar 22, 2021 at 4:59
  • $\begingroup$ Try Map["expression" /. {l3->#[[1]],l8->#[[2]]}&,intersectionpoints] $\endgroup$ Mar 22, 2021 at 7:07
  • $\begingroup$ Perhaps it's clever to Interpolate every branch of the intersectionpoints... $\endgroup$ Mar 22, 2021 at 7:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.