math - 如何在 Sage 中进行回归分析?

标签 math sage

我试过这个没有成功:

find_fit(data, quadratic_residues)

我试图找到最适合水流量数据的:http://dl.getdropbox.com/u/175564/rate.png

---在评论后编辑---

新代码:
var('x')
model(x) = x**2
find_fit((xlist, reqlist), model)

错误信息:
Traceback (click to the left for traceback)
...
TypeError: data has to be a list of lists, a matrix, or a numpy array

- -编辑

错误消息现在是:
Traceback (click to the left for traceback)
...
ValueError: each row of data needs 2 entries, only 5 entries given

此处与图片相同:
http://dl.getdropbox.com/u/175564/sage.png

最佳答案

mydata = [[1,3],[2,7],[3,13],[4,24]]
var('a,b,c')
mymodel(x) = a*x^2 + b*x + c 
myfit = find_fit(mydata,mymodel,solution_dict=True)
points(mydata,color='purple') + plot(
  mymodel(
    a=myfit[a],
    b=myfit[b],
    c=myfit[c]
    ), 
    (x,0,4,),
    color='red'
  )

关于math - 如何在 Sage 中进行回归分析?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/454606/

相关文章:

java - 如何计算 C++ 或 Java 中的方差、中位数和标准差?

r - R 中的被积函数语法

math - 余数序列

python - 大数的模幂

primes - 如何在 Sage 中获得给定长度的素数?

math - 带奇点的 Sage Math 椭圆曲线

php - 什么是 SQL 支持的数字运算的更好选择 - Ruby 1.9、Python 2、Python 3 或 PHP 5.3?

c - 仅使用 rand() 具有任意概率分布的随机数

testing - 像 Sage(和 MACSYMA,Mathematica)这样的数学系统的单元测试策略

sage - Sage 中的有限元分析