differential equations – How to fit the solution of a NSolve with a NDSolve embedded

I have a system : $$s'(t)=A n+B a(t)\a'(t)=C a(t) $$

Then I define the function $tau(n)$ as the solution of the equation :
$$a(tau(n))n=1$$
and I’m looking for the parameters $A,B,C$ with a fit.

Here is my code :

at(t_?NumericQ, a0_?NumericQ, a1_?NumericQ, a2_?NumericQ, 
  N0_?NumericQ) := 
 s(t) /. NDSolve({s'(t) == a0*N0 + a1*a(t), a'(t) == a2*s(t), 
     s(0) == 0, a(0) == 0}, a, {t, 0, 100})((1))

Tsol(a0_?NumericQ, a1_?NumericQ, a2_?NumericQ, N0_?NumericQ) := 
 t /. NSolve(at(t, a0, a1, a2, N0)*N0 == 1, t)((1))

n0 = 10000;
data0 = {{n0/32, 40}, {n0/16, 36}, {n0/8, 30}, {n0/4, 28}, {n0/2, 
    22}, {n0, 18}};
data = N(Table({Log(data0((n, 1))), data0((n, 2))}, {n, 1, 
     Length(data0)}));

fit1(x_) = 
 NonlinearModelFit(
  data, {Tsol(AA, BB, CC, Exp(x)), AA >= 0, BB >= 0, CC >= 0}, {AA, 
   BB, CC}, x)

I’m using the logarithm because I think it is more adapted.

But it seems that I made mistakes in the code. Could you help please ?

performance tuning – NSolve cannot solve. 3 equations in 3 variables

I’m trying to numerically find the critical points of the following function in 3 variables

V(x_, y_, (Theta)_) := (Cos(Sqrt(x^2 + y^2 + 2 x y Sin((Theta)))) + Cos(Sqrt(x^2 + y^2 - 2 x y Sin((Theta)))))^2

NSolve takes a long time and then eventually says This system cannot be solved with the methods available to NSolve.

NSolve(D(V(x, y, (Theta)), x) == 0 && D(V(x, y, (Theta)), y) == 0 &&
   D(V(x, y, (Theta)), (Theta)) == 0, {x, y, (Theta)},Reals)

My question is how can I optimise this?

plotting – Why code is running and not giving any output for NSolve?

I am trying to solve the given equation in the code and want to plot ‘N1’ with ‘P1’. But the code is not giving me any output and still showing running. What is the problem with it?
If anyone can figure it out will be appreciated.

