# How to find these two intersections? [duplicate]

1.pv=(q1^2+q*^2-q3^2)/[2(q1+q*-q3)] q*=5.3415is the upper limit of q

2.pv+(1-2a)q+2F=2(1-a)C(q) at q=q1 and q=q3。

equation 2 is actually trying to find the intersections of two graphs,RHS and LHS. So we replace 1 into 2.

F and a are parameters,we try a=0.25, F=0.015641 first, C(q) is a convex cost function，try ln(q+1) here first. I want to try different parameters, a$\in$ (0,1) and C(q) convex to find q1，q3<5.3415. Below is what I do:

I do not understand what does the system warning (red) mean. Any help will be appreciated, thanks in advance.

• @rasher, hi you are right, basically I just change ln into Log[e,b+1], I think I did not express my question clearly, so I ask it in another way here.
– Bob
Commented Jun 29, 2014 at 9:55
• What did you intend by  Log[e, b + 1]? You never give e a value, and e is not the base of the natural logarithms in Mathematica (use E for that). Further, base E is the default for Log, so what you want here is probably just Log[b + 1] Commented Jun 29, 2014 at 10:41
• @m_goldberg,hi thanks for pointing it out!
– Bob
Commented Jun 29, 2014 at 12:38

Log[e,x] is a syntax error. It can be simplified to Log[x]. Experts may provide numerical approaches to solutions. I post this (which is equivalent to my previous post) to provide insights into your equations.

a = 0.25;
F = 0.015641;
q1 = 5.3415;
c[b_] := Log[b + 1]
f[x_, y_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*x + 2*F -
2*(1 - a)*c[x]
g[x_, y_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*a)*y + 2*F -
2*(1 - a)*c[y]
ContourPlot[{f[x, y] == 0, g[x, y] == 0}, {x, 0, 2}, {y, 4, 6},
MeshFunctions -> (Abs[f[#1, #2]] +Abs[g[#1, #2]] &), Mesh -> {{0}},
MeshStyle -> PointSize[0.02]]

To get insight into behaviour of functions in a limited domain varying parameter a.

fa[x_, y_, p_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*p)*x +
2*F - 2*(1 - p)*c[x]
ga[x_, y_, p_] := (x^2 + q1^2 - y^2)/2*(x + q1 - y) + (1 - 2*p)*y +
2*F - 2*(1 - p)*c[y]
Manipulate[
ContourPlot[{fa[x, y, p] == 0, ga[x, y, p] == 0}, {x, 0, 2}, {y, 5,
10}, MeshFunctions -> (Abs[fa[#1, #2, p]] + Abs[ga[#1, #2, p]] &),
Mesh -> {{0}}, MeshStyle -> PointSize[0.02],
PerformanceGoal -> "Quality", PlotLegends -> "Expressions"], {p, 0,
1, Appearance -> "Labeled"}]

• This is such a neat answer, +1. As an aside, what are you using to record your interaction?
– ciao
Commented Jun 29, 2014 at 21:02
• @rasher thank you. I use LICEcap: licecap.en.softonic.com (does not work on all platforms) Commented Jun 30, 2014 at 2:31