1
$\begingroup$

I have an equation

y[a, b, x] = a^2 b x^-2 (Exp[b/x] - 1)^-1

and when I plot, it gives the expected curve as shown in the image attached.

Equation Plot

I need to find the value of x at the intersecting point, marked with a circle. For a large number of the parameters a and b, I could find the solution and select the value of x at x=1, but it will give two different points.

For varying a and b, the line will also shift accordingly. How should I do it?

$\endgroup$
5
  • $\begingroup$ Please post the Mathematica code about your picture. $\endgroup$
    – cvgmt
    2 days ago
  • $\begingroup$ The equation is given in the plot. It is y[a,b,x]=a^2*bx^{-2} Exp[(b/x)-1]^{-1}, then just did the LogLogPlot $\endgroup$
    – Pritam
    2 days ago
  • 1
    $\begingroup$ @Pritam next time, please do make some effort to craft a reasonably good question. $\endgroup$
    – rhermans
    2 days ago
  • $\begingroup$ Thank you for your efforts. $\endgroup$
    – Pritam
    2 days ago
  • $\begingroup$ You write you wanted to find the value of x but selected an answer that does not do that. That's very confusing. $\endgroup$
    – Michael E2
    21 hours ago

3 Answers 3

6
$\begingroup$

Notice you have a syntax problem in your code, the correct way to define your function is like this

y[a_, b_, x_] = a^2 b x^-2 (Exp[b/x] - 1)^-1

Now you can Solve for the parameter a, for any b and x

Solve[y[a, b, x] ==1,{a}]

enter image description here

Now you have an expression for a, that you can replace with any x and b that makes sense.

If you want only the solution to the left, then you can use Min to get

Min[a/.Solve[y[a, b, x] ==1,{a}]]

enter image description here

$\endgroup$
1
  • 1
    $\begingroup$ Depending on what the OP is doing, it might be numerically advantageous to reformulate the solution as x Exp[b/(4 x)] Sqrt[2/b Sinh[b/(2 x)]] (and its negative). $\endgroup$ 2 days ago
2
$\begingroup$

Assuming (1) you really did mean, "I need to find the value of x....", (2) that "marked with a circle" is code for the minimum positive value of x, then Solve[] can do it. (I'll use the variant SolveValues[] for convenience.)

solveForX[a_, b_] := Min@SolveValues[
    a^2 b x^-2 (Exp[b/x] - 1)^-1 == 1 && x > 0,
    x, 
    Reals];

solveForX[1, 1/10]
(*
Root[{-1 - 10 #1^2 + 10 E^(1/(10 #1)) #1^2 &, 
  0.0171457002528354157999}]
*)

If you don't like Root objects or have to use the result outside of Mathematica, then N[] may be used to convert the solution to any desired precision.

N[solveForX[1, 1/10]]
(*  0.0171457  *)

Or if you use floating-point inputs, you'll get a floating-point output:

solveForX[1., 0.1]
(*  0.0171457  *)
$\endgroup$
1
$\begingroup$

We set a,b and the leval set c varying and find the root x.

f[{a_, b_}][x_] = a^2 b x^-2 (Exp[b/x] - 1)^-1;
root[p_?VectorQ][c_] := NSolveValues[f[p][x] == c, x, Reals];
pt[p_?VectorQ][c_] := 
  If[Length[ root[p][c]] >= 2, {Log@First@root[p][c], Log@c} // Point,
    Nothing];
Manipulate[
 Show[Plot[{f[p][x], c} // Evaluate, {x, 0.02, 1000}, 
   ScalingFunctions -> {"Log", "Log"}, PlotRange -> {0, 4}, 
   AspectRatio -> 1, PerformanceGoal -> "Quality"], 
  Graphics[{Red, AbsolutePointSize[5], pt[p][c]}]], {{p, {3, 2}}, {2, 
   2}, {10, 10}}, {c, .5, 1.5}, ControlPlacement -> Left]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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