I' ve turned my interestes to considering transcendental equations : equations that can' t be solved by regular algebraic techniques. Here, I have Mathematica find the non trivial (non-zero) solutions to the trancendental equation x = k Sin@xD for x as k varies on H1, ¥L. Below is a graph of the non-trivial intersection of the two graphs f HxL = x and gHxL = k Sin@xD. In[3]:=
f@x_, k_D := Hk Sin@xD - xL * HSqrt@xD Sqrt@xDL
2
x-kSin[x].nb
In[4]:=
Manipulate@ 8Plot@8x, k Sin@xD<, 8x, 0, Π<, PlotRange ® 80, 6
k
6
5
4 Out[4]=
:3
, 9x ® 2.80119 × 10-8 =>
2
1
0.0
0.5
1.0
1.5
2.0
2.5
3.0
Now, to attempt to estimate a function f HkL = x, i.e. a function that solves the equation for x given any k, I' ll use Mathematica's FindRoot function, which gives us a numerical root for the function f Hx, kL = k Sin@xD - x. The code below gives us a large table of data points 8k, f HkL<; it took about 5 minutes to get all that data. In[5]:=
data = Table@8k, ReplaceAll@x, FindRoot@f@x, kD, 8x, Pi
Now, I' ve attempted to fit a few different kinds of functions to the gathered data: an arctan function, a polynomial function, a log function, and a mash up of all those to see which one is really the best. As it turns out, the arctangent function is the most accurate to approximate the data. We know for two reasons: first, the arctangent approximation function, arctanfit, is the closest to the actual data. Well actually, it's not the closest; the crazyfit is. That's because if we look at the crazy fit's explicit definition, only the constant part and the arctangent part are at all significant. This means that the arctan is really the best guy to do the job, (since arctanfit has an arctan and a constant), since the crazy fit is better only because it had more parameters to do some minor tweaking. In[47]:=
arctanfit=Fit@data,81,ArcTan@xD<,xD polyfit=Fit@data,81,x,x^2,x^3,x^4,x^5,x^6,x^7<,xD logfit=Fit@data,81,Log@xD,1Log@x+1D<,xD crazyfit=Fit@data,81,Log@xD,Sin@xD,E^x,1Log@x+1D,ArcTan@xD,x^2,x<,xD arctanfitacc@s_D:=Harctanfitfunc@sD-pointdata@sDLpointdata@sD Manipulate@Plot@8arctanfit,pointdata@xD,polyfit,logfit,crazyfit<,8x,1,50<,PlotStyle®8Orange,Black
x-kSin[x].nb
3
Crazyfit@xD = 9.60857 + 2.991894988843718 × 10-437 ãx + 0.000278166 x - 1.08262 × 10-7 x2 4.71962 2.96724 ArcTan@xD - 0.188471 Log@xD + 0.0000214448 Sin@xD Log@1 + xD
a b
Data HBlackL vs. a Best Fit Function HOrangeL & Others
3.10
3.05
Out[52]=
3.00
2.95
2.90
10
20
30
Since the arctangent function was the best, I' ve done some extra error analysis with it and the data points below.
40
4
x-kSin[x].nb
Plot@8tanfitacc@sD, arctanfitfunc@sD - pointdata@sD<, 8s, 1, 100<, PlotStyle ® 8Red, Green<, PlotLabel ® "Error HGreenL and % Error HRedL"D
Error HGreenL and % Error HRedL
0.008 0.006 0.004 0.002
20
40
60
80
100
-0.002 -0.004 In[10]:=
arctanfitfunc[x_] := -1.3531725264187149` + 2.8608789879906746` ArcTan[x] Though it obviously isn' t a complete match, the error is pretty darn close to zero; so the arctan function is a pretty good approximating function. Which is cool.