Re: FindRoot / Jacobian
- To: mathgroup at smc.vnet.net
- Subject: [mg84307] Re: FindRoot / Jacobian
- From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
- Date: Tue, 18 Dec 2007 05:34:42 -0500 (EST)
- References: <fk73ub$6el$1@smc.vnet.net>
Here is how you can solve your problem:
solU=(E^((-I)*p-(2*ArcTan[Tan[q/2]/Sqrt[3]])/Sqrt[3])*(1+E^((2*I)*p)))/2
solV=Sin[p]/E^((2*ArcTan[Tan[q/2]/Sqrt[3]])/Sqrt[3])
solutions=Table[FindRoot[solU==N[u]&&solV==N[v],{{p,0},{q,0}}],{u,-\[Pi],\[Pi],(2\[Pi])/70},{v,-\[Pi],\[Pi],(2\[Pi])/70}];
You can do a quick visualisation of the solutions with the following
graphics:
Graphics[{Map[Point,#,{2}],Map[Line,#],Map[Line,Transpose[#]]}&[{p,q}/.solutions//Chop]]
Stephen Luttrell
West Malvern, UK
<sigmundv at gmail.com> wrote in message news:fk73ub$6el$1 at smc.vnet.net...
> Dear readers,
>
> Consider the following expressions:
>
> solU = (E^((-I)*p - (2*ArcTan[Tan[q/2]/Sqrt[3]])/Sqrt[3])*(1 +
> E^((2*I)*p)))/2
>
> solV = Sin[p]/E^((2*ArcTan[Tan[q/2]/Sqrt[3]])/Sqrt[3])
>
> I then want to solve the system of equations (u = solU, v = solV)
> numerically on a grid (u,v) \in (-pi,pi). For that purpose I use
> FindRoot, and execute the following:
>
> u1 = Pi; du = 2*Pi/70;
>
> uvPts1 = Flatten[Table[{u, v}, {u, u1 + du, u2 - du, du}, {v, v1 +
> du,
> v2 - du, dv}], 1];
>
> uvNew = {p, q} /. Table[FindRoot[{solU == uvPts1[[i, 1]], solV ==
> uvPts1[[i, 2]]}, {p,
> -2}, {q, 1+I}], {i, Length[uvPts1]}];
>
> This gives me a p-value and a q-value for each point on the grid, no
> problem. However, I get the wrong solution at some of the grid points.
> Since I get several of the following type of messages, this would be
> expected:
>
> FindRoot::jsing:Encountered a singular Jacobian at the point {p,q} = \
> {-10.4516+0.784848 \[ImaginaryI],108.092+104.013 \[ImaginaryI]}. Try \
> perturbing the initial point(s). >>
>
> Then I would like to know if there is any 'nice' way to handle these
> 'singular Jacobian' errors? Does there exist any kind of 'event
> handler', as in NDSolve?
>
> Kind regards,
> Sigmund Vestergaard
>