Questions tagged [linear-equation]

An algebraic equation of the form y = mx+b

A linear equation is an algebraic equation in which each term is either a constant or the product of a constant and (the first power of) a single variable. More on Wolfram and Wikipedia.

203 questions
2
votes
1 answer

How to solve equation for many parameters?

I would like to solve an equation for modulus: m=(y2-y1)/(x2-x1) in MATLAB. I have the variables x1,x2,y1,y2 and I can do it for a single case. However, I would like to calculate the m for different sets of x1,x2,y1,y2, i.e. to get modulus of each…
2
votes
1 answer

Using Matplotlib and Numpy, is there a way to find all line intersections for Linear Equations?

I am using the following code to plot the intersection points on a graph, then visually inspecting the intersection points to go back to code and shade the feasibility region. Is there a better way to find the feasible region than simply plotting…
Boerseun
  • 21
  • 3
2
votes
0 answers

Algorithm optimization C++

I'm trying to complete a homework assignment that involves finding out for any three non-negative numbers a,b and c, if c can be reached by adding a and b to one another. Example: if a = 3, b = 5, c = 19 we would do the following 1st step: (3,5) 2nd…
user2980055
  • 179
  • 1
  • 13
2
votes
1 answer

LAPACK inversion routine strangely mixes up all variables

I'm programming in fortran and trying to use the DGETRI matrix inverter from the Lapack package: http://www.netlib.org/lapack/explore-html/df/da4/dgetri_8f.html But very strangely it seems to be messing with all my variables. In this very simple…
Vim154
  • 23
  • 3
2
votes
3 answers

Efficiently solve Ax = b where A is a 4x4 symmetric metrix and b is 4x1 vector

I will solve a small linear system Ax = b where A is a 4-by-4 symmetric matrix stored 16 double numbers (actually 10 of them are enough to represent it), b is 4-by-1 vector. The problem is, I have to run such kind of systems million times. So I am…
C. Wang
  • 2,516
  • 5
  • 29
  • 46
2
votes
1 answer

Number of flops in Gaussian Elimination Matlab code

I am having a hard time trying to understand why this Matlab code to perform Gaussian Elimination without pivoting using LU factorization takes (2/3) * n^3 flops. (FLOPs: floating point operations and not FLOPS: floating point operations per…
2
votes
2 answers

Templated linear equation system solver, C++

I'm searching for a C++ library to solve linear equation systems. The problem is we need to use a special (rational) data type. Is there any templated library for this purpose?
Geom
  • 827
  • 4
  • 15
2
votes
1 answer

Matrix inverse usng linear system solver through cublas, cublasCreate exception or something else

I'm trying to inverse a matrix using linear equation solver through cublas CUDA library. The original equation is in form of: Ax = B = I I - identity matrix A - The matrix I'm trying to inverse x - (hopefully) the inverse(A) matrix I'd like…
TripleS
  • 1,216
  • 1
  • 23
  • 39
1
vote
2 answers

Solving equations in a cell array

I have some linear equations in a cell array like this ( The number of equations vary each time ) : equs = { '2*X1+X2+6', '3*X2-X1' } How can I solve these equation with Matlab? I can get my answer simply by this function : ans = solve(equs(1),…
Sgn.
  • 1,696
  • 2
  • 14
  • 27
1
vote
3 answers

Library for solving system of linear equations with tridiagonal matrix?

I am modelling physical system with heat conduction, and to do numerical calculations I need to solve system of linear equations with tridiagonal matrix. I am using this algorithm to get results:…
1
vote
1 answer

Cannot compute large numbers with great precision in JavaScript

Im working on a cryptography solution which would implement Shamirs Secret Sharing, here I am generating a secret key based on the password provided by the user. These password when converted to number yield very large numbers and I would like to…
1
vote
3 answers

R: Automate solving many systems of equations in data frame

I'm working on a dataset that will solve simple equation systems of 2 equations with 2 unknowns. However, as there are hundreds of such systems, I will need to find some algorithm, perhaps a loop, that will perform the task for n rows in a data…
KjetilH
  • 47
  • 4
1
vote
0 answers

symmetric matrix vector multiplication combined modules

Written two modules: conjugate gradient method band matrix-vector multiplication they work separately (with machine error difference due to addition nonassociativity being around 1e-14 to 1e-15) But when combined I cant track the reason for the…
1
vote
2 answers

Solving System of linear equation using Cramer's method in Python

I am trying to solve the following system of linear equations: 10x1+ 40x2+ 70x3= 300 20x1+ 50x2+ 80x3= 360 30x1+ 60x2+ 80x3= 390 by using Cramer's method implementing a function by scratch: def cramer(mat, constant): # takes the matrix and the…
1
vote
1 answer

Is there any ojAlgo solver for when the condition number is large and the matrix is symmetric and indefinite?

I use ojAlgo to solve a system of linear equations. In one case I get a RecoverableCondition exception. Probably because matrix is ill-conditioned, the condition number is about 1e15. I use ojAlgo to solve it as seen in the code below. It usually…
Magnus
  • 35
  • 5