ID EN
Miscellaneous

solve

R Base 3.6.2 🇮🇩 Bahasa Indonesia

Fungsi umum ini menyelesaikan persamaan a %*% x = b untuk x, dimana b dapat berupa vektor atau matriks.

Syntax

R
solve(a, b, &#8230;)<p></p><p># S3 method for default
solve(a, b, tol, LINPACK = FALSE, &#8230;)</p>

Arguments

Parameter Deskripsi
a a square numeric or complex matrix containing the coefficients of the linear system. Logical matrices are coerced to numeric.
b a numeric or complex vector or matrix giving the right-hand side(s) of the linear system. If missing, b is taken to be an identity matrix and solve will return the inverse of a.
tol the tolerance for detecting linear dependencies in the columns of a. The default is .Machine$double.eps. Not currently used with complex matrices a.
LINPACK logical. Defunct and ignored.
&#8230; further arguments passed to or from other methods

Details

a atau b bisa jadi rumit, tetapi ini menggunakan aritmatika kompleks ganda yang mungkin tidak tersedia di semua platform. Nama baris dan kolom hasil diambil masing-masing dari nama kolom a dan b. Jika b tidak ada nama kolomnya, hasilnya adalah nama baris a. Tidak dilakukan pemeriksaan apakah nama kolom a dan nama baris b adalah sama. Untuk kompatibilitas kembali, a dapat berupa dekomposisi QR (nyata), meskipun qr.solve harus dipanggil dalam kasus tersebut. qr.solve dapat menangani sistem non-persegi. Hasil yang gagal dari kode LAPACK yang mendasarinya akan menghasilkan kesalahan yang memberikan kode kesalahan positif: ini hanya dapat diinterpretasikan dengan mempelajari kode FORTRAN secara mendetail.

Contoh

Example
R
# NOT RUN {
hilbert <- function(n) { i <- 1:n; 1 / outer(i - 1, i, "+") }
h8 <- hilbert(8); h8
sh8 <- solve(h8)
round(sh8 %*% h8, 3)

A <- hilbert(4)
A[] <- as.complex(A)
## might not be supported on all platforms
try(solve(A))
# }

See Also

solve.qr for the qr method chol2inv for inverting from the Choleski factor backsolve qr.solve.