楼主: xupengswordsman
9951 15

[问答] r语言中一个数值矩阵与一个字符矩阵怎样相乘 [推广有奖]

11
complicated 在职认证  发表于 2014-5-9 09:16:34
huyiustc 发表于 2014-5-9 09:09
是的matlab,mathmatic在符号运算上都比R强太多
这个。。。2*a=2a,是这种东西叫符号运算么???
密码被盗??

12
xupengswordsman 发表于 2014-5-9 09:17:11
huyiustc 发表于 2014-5-9 09:09
是的matlab,mathmatic在符号运算上都比R强太多
毕竟是数学工程类的软件
xupeng

13
qoiqpwqr 发表于 2014-5-9 09:19:00
  1. > install.packages("Ryacas")
  2. > library(Ryacas)
  3. Loading required package: XML
  4. > yacasInstall()
  5. trying URL 'http://ryacas.googlecode.com/files/yacas-1.0.63.zip'
  6. Content type 'application/x-zip' length 746009 bytes (728 Kb)
  7. opened URL
  8. downloaded 728 Kb

  9. >
  10. > a <- Sym("a")
  11. > b <- Sym("b")
  12. > c <- Sym("c")
  13. > d <- Sym("d")
  14. >
  15. > mat1 <- List(List(1, 2), List(0, 1))
  16. > mat1
  17. [1] "Starting Yacas!"
  18. {{1,2},{0,1}};
  19. >
  20. > mat2 <- List(List(a, b), List(c, d))
  21. > mat2
  22. {{a,b},{c,d}};
  23. >
  24. > mat1 * mat2
  25. {{a+2*c,b+2*d},{c,d}};
复制代码
已有 1 人评分学术水平 热心指数 收起 理由
xupengswordsman + 1 + 1 精彩帖子

总评分: 学术水平 + 1  热心指数 + 1   查看全部评分

14
xupengswordsman 发表于 2014-5-9 09:52:52
qoiqpwqr 发表于 2014-5-9 09:19
thank you
xupeng

15
xupengswordsman 发表于 2014-5-24 10:54:20
qoiqpwqr 发表于 2014-5-9 09:19
嗨 哥们 那个矩阵对应元素相乘 Ryacas包应该用什么符号了?我看了它的包的说明,没有找到啊。
xupeng

16
xupengswordsman 发表于 2014-5-24 11:02:20
qoiqpwqr 发表于 2014-5-9 09:19
我的思路是先对矩阵元素取倒数,然后在用除法运算做。符号运算还可以,数字运算就有些不妥了(考虑0的状况)。
xupeng

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-30 21:19