求解线性方程 [英] Solving a linear equation

查看:115
本文介绍了求解线性方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要以编程方式求解C,Objective C或(如果需要)C ++中的线性方程组.

I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.

这是等式的一个示例:

-44.3940 = a * 50.0 + b * 37.0 + tx
-45.3049 = a * 43.0 + b * 39.0 + tx
-44.9594 = a * 52.0 + b * 41.0 + tx

因此,我想获得abtx的最佳近似值.

From this, I'd like to get the best approximation for a, b, and tx.

推荐答案

克莱默规则高斯消除 是两种很好的通用算法(另请参见同时线性方程式).如果您正在寻找代码,请查看 GiNaC SymbolicC ++ (当然,这取决于您的许可要求).

Cramer's Rule and Gaussian Elimination are two good, general-purpose algorithms (also see Simultaneous Linear Equations). If you're looking for code, check out GiNaC, Maxima, and SymbolicC++ (depending on your licensing requirements, of course).

我知道您在C地带工作,但我也必须为

I know you're working in C land, but I also have to put in a good word for SymPy (a computer algebra system in Python). You can learn a lot from its algorithms (if you can read a bit of python). Also, it's under the new BSD license, while most of the free math packages are GPL.

这篇关于求解线性方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