Group Abstract Group Abstract

Message Boards Message Boards

0
|
2.1K Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Dotted line and solid line both at intersection point

Posted 3 years ago

I need a dotted line above intersection point and solid line below intersection point of any two curves where they meet. How to produce it in mathematica.

POSTED BY: Shivank Kumar
Posted 3 years ago

Hi Shivank

The intersection points have to be determined first. Here is one way (probably not the best)

(* All pairs of expressions *)
pairs = Subsets[M, {2}]

(* Convert to equations *)
eqns = Equal @@@ pairs

(* Find solutions *)
soln = Solve[Rationalize@#, c, Assumptions -> c > 0] & /@ eqns // Flatten

(* x and y coordinate of solutions *)
y = MapThread[ReplaceAll, {pairs, soln}] // Flatten // Round[#, .001] & // DeleteDuplicates
x = soln // Values

(* Intersection points *)
intersections = Transpose[{x, y}]

Then construct an Epilog with the type of lines you want e.g.

epilog = {Red, PointSize[Medium], Point[intersections], Blue, 
  Line[{{x[[1]], 0}, {x[[1]], y[[1]]}}], Dotted, 
  Line[{{x[[1]], y[[1]]}, {x[[1]], 180}}]}

Plot[M, {c, 0, 10},
 GridLines -> Automatic,
 Frame -> True,
 Epilog -> epilog]

enter image description here

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard