1
$\begingroup$

I have the code:

G = 0.1;
β = 0.5;
ωc = 10;

integralgamma[ω_, τ_] := 
 4 G ω Exp[-ω/ωc] ((1 - 
   Cos[ω τ])/ω^(2)) Coth[β ω/2];

mem : γ[τ_] := 
mem = NIntegrate[
 integralgamma[ω, τ], {ω, 0, Infinity}, 
  MaxRecursion -> 15, PrecisionGoal -> 2, Method -> "LocalAdaptive"]

  Table[NSolve[{Sin[χ]*Cos[α] == 
   1/Sqrt[3] *Exp[-γ[τ]] && 
    Sin[χ]*Sin[α] == 1/Sqrt[3]*Exp[-γ[τ]] && 
     Cos[χ] == 1/Sqrt[3], 
      0 <= χ <= π && 
       0 <= α <= 2 π}, {χ, α}], {τ, 0, 2, 
        0.1}]

But I get the errors:

NSolve::ratnz: NSolve was unable to solve the system with inexact coefficients. The answer was obtained by solving a corresponding exact system and numericizing the result.

{{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, \ {}, {}, {}, {}}

When I remove the time dependent exponential factor, I am able to solve the equation. What's going on?


Edit:

Another try:

I first table the expression for the time-dependent exponential factor:

FunctionList[χ_, α_] = 
 Table[Sin[χ]*Cos[α] == 
  1/Sqrt[3] *Exp[-γ[τ]] && 
   Sin[χ]*Sin[α] == 1/Sqrt[3]*Exp[-γ[τ]] && 
    Cos[χ] == 1/Sqrt[3], {τ, 0, 2, 0.1}];

It works; I get a list with 21 elements.

When run:

NSolve[{#, 
 0 <= χ <= π && 
  0 <= α <= 2 π}, {χ, α}] & /@ 
   FunctionList[χ, α],

I get the same errors. Suggestions?

$\endgroup$
9
  • 1
    $\begingroup$ You are giving NSolve a system of 3 equations in 2 variables (treating tau as a parameter). Are you sure that these equations even have a solution? If your system is over determined, it makes sense that NSolve cannot find solutions. $\endgroup$ Commented Nov 7, 2016 at 16:24
  • 1
    $\begingroup$ Possibly the problem is that the equations are overdetermined. They are consistent, up to numeric fuzz, but it is possible that the methods being used do not manage to catch that in the presence of approximate machine floats. $\endgroup$ Commented Nov 7, 2016 at 16:24
  • $\begingroup$ @SjoerdSmit This command, for instance, works: NSolve[{Sin[\[Chi]]*Cos[\[Alpha]] == 1/Sqrt[3] && Sin[\[Chi]]*Sin[\[Alpha]] == 1/Sqrt[3] && Cos[\[Chi]] == 1/Sqrt[3], 0 <= \[Chi] <= Pi && 0 <= \[Alpha] <= 2 Pi}, {\[Chi], \[Alpha]}] $\endgroup$ Commented Nov 7, 2016 at 16:28
  • $\begingroup$ Try any values on the right hand sides of the three equations in so far as the sum of their squares is one. This is just me trying to solve for the polar and azimuthual angles for points specified on a unit sphere in spherical coordinates. $\endgroup$ Commented Nov 7, 2016 at 16:29
  • $\begingroup$ If the aforementioned command works, shouldn't it work for the case I'm trying to solve: tacking on time dependent exponential factors, which effectively means I am trying to solve more than one equation. $\endgroup$ Commented Nov 7, 2016 at 16:30

1 Answer 1

1
$\begingroup$

If you are looking for the spherical coordinates given the rectangular coordinates, can't you just use:

Table[
    ToSphericalCoordinates[{1/Sqrt[3]*Exp[-γ[τ]],1/Sqrt[3]*Exp[-γ[τ]],1./Sqrt[3]}],
    {τ,0,2,0.1}
]

?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.