       Re: RowReduce::luc when using NSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg99171] Re: [mg99135] RowReduce::luc when using NSolve
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 29 Apr 2009 06:05:26 -0400 (EDT)
• References: <200904280844.EAA28589@smc.vnet.net>

```mereandor wrote:
> I try to solve a linear equation with the following input to mathematica:
>
> NSolve[{BesselJ[0, 20] - BesselJ[0, 20] r == 3 I BesselJ[0, 60 I] t, BesselJ[0, 20] + BesselJ[0, 20] r == BesselJ[0, 60 I] t}, {r, t}]
>
> but I get
>
> RowReduce::luc: Result for RowReduce of badly conditioned matrix \
> {{-0.167025+0. I,-1.61061*10^9-<<21>> I,0.167025+0. I},{<<1>>}} may \
> contain significant numerical errors. >>
>
> This is only the simplest instance of my problem (2(n+1) equations in equally numbered variables). If I don't write the equations down literally but insert them into NSolve as a Table[] statement I don't even get the warning. Then the equations are solved only partially expressing t[n] as linear combination of r[n].
>
> I use Mathematica 6.0
>
> How can I resolve this?
>
> Thanks in advance for any help!

The input is ill conditioned from the point of view of numeric linear
algebra.

Your coefficient matrix is, up to sign,

coeffmat = {{BesselJ[0,20],3*I*BesselJ[0,60*I]},
{-BesselJ[0,20],BesselJ[0,60*I]}};

At machine precision, the second singular value is sufficiently smaller
than the first as to make condition number effectively infinite.

In:= InputForm[SingularValueList[N[coeffmat]]]
Out//InputForm= {1.863870820026589*^25}

An exact computation (or using smaller tolerance in the machine
arithmetic) confirms this.

In:= InputForm[N[SingularValueList[coeffmat]]]
Out//InputForm=
{1.863870820026589*^25 - 1.697734891411824*^9*I,
0.16702466434058325 - 3.0814879110195774*^-33*I}

This shows the condition number to be around 10^26, far too large to
guarantee any accurate digits at machine precision.

One way around the problem would be to specify higher WorkingPrecision
for NSolve. How high can be a matter of trial and error. Since we
already know the condition number ballpark, we'll just use something
around 3 times that large (this is more than sufficient).

In:= InputForm[NSolve[{BesselJ[0,20] - BesselJ[0,20]*r ==
3*I*BesselJ[0,60*I]*t,
BesselJ[0,20] + BesselJ[0,20]*r == BesselJ[0,60*I]*t},
{r, t}, WorkingPrecision->80]]

Out//InputForm=
{{r ->
-0.7999999999999999999999999999999999999999999999999999999999999999\
99999999999999999999999999595998`79.69897000433602 -

0.60000000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000164508`79.69897000433602*I,
t ->
5.66754261149722224656310043127626802663146216598465500176280137045\
12841969591052271352247`79.69897000433602*^-27 -
1.70026278344916667396893012\
93828804079894386497953965005288404111353852590877315681405674`79.69897000433\
602*^-26*I}}

Daniel Lichtblau
Wolfram Research

```

• Prev by Date: Re: Nested numerical integration
• Next by Date: Re: Inverse function warnings
• Previous by thread: RowReduce::luc when using NSolve
• Next by thread: Re: RowReduce::luc when using NSolve