Ras*_*sen 6 plot r function wolframalpha
在wolfram-alpha网站上绘制函数看起来像这样:

http://www.wolframalpha.com/link
在R中绘制相同的函数看起来像这样:
情节(函数(x)x ^ 2 - 3*x - 10)

Wolfram的默认图更容易理解.我认为这是因为它显示了x轴(y = 0),并使抛物线居中.
我在数学方面不够好,只要看一下函数的公式,看看我应该把图表集中在哪里,我正在绘制函数来了解不同函数如何创建不同的行,所以我需要这个居中自动完成,因为否则我可能会误解一个情节.
是否有可能自动创建Wolfram图,即我没有告诉R将图中心放在哪里是明智的?
该polynom包将创建一些合理的默认值。
例如。
library(polynom)
# your polynomial (coefficients in ascending powers of x order)
p <- polynomial(c(-10,-3,1))
plot(p)
Run Code Online (Sandbox Code Playgroud)

# a more complicated example, a polynomial crossing the x axis at -1,0,1,2,3,4,5
p2 <- poly.calc(-1:5)
p2
# -120*x + 154*x^2 + 49*x^3 - 140*x^4 + 70*x^5 - 14*x^6 + x^7
plot(p2)
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
6203 次 |
| 最近记录: |