1
$\begingroup$
R = {{-639880.9531714534` + 
     79.19371296239888` c^2, -453339.5840789839` + 
     55.56821108386519` c^2, 0, 0, 
    160.0595864532318`}, {-453339.5840789839` + 
     55.56821108386519` c^2, -4.986933805092816`*^6 + 
     74.24759881256949` c^2, 0, 0, -0.00447586740976628`}, {0, 
    0, -639877.8131714534` + 
     79.19371296239888` c^2, -453339.5840789839` + 
     55.56821108386519` c^2, 160.0595864532318`}, {0, 
    0, -453339.5840789839` + 
     55.56821108386519` c^2, -4.986933805092816`*^6 + 
     74.24759881256949` c^2, -0.00447586740976628`}, \
{160.0595864532318`, -0.00447586740976628`, 
    160.0595864532318`, -0.00447586740976628`, -520.8333333333335`}};
MatrixRank[R]
P = FullSimplify[Det[R]]
s1 = NSolve[P == 0 && 0 < c < 10000]
s2 = Flatten[c /. s1]
NN = Flatten[NullSpace[R /. c -> s2[[1]]]];

I have a matrix R which is having a dependency on c. I took the Det[R] and found the Roots of the determinant function. I substituted the back to find the unknown coefficients. Essentially I am talking about Ax=0, But could not able to find the `x`

$\endgroup$
  • $\begingroup$ There is noise in that code. Please provide a minimal working example. What is s3? Why do you define fn? $\endgroup$ – Hector Jul 30 '18 at 10:21
  • 1
    $\begingroup$ NullSpace[R] gives an empty list. Why do you say you can't find the NullSpace ? $\endgroup$ – Lotus Jul 30 '18 at 10:25
  • $\begingroup$ Can Nullspace be nonempty, Even we can able to find the Root of a determinant function? $\endgroup$ – acoustics Jul 30 '18 at 10:27
  • $\begingroup$ Computing the determinant to check wether a matrix is invertible is (i) highly inefficient and (ii) extremely inaccurate as a lot of numerical error can be accumulated. $\endgroup$ – Henrik Schumacher Jul 30 '18 at 11:53
3
$\begingroup$

It is a problem of not having enough digits in the default machine precision. After running your original code, try

P /. s1
(*not zeroes*)

The fact that, after replacing the solution into the equation, one does not get something close to zero is the hint.

One way to force Mathematica to use more digits is as follows:

newR = ReplaceAll[R, x_?NumericQ :> Rationalize[x, 1/100000000000000]];
newS = NSolve[Det[newR] == 0 && 0 < c < 10000, WorkingPrecision -> 60];
Flatten[NullSpace[newR /. newS[[1]]]]
(*1D nullspace*)
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Thanks, I Implemented your suggestion and its working now. $\endgroup$ – acoustics Jul 30 '18 at 15:36
3
$\begingroup$

The presence of machine numbers and use of Det means there will be some amount of numerical error which in turn means one cannot necessarily get away with the default Tolerance for NullSpace. Dropping it somewhat does give a nontrivial null space generator.

NullSpace[R /. c -> s2[[1]], Tolerance -> 10^(-10)]

(* Out[62]= {{0.638092335503, -0.000643559092341, 
  0.658783883462, -0.000664427898733, 0.398548755651}} *)

This is not terribly good though (and I am not sure why). Instead I will recommend using the singular values decomposition. The

{uu, ww, vv} = SingularValueDecomposition[R /. c -> s2[[2]]];
nullvec = Last[Transpose[vv]]

(* Out[84]= {0.718279572307, -0.000713124517697, -0.695719341907, \
0.000690726186956, 0.00693308400591} *)

Check:

(R /. c -> s2[[2]]).Last[Transpose[vv]]

(* Out[85]= {-4.82763022225*10^-7, 6.63228964986*10^-10, 
 4.6759873662*10^-7, -4.65453959914*10^-10, -4.65985650067*10^-9} *)
|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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