w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
why can't get the root of equation in R function solve?

That's because the determinant of a is 0. You've got to specify the tolerance in your call :

solve(a,b,tol=1e-20)
[1]  0.1995899 -1.3991798  2.1995899

> a%*%c(0.1995899,-1.3991798,2.1995899)
     [,1]
[1,]    4
[2,]    7
[3,]   10

But, of course, that is one solution among an infinity of it...





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.