det计算矩阵的行列式

简介:
矩阵的行列式, 指正方矩阵的行列式.
计算方法参考 : 
如图 : 
det计算矩阵的行列式 - 德哥@Digoal - PostgreSQL research
 对于简单的2阶和3阶的矩阵,行列式的表达式相对简单,而且恰好是每条主对角线(左上至右下)元素乘积之和减去每条副对角线(右上至左下)元素乘积之和(见图中红线和蓝线)。
2阶矩阵的行列式
det计算矩阵的行列式 - 德哥@Digoal - PostgreSQL research

3阶矩阵的行列式
det计算矩阵的行列式 - 德哥@Digoal - PostgreSQL research

在R中使用det可以迅速的得到矩阵的行列式的值.  
需要注意矩阵必须是正方矩阵.
> x <- matrix(1:12,3,4)
> x
     [,1] [,2] [,3] [,4]
[1,]    1    4    7   10
[2,]    2    5    8   11
[3,]    3    6    9   12
> det(x)
Error in determinant.matrix(x, logarithm = TRUE, ...) : 
  'x' must be a square matrix
> x <- matrix(1:16,4,4)
> det(x)
[1] 0
> x
     [,1] [,2] [,3] [,4]
[1,]    1    5    9   13
[2,]    2    6   10   14
[3,]    3    7   11   15
[4,]    4    8   12   16
> det(t(x))
[1] 4.733165e-30
> t(x)
     [,1] [,2] [,3] [,4]
[1,]    1    2    3    4
[2,]    5    6    7    8
[3,]    9   10   11   12
[4,]   13   14   15   16


[参考]
1.  http://zh.wikipedia.org/wiki/%E8%A1%8C%E5%88%97%E5%BC%8F
2. > help(det)
det                    package:base                    R Documentation

Calculate the Determinant of a Matrix

Description:

     ‘det’ calculates the determinant of a matrix.  ‘determinant’ is a
     generic function that returns separately the modulus of the
     determinant, optionally on the logarithm scale, and the sign of
     the determinant.

Usage:

     det(x, ...)
     determinant(x, logarithm = TRUE, ...)
     
Arguments:

       x: numeric matrix: logical matrices are coerced to numeric.

logarithm: logical; if ‘TRUE’ (default) return the logarithm of the
          modulus of the determinant.

     ...: Optional arguments.  At present none are used.  Previous
          versions of ‘det’ allowed an optional ‘method’ argument.
          This argument will be ignored but will not produce an error.

Details:

     The ‘determinant’ function uses an LU decomposition and the ‘det’
     function is simply a wrapper around a call to ‘determinant’.

     Often, computing the determinant is _not_ what you should be doing
     to solve a given problem.

Value:

     For ‘det’, the determinant of ‘x’.  For ‘determinant’, a list with
     components

 modulus: a numeric value.  The modulus (absolute value) of the
          determinant if ‘logarithm’ is ‘FALSE’; otherwise the
          logarithm of the modulus.

    sign: integer; either +1 or -1 according to whether the determinant
          is positive or negative.

Examples:

     (x <- matrix(1:4, ncol = 2))
     unlist(determinant(x))
     det(x)
     
     det(print(cbind(1, 1:3, c(2,0,1))))

目录
相关文章
|
C++ 索引
Windows10下VS2015下载安装详解【附“安装包丢失或损坏“ 错误解决方法】
Windows10下VS2015下载安装详解【附“安装包丢失或损坏“ 错误解决方法】
10355 0
Windows10下VS2015下载安装详解【附“安装包丢失或损坏“ 错误解决方法】
|
前端开发 API 定位技术
【百度地图API】如何使用suggestion--下拉列表方式的搜索建议
原文:【百度地图API】如何使用suggestion--下拉列表方式的搜索建议 摘要:   百度地图上有一个很强大的搜索建议功能,以下拉列表的方式展示出来。比如,输入“百度”,下拉列表中就会出现“北京市海淀区百度在线网络技术(北京)有限公司”。
2720 0
|
9月前
|
人工智能 编解码 测试技术
云电脑显卡性能终极对决:ToDesk云电脑/顺网云/海马云,谁才是4K游戏之王?
本文对比了ToDesk云电脑、顺网云和海马云三大平台的性能表现,涵盖游戏实战与AI模型测试。ToDesk云电脑搭载RTX 5090显卡,在4K游戏与大模型支持上表现卓越;顺网云适合中轻度游戏玩家,强调即开即用的便捷性;海马云面向企业用户,提供稳定算力与多任务支持。评测从显卡、处理器、压力测试到网络传输技术全面展开,最终推荐:硬核玩家首选ToDesk云电脑,内容创作者可选ToDesk云电脑或海马云,企业用户则更适合海马云。
2124 23
|
人工智能 运维 数据可视化
阿里云百炼 MCP服务使用教程合集
阿里云百炼推出首个全生命周期MCP服务,支持一键部署、无需运维,具备高可用与低成本特点。该服务提供多类型供给、低成本托管及全链路工具兼容,帮助企业快速构建专属智能体。MCP(模型上下文协议)作为标准化开源协议,助力大模型与外部工具高效交互。教程涵盖简单部署、GitHub运营、数据分析可视化及文档自动化等场景,助您快速上手。欢迎加入阿里云百炼生态,共同推动AI技术发展!
7571 61
|
编解码 计算机视觉
YOLOv11改进策略【YOLO和Mamba】| 替换骨干 Mamba-YOLOv11-T !!! 最新的发文热点
YOLOv11改进策略【YOLO和Mamba】| 替换骨干 Mamba-YOLOv11-T !!! 最新的发文热点
1913 7
YOLOv11改进策略【YOLO和Mamba】| 替换骨干 Mamba-YOLOv11-T !!! 最新的发文热点
|
安全 NoSQL 关系型数据库
内网扫描器Fscan
内网扫描器Fscan
|
开发框架 Dart Java
Flutter的核心:Dart语言基础——语法与特性深度解析
【4月更文挑战第26天】Flutter框架背后的Dart语言,以其简洁的语法和独特特性深受开发者喜爱。本文深入解析Dart的语法与特性,如类型推导、动态静态类型系统、统一的类接口、访问权限控制以及并发编程支持。了解并掌握Dart,能助开发者更高效地利用Flutter构建高性能移动应用。
|
人工智能 安全 大数据
新一代信息通信技术
新一代信息通信技术
1505 5
|
人工智能 搜索推荐 Go
一定要知道ChatGPT最新功能:自定义指令 Custom Instructions(上)
一定要知道ChatGPT最新功能:自定义指令 Custom Instructions
【数据结构】二叉搜索树的原理及其实现
【数据结构】二叉搜索树的原理及其实现