作者xern (care about everyone)
看板Perl
标题Re: [请益] 有办法解方程式吗?
时间Mon Apr 27 02:19:35 2009
※ 引述《subtropical (风大雨大)》之铭言:
: 请问版大
: 现在要处理很多多元一次方程式,看起来都是有解的,但是很难算
: 不知道perl有没有办法用在解方程式呢?
: 举一个正在手算的例子
: 307+208c=14d
: 66.33+28d=104c+2e
: 9.33+4e=14d+f
: 10.67+2f=2e
: 求c,d,e,f
: 如果能用电脑解就好了:)
你可以考虑安装巨大的 PDL module
http://en.wikipedia.org/wiki/Perl_Data_Language
再加上 PDL::Lib::Linear::Solve
http://search.cpan.org/~shlomif/PDL-Lib-Linear-Solve-0.002/
use PDL;
use PDL::Lib::Linear::Solve;
my $coeffs = pdl([[1,1],[0,1]]);
my $values = pdl([[5],[2]]);
my ($new_coeffs, $new_values) = linear_solve($coeffs, $values);
Math::GSL::Linalg 也是可以考虑的模组
http://search.cpan.org/~leto/Math-GSL-0.18/pod/Linalg.pod
这里有 Math::GSL 的 talk
http://leto.net/code/Math-GSL/2008/10/mathgsl-podcast-from-pdxpm.html
Yung-chung Lin
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.112.35.166