英文:
How to do algebraic division with R programming?
问题
I've looked everywhere here and here, but none of the answers match what I want. My question is like this.
what I want. My question is like this.
3xy : 2y
The answer I want is 3x/2
My attempt code is like this:
x <- 2/3
y <- x
cat("mark x:", x, "\n")
cat("mark y:", y, "\n")
Thank you, any answer would be appreciated.
英文:
I've looked everywhere here and here, but none of the answers match what I want. My question is like this.
what I want. My question is like this.
3xy : 2y
The answer I want is 3x/2
My attempt code is like this:
x <- 2/3
y <- x
cat("mark x:", x, "\n")
cat("mark y:", y, "\n")
Thank you, any answer would be appreciated.
答案1
得分: 3
使用 Ryacas,您可以执行以下操作:
library(Ryacas)
yac_str("Simplify(3*x*y/(2*y))")
# "(3*x)/2"
英文:
With Ryacas you can do:
library(Ryacas)
yac_str("Simplify(3*x*y/(2*y))")
# "(3*x)/2"
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论