dela = -1.5;(*Subscript((CapitalDelta), L) ; Laser-Lower polariton 
detuning*)
g1 = 0.0003; (* Subscript(g, 0) ; vacuum optomechanical strength *)
del0 = -0.006; (* (Delta) ;  exciton-photon detuning*)
ome = 3.014; (* (CapitalOmega) ; Rabi splitting *)
omem = 0.125; (* Subscript((CapitalOmega), m) ; mechanical 
resonator's frequency *)
kexc = 0.002;  (* Subscript((Kappa), exc  ;  )exciton decay rate*)
kk = .2;   (* (Kappa); cavity decay rate *)
gma = 0.00001;  (* (CapitalGamma) ; phonon dcay rate *)
nth = 0;
kal = (kk + kexc)/2 - del0*(kk - kexc)/(2*ome);
g0 = g1*(1 - del0/ome)/2;
kb = 0.1;
sol = NSolve({-I*(P1/Sqrt(2)*(1 - del0/(2*ome)))*(Conjugate(a1) - 
     a1) - I*(P1*g1/(2*Sqrt(2)*ome))*(alab - Conjugate(alab) + 
     Conjugate(betab) - betab) + kal*N1 + 
  kb*(alab*a1 + Conjugate(alab)*Conjugate(a1) + 
     betab*Conjugate(a1) + 
     Conjugate(betab)*
      a1 + (N1 - 2*(Abs(a1))^2)*(b1 + Conjugate(b1))) == 0, 
I*dela*alab + I*omem*alab - 
  I*g0*((2*N1 - Abs(a1)^2 - Np + 2*2*(Abs(b1))^2 + b1^2)*
      Conjugate(a1) - (Conjugate(betab) + 2*alab)*b1 - 
     alab*Conjugate(b1)) + I*(P1/Sqrt(2)*(1 - del0/(2*ome)))*b1 - 
  I*(P1*g1/(2*Sqrt(2)*ome))*(N1 - Np + (Conjugate(a1))^2 - 
     b1^2) + (kal + gma)*alab/2 + 
  kb/2*(Conjugate(betab)*b1 + 
     alab*Conjugate(b1) + (Np - 2*(Abs(b1))^2)*Conjugate(a1) + 
     2*alab*b1 - b1^2*Conjugate(a1)) == 
 0, -I*g0*((N1 - 2*(Abs(a1))^2)*(Conjugate(b1) - b1) + 
     Conjugate(alab)*Conjugate(a1) - alab*a1 + 
     Conjugate(betab)*a1 - betab*Conjugate(a1)) - 
  I*(P1*g1/(2*Sqrt(2)*ome))*(Conjugate(betab) - alab + 
     Conjugate(alab) - betab) + gma*Np - gma*nth == 0,
-I*dela*betab + I*omem*betab - 
  I*g0*((2*N1 - (Abs(a1))^2 + Np - 2*(Abs(b1))^2)*
      a1 - (2*betab - a1*b1 + Conjugate(alab))*b1 + 
     betab*Conjugate(b1)) - I*(P1/Sqrt(2)*(1 - del0/(2*ome)))*b1 -
   I*(P1*g1/(2*Sqrt(2)*ome))*(N1 + Np + a1^2 + b1^2 + 1) + (kal + 
     gma)*betab/2 + 
  kb/2*((2*betab - a1*b1 + Conjugate(alab))*
      b1 + (Np - 2*(Abs(b1))^2)*a1 + betab*Conjugate(b1)) == 0,
-I*dela*a1 - I*g0*(Conjugate(alab) + betab) - 
  I*(P1/Sqrt(2)*(1 - del0/(2*ome))) - 
  I*(P1*g1/(2*Sqrt(2)*ome))*(b1 + Conjugate(b1)) + kal*a1/2 + 
  kb*(Conjugate(alab) + betab)/2 == 0,
I*omem*b1 - I*g0*N1 - 
  I*(P1*g1/(2*Sqrt(2)*ome))*(a1 + Conjugate(a1)) + gma*b1/2 == 
 0}, {N1, alab, Np, betab, a1, b1});
 Plot({Evaluate(N1) /. sol}, {P1, 0, 20})

differential equations – How to use NDsolve and NSolve together

I have a differential equation that I can’t solve analytically, so I use NDSolve to get a solution.

Suppose that I can’t solve the next equation

sol = NDSolve({D(p(x)/(1 + x)^3, x) == 0, p(0) == 1}, p, {x, 0, 1000})

And know that I have the numerical solution, I want to find a solution of this equation

NSolve((p(x) /. sol) == 100, x, Reals)

However, it doesn’t work.

If I have the analytical solution of the differential equation this is easy, I just have to do the next,

Solve((1 + x)^3 == 100, x, Reals)

Any recommendations?

List manipulation – elegant solving and drawing of multivalued solutions for a system of 2 equations with parameters with NSolve?

It looks long and complicated, but it really isn't. I was just trying to fix the problem well.

I have to solve a relatively complicated system of equations that has 2 variables and 3 parameters.

I'll start with a few simplifications to make the equation readable:

Clear(z, F2, g, a)
z = 1;
aa(a_, aNL_) := a - aNL
gg(g_, gNL_) := Sqrt(g^2 + gNL^2)

These equations flow into the following system of two equations with two variables (aNL, gNL), which also depend on three input parameters (a, F2, g). The system of equations is defined as SLNS2 below.

SLNS2(aVal_, F2Val_, gVal_) := 
 NSolve({aNL == (2 z + 1)/2 F2 (
      1 + (aa(a, aNL) - gNL)^2 + 
       gg(g, gNL)^2)/((1 + gg(g, gNL)^2 - aa(a, aNL)^2)^2 + 
       4 aa(a, aNL)^2), 
    gNL == (2 z - 1)/2 F2 (
      1 + (aa(a, aNL) - gNL)^2 - 
       g^2)/((1 + gg(g, gNL)^2 - aa(a, aNL)^2)^2 + 
       4 aa(a, aNL)^2)} /. {a -> aVal, F2 -> F2Val, g -> gVal}, {aNL, 
   gNL}, Reals)

Note that I used the dependency of the solutions on certain values ​​of the input parameters /. {a -> aVal, F2 -> F2Val, g -> gVal}.

For certain input parameters, the system of equations is monovalent in (aNL, gNL):

SLNS2(2, 30, 0.01)

For other input parameter values, the system is multi-valued with up to 5 unique solutions:

SLNS2(14.5, 30, 0.01)

The next goal was to create functions (or at least curves) for each variable against the input parameter aThe other two parameters (F2, g) are retained as input parameters.

Single-value solutions

To construct these curves, I created a 2-column list for "aNL vs a" and "gNL vs a" LISTaNL and LISTgNL respectively.

aMIN1 = -30;
aMAX1 = +10;

LISTaNL(F2Val_, gVal_, aSTEP_) := 
 Table({aVal, SLNS2(aVal, F2Val, gVal)((1))((1))((2))}, {aVal, aMIN1, 
   aMAX1, aSTEP})

LISTgNL(F2Val_, gVal_, aSTEP_) := 
 Table({aVal, SLNS2(aVal, F2Val, gVal)((1))((2))((2))}, {aVal, aMIN1, 
   aMAX1, aSTEP})

In the above functions, ((1)) ((1)) ((2)) are used to select the numerical value of aNL or gNL in every solution. To see how this works, run the following code.

SLNS2(-20, 30, 1)
SLNS2(-20, 30, 1)((1))
SLNS2(-20, 30, 1)((1))((1))
SLNS2(-20, 30, 1)((1))((1))((2)) (*isolate aNL value*)
SLNS2(-20, 30, 1)((1))((2))((2)) (*isolate gNL value*)

The sample output is below

aNLsingle = LISTaNL(30, 1, 2);
gNLsingle = LISTgNL(30, 1, 2);

ListPlot({aNLsingle, gNLsingle}, PlotRange -> {{-30, 60}, {-2, 60}}, 
 PlotStyle -> {Red, Blue}, Axes -> False, Frame -> True, 
 FrameLabel -> {"a", "aNL or gNL"}, PlotStyle -> Red, 
 LabelStyle -> Directive(Black, fontsize, FontFamily -> "Arial"), 
 PlotLabel -> 
  Style("Sample single-valued solutions", fontsize, Bold, Black), 
 PlotLegends -> 
  Placed(LineLegend({"aNL", "gNL"},(*LegendFunction(Rule)"Frame",*)
    LegendMarkerSize -> 15, 
    LabelStyle -> Directive(FontFamily -> "Arial", 16), 
    LegendLayout -> "Column"), {0.26, 0.575}))

Multi-value solutions

All important information from these curves is in the multivalued regions. The simple approach described above will fail if it is multivalued because only the first solution is captured.

My current (stupid) way of dealing with this is:

  1. List element Create several curves for each of the 5 solutions
  2. List element Delete non-numeric entries with Select(,#((2))>0&)
  3. List element Combine the 5 solutions into a list.

(Note that I increased the reach of to see the multi-value solutions a Values)

aMIN2 = -30;
aMAX2 = 40;

LISTaNLi(F2Val_, gVal_, aSTEP_, i_) := 
 Select(Table({aVal, SLNS2(aVal, F2Val, gVal)((i))((1))((2))}, {aVal, 
    aMIN2, aMAX2, aSTEP}), #((2)) > 0 &)
LISTgNLi(F2Val_, gVal_, aSTEP_, i_) := 
 Select(Table({aVal, SLNS2(aVal, F2Val, gVal)((i))((2))((2))}, {aVal, 
    aMIN2, aMAX2, aSTEP}), #((2)) > 0 &)

Merging the lists

LISTaNLall(F2Val_, gVal_, aSTEP_) := 
 Join(LISTaNLi(F2Val, gVal, aSTEP, 1), 
  LISTaNLi(F2Val, gVal, aSTEP, 2), LISTaNLi(F2Val, gVal, aSTEP, 3), 
  LISTaNLi(F2Val, gVal, aSTEP, 4), LISTaNLi(F2Val, gVal, aSTEP, 5))

LISTgNLall(F2Val_, gVal_, aSTEP_) := 
 Join(LISTgNLi(F2Val, gVal, aSTEP, 1), 
  LISTgNLi(F2Val, gVal, aSTEP, 2), LISTgNLi(F2Val, gVal, aSTEP, 3), 
  LISTgNLi(F2Val, gVal, aSTEP, 4), LISTgNLi(F2Val, gVal, aSTEP, 5))

And here is a sample diagram of the output (it will probably take about 60 seconds to run. If it is too slow, increase it aSTEP to something like 5):

aNLmulti = LISTaNLall(30, 1, 0.5);
gNLmulti = LISTgNLall(30, 1, 0.5);

ListPlot({aNLmulti, gNLmulti}, PlotRange -> {{-30, 60}, {-2, 60}}, 
 PlotStyle -> {Red, Blue}, Axes -> False, Frame -> True, 
 FrameLabel -> {"a", "aNL or gNL"}, PlotStyle -> Red, 
 LabelStyle -> Directive(Black, fontsize, FontFamily -> "Arial"), 
 PlotLabel -> 
  Style("Sample multi-valued solutions", fontsize, Bold, Black), 
 PlotLegends -> 
  Placed(LineLegend({"aNL", "gNL"},(*LegendFunction(Rule)"Frame",*)
    LegendMarkerSize -> 15, 
    LabelStyle -> Directive(FontFamily -> "Arial", 16), 
    LegendLayout -> "Column"), {0.26, 0.575}))

(For your information, do not worry about the errors for the time being. You only complain about things for which the second solution is not available in all regions. These data points are also removed Select)

The problem

My approach takes far too much computing time. In my current method, I have to solve five times redundantly for all solutions (because I only use the relevant element for the i-th solution). Is there a more elegant way so that my computing times are not five times as long as they have to be?

** How can I get mathematica not to have data as a & # 39; nested list & # 39; output and first output all solutions as a simple list? ** **.

Bonus questions

Interpolation fails when applied LISTaNLall(F2Val_, gVal_, aSTEP_). Is there a way to create interpolation for multivalued curves so that you can evaluate at any point (within the reasonable range)?

ListLinePLot is a disaster for the same reason. Is there any way to tell mathematica how to follow the curves (without having to sort the lists by hand)? What would that be called anyway? Relevant search terms?

Thank you so much!

Equation solution – Infinite solution with NSolve

I'm having trouble using it NSolve to get a solution for the following coupled equations. I tried it too FindInstance but got no solution. in addition, Reduce, given a very long time there was no solution.

Πx = -4.848 + 0.24862 * I;
Πz = -1.8775 + 0.10476*I;
Φx = -3.09694 + 0.3333* I;
Φz = 0.01623 - 0.0009 *I;
Λx = -1.8185*10^9 + 9.2919*10^7* I;
Λz = -8.5442*10^7 + 4.6752*10^6 *I;γ12 = 2*10^7;a1 = 2;
a2 = 1; a3 = 3; a4 = 1; a5 = 2; a6 = 2; 

eqs = 
  {-(a1/2 + 1/2)*ρ12 - I*a2*ρ12 + I*Λx/γ12*(ρ22 - ρ11)*ρ12 + I*x*(Πx + Φx)*(ρ22 - ρ11) + I*a3*(Πz + Φz)*ρ32 + I*Λz/γ12*ρ13*ρ32 == 0 && 
   -(1/2 + a1/2)*ρ21 + I*ρ21 - I*Conjugate(Λx)/γ12*(ρ22 - ρ11)*ρ21 - I*x*Conjugate((Πx + Φx))*(ρ22 - ρ11) - I*a3*Conjugate((Πz + Φz))*ρ23 - I*Conjugate(Λz)/γ12*ρ31*ρ23 == 0 && 
   -(1/2 + a1/2)*ρ13 - I*a4*ρ13 + I*Λz/γ12*(ρ33 - ρ11)*ρ13 + I*a3*(Πz + Φz)*(ρ33 - ρ11) + I*x*(Πx + Φx)*ρ23 + I*Λx/γ12*ρ12*ρ23 == 0 && 
   -(1/2 + a1/2)*ρ31 + I*a4*ρ31 - I*Conjugate(Λz)/γ12*(ρ33 - ρ11)*ρ31 - I*a3*Conjugate((Πz + Φz))*(ρ33 - ρ11) - I*x*Conjugate((Πx1 + Φx1))*ρ32 - I*Conjugate(Λx1)/γ12*ρ21*ρ32 == 0 && 
   -(a5/2)*ρ32 - I*a6*ρ32 + I*a4*ρ32 + I*a3*Conjugate(Πz + Φz)*ρ12 + I*Conjugate(Λz)/γ12*ρ13*ρ12 - I*x*(Πx + Φx)*ρ31 - I*Λx/γ12*ρ12*ρ31 == 0 && -(a5/2)*ρ23 + I*a6*ρ23 - I*a4*ρ23 - I*a3*ρ21*(Πz + Φz) - I*Λz/γ12*ρ31*ρ21 + I*x*Conjugate((Πx + Φx))*ρ13 + I*Conjugate(Λx)/γ12*ρ21*ρ13 == 0 && 
   -(1 + a1)*ρ11 + I*x*(Πx + Φx)*ρ21 + I*Λx/γ12*ρ12*ρ21 + I*a3*(Πz + Φz)*ρ31 + I*Λz/γ12*ρ13*ρ31 + Conjugate(I*x*(Πx + Φx))*ρ12 + Conjugate(I*Λx)/γ12*ρ21*ρ12 + Conjugate(I*a3*(Πz + Φz))*ρ13 + Conjugate(I*Λz)/γ12*ρ31*ρ13 == 0 && 
   ρ11 + a5*ρ33 - I*Ωp*(Πx1 + Φx1)*ρ21 - I*Λx/γ12*ρ12*ρ21 + Conjugate(-I*x*(Πx + Φx))*ρ12 + Conjugate(-I*Λx1)/γ12*ρ21*ρ12 == 0 && 
   (-a5*ρ33 + a1*ρ11) - I*a3*(Πz + Φz)*ρ31 - I*Λz/γ12*ρ13*ρ31 + I*Conjugate(a3*(Πz + Φz))*ρ13 + I*Conjugate(Λz)/γ12*ρ31*ρ13 == 0};

rat(x_) = Rationalize(eqs, 0);

nsol(x_) := 
  NSolve(rat(x), {ρ12, ρ13, ρ31, ρ21, ρ11, ρ22, ρ33, ρ23, ρ32}, 
    WorkingPrecision -> 1000)

tab1 = Table({x -> Input, nsol(Input)}, {Input, 0, 50, 5});

mb = -I*150*ρ21;
y = Abs(x - mb); 

ListLinePlot(
  Table({x /. tab1((i, 1)), y /. tab1((i, 2, 5))}, {i, 1, 20}), 
  Frame -> True, 
  BaseStyle -> {FontFamily -> "Times", FontSize -> 19}, 
  FrameLabel -> {"Input field", "Output field"}, 
  InterpolationOrder -> 3, 
  PlotRange -> {{0, 30}, {0, 30}})

Solving equations – problem of infinite solution with NSolve

I had a problem with NSolve to find the solution to the following coupled equations. I tried FindInstance as I found it here, but no solution can be found. In addition, reducing takes a very long time without a solution.

(CapitalPi)x = -4.848 + 0.24862 *I;(CapitalPi)z = -1.8775 + 0.10476*I;(CapitalPhi)x = -3.09694 + 0.3333* I;(CapitalPhi)z = 0.01623 - 0.0009 *I;(CapitalLambda)x = -1.8185*10^9 + 9.2919*10^7* I;(CapitalLambda)z = -8.5442*10^7 + 4.6752*10^6 *I;(Gamma)12 = 2*10^7;a1 = 2;a2 = 1;a3 = 3;a4 = 1;a5 = 2;a6 = 2;eqs = {-(a1/2 + 1/2)*(Rho)12 - I*a2*(Rho)12 + I*(CapitalLambda)x/(Gamma)12*((Rho)22 - (Rho)11)*(Rho)12 + I*x*((CapitalPi)x + (CapitalPhi)x)*((Rho)22 - (Rho)11) + I*a3*((CapitalPi)z + (CapitalPhi)z)*(Rho)32 + I*(CapitalLambda)z/(Gamma)12*(Rho)13*(Rho)32 == 0 && -(1/2 + a1/2)*(Rho)21 + I*(Rho)21 - I*Conjugate((CapitalLambda)x)/(Gamma)12*((Rho)22 - (Rho)11)*(Rho)21 - I*x*Conjugate(((CapitalPi)x + (CapitalPhi)x))*((Rho)22 - (Rho)11) - I*a3*Conjugate(((CapitalPi)z + (CapitalPhi)z))*(Rho)23 - I*Conjugate((CapitalLambda)z)/(Gamma)12*(Rho)31*(Rho)23 == 0 && -(1/2 + a1/2)*(Rho)13 - I*a4*(Rho)13 + I*(CapitalLambda)z/(Gamma)12*((Rho)33 - (Rho)11)*(Rho)13 + I*a3*((CapitalPi)z + (CapitalPhi)z)*((Rho)33 - (Rho)11) + I*x*((CapitalPi)x + (CapitalPhi)x)*(Rho)23 + I*(CapitalLambda)x/(Gamma)12*(Rho)12*(Rho)23 == 0 && -(1/2 + a1/2)*(Rho)31 + I*a4*(Rho)31 - I*Conjugate((CapitalLambda)z)/(Gamma)12*((Rho)33 - (Rho)11)*(Rho)31 - I*a3*Conjugate(((CapitalPi)z + (CapitalPhi)z))*((Rho)33 - (Rho)11) - I*x*Conjugate(((CapitalPi)x1 + (CapitalPhi)x1))*(Rho)32 - I*Conjugate((CapitalLambda)x1)/(Gamma)12*(Rho)21*(Rho)32 == 0 && -(a5/2)*(Rho)32 - I*a6*(Rho)32 + I*a4*(Rho)32 + I*a3*Conjugate((CapitalPi)z + (CapitalPhi)z)*(Rho)12 + I*Conjugate((CapitalLambda)z)/(Gamma)12*(Rho)13*(Rho)12 - I*x*((CapitalPi)x + (CapitalPhi)x)*(Rho)31 - I*(CapitalLambda)x/(Gamma)12*(Rho)12*(Rho)31 == 0 && -(a5/2)*(Rho)23 + I*a6*(Rho)23 - I*a4*(Rho)23 - I*a3*(Rho)21*((CapitalPi)z + (CapitalPhi)z) - I*(CapitalLambda)z/(Gamma)12*(Rho)31*(Rho)21 + I*x*Conjugate(((CapitalPi)x + (CapitalPhi)x))*(Rho)13 + I*Conjugate((CapitalLambda)x)/(Gamma)12*(Rho)21*(Rho)13 == 0 && -(1 + a1)*(Rho)11 + I*x*((CapitalPi)x + (CapitalPhi)x)*(Rho)21 + I*(CapitalLambda)x/(Gamma)12*(Rho)12*(Rho)21 + I*a3*((CapitalPi)z + (CapitalPhi)z)*(Rho)31 + I*(CapitalLambda)z/(Gamma)12*(Rho)13*(Rho)31 + Conjugate(I*x*((CapitalPi)x + (CapitalPhi)x))*(Rho)12 + Conjugate(I*(CapitalLambda)x)/(Gamma)12*(Rho)21*(Rho)12 + Conjugate(I*a3*((CapitalPi)z + (CapitalPhi)z))*(Rho)13 + Conjugate(I*(CapitalLambda)z)/(Gamma)12*(Rho)31*(Rho)13 == 0 && (Rho)11 + a5*(Rho)33 - I*(CapitalOmega)p*((CapitalPi)x1 + (CapitalPhi)x1)*(Rho)21 - I*(CapitalLambda)x/(Gamma)12*(Rho)12*(Rho)21 + Conjugate(-I*x*((CapitalPi)x + (CapitalPhi)x))*(Rho)12 + Conjugate(-I*(CapitalLambda)x1)/(Gamma)12*(Rho)21*(Rho)12 == 0 && (-a5*(Rho)33 + a1*(Rho)11) - I*a3*((CapitalPi)z + (CapitalPhi)z)*(Rho)31 - I*(CapitalLambda)z/(Gamma)12*(Rho)13*(Rho)31 + I*Conjugate(a3*((CapitalPi)z + (CapitalPhi)z))*(Rho)13 + I*Conjugate((CapitalLambda)z)/(Gamma)12*(Rho)31*(Rho)13 == 0};rat(x_) = Rationalize(eqs, 0);nsol(x_) := NSolve(rat(x), {(Rho)12, (Rho)13, (Rho)31, (Rho)21, (Rho)11, (Rho)22, (Rho)33, (Rho)23, (Rho)32}, WorkingPrecision -> 1000)tab1 = Table({x -> Input, nsol(Input)}, {Input, 0, 50, 5});mb = -I*150*(Rho)21;y = Abs(x - mb); ListLinePlot(Table({x /. tab1((i, 1)), y /. tab1((i, 2, 5))}, {i, 1, 20}), Frame -> True, BaseStyle -> {FontFamily -> "Times", FontSize -> 19},FrameLabel -> {"Input field", "Output field"}, InterpolationOrder -> 3, PlotRange -> {{0, 30}, {0, 30}})

Solving Equations – What Causes NSolve to Reorder Variables?

I have the following code

theta = 120
NSolve(-0.034298780658685656 + y == 
   Tan(theta*Pi/180) (-0.012483735231386907 + 
      x) && -0.028199999999999996 + y == 0 && x > 0 && y > 0, {x, y})

to solve for the intersection of two straight lines. One of the lines has a slope of theta (in degrees). I happened to find it theta = 120 will give the solution {{y -> 0.0282, x -> 0.0160049}}i.e. the variables x and y are exchanged even though I needed it {x,y} in the NSolve, However, almost all other values ​​of theta, 119, 121, … will not cause this. My question is what causes NSolve to think that it has to order y In front x in the solution? How can I make sure that the variables in the solution of NSolve are in the order exactly as I specified them?

Equation Solution – Efficient Way to NSolve for Unknowns in Integrate?

You can search for it.

Select[Table[{t, 
NIntegrate[
 Sqrt[1. - Sqrt[x]]/ArcTan[t + ArcTan[x]], {x, 0, 1}]}, {t, 0, 1, 
0.001}], RealAbs[#[[2]] - Pi^2/6] < 0.01 &]

{{0.112, 1.64927}, {0.113, 1.643}, {0.114, 1.63679}}

so 0.112 ~ 0.114 is where the answer to.

With more search, you can get more valuable answers.