I have a term 'Keff' in terms of 'W'. I need to write 'W' in terms of 'Keff'. Does Mathematica provide an option for that

I have read similar answers on this topic. I am still not able to execute my code.The code is as follows.

L = R1 + R2;
M11 = Evaluate[(-Exp[I*((Ph2 + Ph1)/2)] + r^2*Exp[-I*((Ph2 - Ph1)/2)])/t^2]
M12 = Evaluate[r/t^2 (Exp[I*(Ph2/2)] - Exp[-I*(Ph2/2)])]
M21 = Evaluate[r/t^2 (Exp[-I*(Ph2/2)] - Exp[+I*(Ph2/2)])]
M22 = Evaluate[(-Exp[-I*((Ph2 + Ph1)/2)] + r^2 Exp[I*((Ph2 - Ph1)/2)])/t^2]
sol = NSolve[y^2 - (M11 + M22) y + ((M11*M22) - (M12*M21)) == 0, y];
Keff = Evaluate[I/L*Log[y]] /. sol;


Here, I get my 'Keff' in terms of 'Ph1' and 'Ph2'. Defining Ph1 and Ph2, we get

Ph1 = (2 Pi*R1*neff*W)/c;
Ph2 = (2 Pi*R2*neff*W)/c;


Rest all terms being constant, I get 'Ph1' and 'Ph2' in terms of 'W'. Thus, 'Keff' also comes in terms of 'W'.

Next, I need an expression for 'W' in terms of other constants. I have taken a simpler equation to see if I am able to interchange the variables.

Speed = 3*10^14;
Coupling = 0.5;
EffIndex = 3.1;
Radius = 2.5 ;
M11Scissor = (1-Coupling*Exp[-I*Phi])/(Coupling - Exp[-I*Phi])*Exp[I*Theta];
Sol1 = Solve[x^2 - M11Scissor*x == 0, x];
Keff = (I/Gap*Log[x] /.Sol1[[2]] /. {Ph1 -> (2 Pi*Radius*EffIndex*W)/Speed, Theta -> (Gap*EffIndex*W)/Speed} // Simplify)


You have unnecessary Evaluate here and there. After their elimination and writing Solve instead of NSolve one gets to the answer for Keff=Keff(W):

    L = R1 + R2;
M11 = (-Exp[I*((Ph2 + Ph1)/2)] + r^2*Exp[-I*((Ph2 - Ph1)/2)])/t^2;
M12 = r/t^2 (Exp[I*(Ph2/2)] - Exp[-I*(Ph2/2)]);
M21 = r/t^2 (Exp[-I*(Ph2/2)] - Exp[+I*(Ph2/2)]);
M22 = (-Exp[-I*((Ph2 + Ph1)/2)] + r^2 Exp[I*((Ph2 - Ph1)/2)])/t^2;
sol = Solve[y^2 - (M11 + M22) y + ((M11*M22) - (M12*M21)) == 0, y];
Keff = (I/L*Log[y] /. sol /. {Ph1 -> (2 Pi*R1*neff*W)/c,
Ph2 -> (2 Pi*R2*neff*W)/c} // Simplify)


The result is too long and I do not post it. You can simply evaluate the code above. The result can then be written down as an equation to solve for W. Mma, however, refuses to analytically solve this. You can check

  Solve[Keff == k, W]


Solve::nsmet: This system cannot be solved with the methods available to Solve. >> which means that the equation appears to be too complex to be solved analytically. Nothing to do. One may solve it numerically, however, if to fix its numerous parameters.

Have fun!

• +1. Just to add to Alexei's remarks, examining lK = Keff /. W -> Log[lW]/((I neff \[Pi] (R1 + R2))/c) // Simplify shows a simplified structure in which the variable lW has both integer powers and algebraic powers such as (2 R1)/(R1 + R2). The solutions, including the number of solutions, will depend on these powers. A simpler equation with the same problem: Solve[x^a + x == 1, x]. I, too, do not expect this can be solved. Nov 18, 2015 at 11:21
• @alexei Boulbitch Thanks for the answer. I have taken another equation which is much simpler than the above one. However, I am still not getting the results. Also, when I write Solve[Keff == k, W], I simple get "{}" as output. Dec 2, 2015 at 2:43
• @MichaelE2 Thanks for the help. Is it possible to solve a simpler version of the problem or will that also be not possible? Will the inverse button help? Dec 2, 2015 at 4:27
• @user35115 It depends upon the equation. As you know, some equations can, while others cannot be solved in terms of elementary functions. Anyway to answer your question one needs to have the equation. Generally, however, if Mma returns the same equation unsloved, you have good chances that the equation cannot be solved at all. Dec 2, 2015 at 8:22
• @AlexeiBoulbitch The equation I am attempting now is M1 = (1 - CouplingExp[-IPhi])/(Coupling - Exp[-IPhi])*Exp[ITheta]; Sol1 = Solve[x^2 - M1*x == 0, x]; Keff = (I/GapLog[x] /. Sol1[[2]] /. {Ph1 -> (2 PiRadiusEffIndexW)/Speed, Theta -> (GapEffIndexW)/Speed} // Simplify) Now you have Keff in terms of W. So when I am attempting to put this in terms of W, I am getting "{}" as output. Dec 2, 2015 at 8:37