1
$\begingroup$

I am trying (desperately) to find a way to solve a transcendental equation whose solution $x$ depends on non-numerical parameters $a$ and $b$. And then to produce a Plot3D of the solution.

However no matter what I tried I cannot solve it, Solve says that this problem cannot be solved with methods available to Solve, while Reduce just runs for hours without any output.

My problem looks quite simple.

I have two polynomial functions

f1[x]= 2 x ^2 + 11 x + 7;

f2[x]= 4 x ^2 - 15 x + 12;

And now I would like to run the following code, to solve my equation

Solve [x == (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/
((1 - a) + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x])) && 0<=x<=1,  
 x, Reals]

The solution should be some function $x(a,b)$, which I would like to plot for $a\in [0,1]$ and $b\in[0,1]$.

I looked at the related questions here, but have not found any close problem, that would be parametric as mine.

Thanks in advance for any hints.

$\endgroup$
4
  • $\begingroup$ A detailed answer requires taking a closer look at the problem even though immediately I can see a few critical issues which you seem to overlook. At first I recommend to read this answer to another question: Solve symbolically a transcendental trigonometric equation and plot its solutions. Starting with those hints you should understand how to tackle such problems. $\endgroup$ – Artes Jun 27 '16 at 23:17
  • $\begingroup$ Your "function" definitions don't actually define functions, although they may work by accident here. Please learn proper Mathematica syntax. $\endgroup$ – John Doty Jun 27 '16 at 23:23
  • $\begingroup$ To John, I simplified the code to the maximum, and did not want to use the delayed definition, which is fine for that simple version of the problem... $\endgroup$ – Kass Jun 27 '16 at 23:51
  • $\begingroup$ To Artes, thanks a lot for that link, I did not see it while searching, going to read it carefully now. $\endgroup$ – Kass Jun 27 '16 at 23:52
2
$\begingroup$

In general one should not expect to obtain a general symbolic solution (a function x[a,b]) to the given equation since there are two independent variables, see e.g. Solve symbolically a transcendental trigonometric equation and plot its solutions for certain aspects regarding transcendental equations.

To get an idea how the solution depends on parameters a and b one can play with Manipulate, e.g.

Manipulate[ 
    Plot[ x - (Log[f2[x]] - Log[f1[x]] + Log[b] - 
            Log[a])/((1 - a) + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x])),
         {x, -1/2, 1}], 
    {a, 0.01, 1}, {b, 0.01, 1}]

enter image description here

With the above parameters (a == 0.612; b == 0.23) one can see that there are no solutions satisfying 0< x <= 1 however slightly below 0 one could find a solution.

If one expects a symbolic solution this approach yields a solution under specified assumptions (0 < a <= 1 && 0 < b <= 1 and 0 < x <= 1):

XS[a_, b_] /; 0 < a <= 1 && 0 < b <= 1 := 
  x /. Solve[ x == (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/((1 - a) 
              + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x])) && 0 <= x <= 1, x]

It yields a symbolic solution, although it takes a bit e.g.:

XS[1/2, 1/3]
{Root[{-504 Log[2] + 504 Log[3] + 504 Log[7 + 11 #1 + 2 #1^2] - 
 504 Log[12 - 15 #1 + 4 #1^2] + 810 #1 - 162 Log[2] #1 + 
 162 Log[3] #1 + 162 Log[7 + 11 #1 + 2 #1^2] #1 - 
 162 Log[12 - 15 #1 + 4 #1^2] #1 + 321 #1^2 + 678 Log[2] #1^2 - 
 678 Log[3] #1^2 - 678 Log[7 + 11 #1 + 2 #1^2] #1^2 + 
 678 Log[12 - 15 #1 + 4 #1^2] #1^2 - 1279 #1^3 - 84 Log[2] #1^3 + 
 84 Log[3] #1^3 + 84 Log[7 + 11 #1 + 2 #1^2] #1^3 - 
 84 Log[12 - 15 #1 + 4 #1^2] #1^3 + 154 #1^4 - 48 Log[2] #1^4 + 
 48 Log[3] #1^4 + 48 Log[7 + 11 #1 + 2 #1^2] #1^4 - 
 48 Log[12 - 15 #1 + 4 #1^2] #1^4 + 88 #1^5 &, 0.0302267261272062868225}]}

The time it takes strongly depends on parameters taken which is rather an unexpected feature. Nevertheless from such a representation we can't transform the solution to a simpler form, so the symbolic transcendental solution doesn't seem to be crucial goal unless we know the background of the problem and can reformulate it. However one can get immediately the numerical solution with FindRoot, e.g.

XF[a_, b_] /; 0 < a <= 1 && 0 < b <= 1 := 
  x /. FindRoot[ x == (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/((1 - a)
                   + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x])), 
                {x, 0, -1/2, 1}]

XF[1/2, 1/3]
 0.0302267  

and we can use this function to plot how the solution depends on the parameter, e.g.

Plot[ XF[2/3, b], {b, 0.1, 1}]

enter image description here

$\endgroup$
2
$\begingroup$

Perhaps this! It works if you only need the plot and not the values, or the function. That would require more work.

ContourPlot3D[
  Evaluate[-x + (Log[f2[x]] - Log[f1[x]] + Log[b] - Log[a])/((1 - a) + (1 - 1/f1[x]) - (1 - b) + (1 - 1/f2[x]))]
  , {a, 0, 1}, {b, 0, 1}, {x, 0, 1}
  , AxesLabel -> {"a", "b", "x"}
  , Contours -> {0}
  , Mesh -> None
  , BoundaryStyle -> None
 ]

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.