# Simplify inverse of function

This would be a noob question, but I need help simplifying the inverse of an expression

n = 1.45 ; \[Lambda] = 532; W = 0.5*10^-6; d = 2000; q = 1; p = 1;
f = Function[u, (BesselJ[p, (2 \[Pi] u/\[Lambda] (n - 1))])^2*(Sinc[
W/\[Pi] (q - (2*p*\[Pi])/d)])^2]
g = InverseFunction[f]


I need a simplified version of g in terms of polynomials or other mathematical functions, which I can utilise in MS Excel. I tried commands: Simplify, Expand, Refine...

Simplify[g]


But in all the cases, the following out

InverseFunction[Function[u, BesselJ[p, (2 \[Pi] u (n - 1))/\[Lambda]]^2 Sinc[(W (q - (2 p \[Pi])/d))/\[Pi]]^2]]


Thanks!!

• Without specifying the range where the function is defined, the inverse is multivalued. Nov 22, 2023 at 14:07
• This function f is approximately just (81 \[Pi]^2 Sinc[(1 - \[Pi]/1000)/(2000000 \[Pi])]^2 x^2)/113209600 or numerically 7.06157*10^-6 x^2 . The next series term is fourth order and the coefficient is a miniscule -4.98658*10^-11 x^4 which is more than a few orders of magnitude smaller than the x^2 term. So if we go with that x^2 term alone, the inverse is approximately (10640 Sqrt[y])/(9 \[Pi] Sinc[(1 - \[Pi]/1000)/(2000000 \[Pi])]) or numerically 376.313 Sqrt[y] - The error is very low for small numbers, and reaches about 1% at y == 53 before blowing up after that. Nov 22, 2023 at 15:04
• Excel has the BESSELJ function and polynomial interpolation. Seems like it could be done completely in Excel.
– JimB
Nov 23, 2023 at 0:31

\$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global*"]

n = 145/100; λ = 532; W = 1/2*10^-6; d = 2000; q = 1; p = 1;
f[u_] = (BesselJ[p, (2 π u/λ (n - 1))])^2*(Sinc[
W/π (q - (2*p*π)/d)])^2 // FullSimplify

(* BesselJ[1, (9 π u)/5320]^2 Sinc[(-1000 + π)/(2000000000 π)]^2 *)


Approximate f with

f2[u_] = Series[f[u], {u, 0, 4}] // Normal // Simplify

(* -((81 π^2 u^2 (-113209600 + 81 π^2 u^2) Sinc[(-1000 + π)/(
2000000000 π)]^2)/12816413532160000) *)


The inverse of f2 (approximate inverse of f) is

g = SolveValues[{f2[u] == y, u > 0, y > 0}, u, Reals] // FullSimplify


Show[
ParametricPlot[Evaluate@{f[u], u}, {u, 0, 150},
AspectRatio -> 1,
AxesLabel -> (Style[#, 14] & /@ {f, u})],
Plot[g[[1]], {y, 0, 0.14},
PlotStyle -> Directive[Red, Dashed]]]


EDIT: For a variable n

Clear[n]

f3[n_, u_] = (BesselJ[p, (2 π u/λ (n - 1))])^2*(Sinc[
W/π (q - (2*p*π)/d)])^2 // FullSimplify

(* BesselJ[1, 1/266 (-1 + n) π u]^2 Sinc[(-1000 + π)/
(2000000000 π)]^2 *)


f3 reduces to f for n == 145/100

f[u] == f3[145/100, u]

(* True *)

f4[n_, u_] = Assuming[n > 1,
Series[f3[n, u], {u, 0, 4}] // Normal // Simplify]

(* ((-1 + n)^2 π^2 u^2 (283024 - (-1 +
n)^2 π^2 u^2) Sinc[(-1000 + π)/(
2000000000 π)]^2)/80102584576 *)


f4 reduces to f2 for n == 145/100

f2[u] == f4[145/100, u] // Simplify

(* True *)


Use ToRadicals to convert the Root expressions to algebraic expressions

g2[n_, y_] =
SolveValues[{f4[n, u] == y, u > 0, y > 0, n > 0}, u, Reals] // ToRadicals //
Simplify[#, n > 1] &


The second parts are consistent

g[[2]] === g2[145/100, y][[2]]

(* True *)


However, the first parts appear to have taken different branches

(g[[1]] // Normal) == (g2[145/100, y][[1]] // Normal)


Manually adjusting g2[n, y][[1]]

g3[n_, y_] = ConditionalExpression[
((266*Sqrt[2 - (2*Sqrt[-4*y + Sinc[(-1000 + Pi)/(2000000000*Pi)]^2])/
Sinc[(-1000 + Pi)/(2000000000*Pi)]])/
((-1 + n)*Pi)), y > 0 && 4*y < Sinc[(-1000 + Pi)/(2000000000*Pi)]^2]


g[[1]] === g3[145/100, y]

(* True *)


Graphically verifying the inverses,

Show[
ParametricPlot[
Evaluate@
Table[{f3[n, u], u}, {n, 13/10, 16/10, 1/10}],
{u, 0, 150},
PlotLabels ->
(Placed[StringForm["n\[ThinSpace]=\[ThinSpace]", #], Above] & /@
Range[13/10, 16/10, 1/10]),
AspectRatio -> 1,
AxesLabel -> (Style[#, 14] & /@ {f, u})],
Plot[
Evaluate@
Table[g3[n, y][[1]],
{n, 13/10, 16/10, 1/10}],
{y, 0, 0.25},
PlotRange -> {0, 150},
PlotStyle -> Directive[Black, Dashed]]]


• Wow, Thank you soo much! Much appreciated Nov 22, 2023 at 17:54
• This worked nicely. Another thing, the last one, is that I want n as a variable instead of specifying it (145/100). The code works fine, but the issue is it gives the final output in Root[] form. I don't have much understanding of the Root function. Is there any way it can give output as ordinary functions which I will directly incorporate in excel workbook. Nov 22, 2023 at 20:05
• λ = 532; W = 1/2*10^-6; d = 2000; q = 1; p = 1; f[u_] = (BesselJ[p, (2 \[Pi] u/\[Lambda] (n - 1))])^2*(Sinc[ W/\[Pi] (q - (2*p*\[Pi])/d)])^2 // FullSimplify; (Approximate f with) f2[u_] = Series[f[u], {u, 0, 4}] // Normal // Simplify; (The inverse of f2 (approximate inverse of f) is) g = SolveValues[{f2[u] == y, u > 0, 1.3 < n < 1.6, y > 0}, u, Reals] // FullSimplify Nov 22, 2023 at 20:06
• Thank you sooooo much. I appreciate that you kind of estimated that n (refractive index here) is between 1.3 and 1.6, which is exactly what I was looking for. Nov 23, 2023 at 14:54

If you need to implement the result in Excel, you might want to consider solving the problem completely in Excel. Excel is certainly not the equivalent of Mathematica but it does have a lot of capabilities not appreciated enough.

For example, one can give names to cells so that formulas don't look like C21*SIN(R27)+BESSELJ(A1,B1). The Excel function SOLVER can do something very similar if not exactly what Mathematica's FindRoot can do.

Here is a screen shot of how one might want to solve your question.

The formula in cell D2 is

=C2-(PI()^2*BESSELJ(2*(n-1)*PI()*x/lambda,p)^2*SIN((((-2*p*PI())/d + q)*W)/PI())^2)/(((-2*p*PI())/d + q)^2*W^2)
`

This is an example where $$f(x)=0.003$$ and the value of $$x$$ is determined to be 747.0876 (in cell C4). (And certainly the answers from others here can be used for good starting values.)