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
3
votes
3 answers

A function for calculating the eigenvalues of a matrix in R

I want to write a function like eigen() to calculating eigenvalues and eigenvectors of an arbitary matrix. I wrote the following codes for calculation of eigenvalues and I need a function or method to solve the resulted linear equation. eig <-…
Mahmoud
  • 844
  • 1
  • 10
  • 17
3
votes
4 answers

PHP algorithm to solve a system of linear equations of grade 1

I have a system of equations of grade 1 to resolve in PHP. There are more equations than variables but there aren't less equations than variables. The system would look like bellow. n equations, m variables, variables are x[i] where 'i' takes values…
Daniel Ifrim
  • 277
  • 3
  • 12
2
votes
0 answers

System of linear equations Thomas algorithm Java

I have adapted the Thomas Algorithm for solving the tridiagonal matrix problem i.e. finding the value of the vector T in the equation AT = b where A and b are known. Below I have provided the code and the vectors I am inputting. The input is (should…
2
votes
1 answer

How do I tell if a solution to a set of equations is valid in Math.NET Numerics?

Trying to solve a system of linear equations using Math.NET Numerics but wont know in advance whether they will have a valid solution. For example, the equations x + y = 10, x = 3, y = 7, have an obvious solution. In Math.NET, we programmed this as…
seants
  • 21
  • 1
2
votes
1 answer

Solving Linear Equation Using NumPy

I am trying to solve linear equations 3x+6y+7z = 10, 2x+y+8y = 11 & x+3y+7z = 22 using Python and NumPy library. import numpy as np a = np.array([[3, 6, 7], [2, 1, 8], [1, 3, 7]]) b = np.array([[10, 11,…
Yuehan
  • 41
  • 9
2
votes
0 answers

Solving large system of linear equations using MATLAB

I am using MatLab to solve a system of linear regressions: Ax=b. But my matrix A is really big. Its shape is (4098,3628800). I used A\b to solve this problem. It takes about 1 hour to do. I was wondering if there are more efficient ways to do this…
KevinKim
  • 1,382
  • 3
  • 18
  • 34
2
votes
1 answer

Python: Is there a way to plot standard equations of lines of the form ax + by + c = 0

I need to plot two straight lines on a single graph. The equations are of the form ax +by + c=0, where: x = x-coordinate y = y-coordinate a, b, c are coefficients Thanks!
Hafeez
  • 95
  • 8
2
votes
2 answers

Solution basis of underdetermined equation set in python

I have an underdetermined equation set (m equations of n variables, m smaller than n). As such, if it is solvable then the set of solutions are a linear space (if it is a homogenic set) or affine space (non-homogenic). Is there an easy way in Python…
R S
  • 11,359
  • 10
  • 43
  • 50
2
votes
1 answer

Finding line intersect using Cramer's rule - Getting incorrect y coordinate

I'm looking to find the intersect of 2 lines using Cramer's rule. This is for an exercise from the book An Introduction To Java Programming (Exercise 3.25 from Chapter 3 and 8.31 from Chapter 8. They are both basically the same idea just the one…
Sruly
  • 169
  • 1
  • 13
2
votes
2 answers

How to solve AX = B equation with Python (NumPy, SciPy etc.), where A, X, B are matrices and all elements of X must be non-negative

I need to solve an equation AX = B using Python where A, X, B are matrices and all values of X must be non-negative. The best solution I've found is X = np.linalg.lstsq(A, B, rcond=None) but as a result X contains negative values. Is it possible to…
2
votes
3 answers

Is there a way to generate random solutions to non-square linear equations, preferably in python?

First of all, I know that these threads exist! So bear with me, my question is not fully answered by them. As an example assume we are in a 4-dimensional vector space, i.e R^4. We are looking at the two linear equations: 3*x1 - 2* x2 + 7*x3 - 2*x4 =…
2
votes
1 answer

Which data structure is good for equation solving

I planned to develop an equation solver from basic and able to do basic mathematics operations using below code. I have used a token stack structure which will used to store the deliminator and number token. Though this implementation is too basic,…
Amutheezan
  • 345
  • 1
  • 8
  • 24
2
votes
0 answers

Using Eigen LeastSquaresConjugateGradient in Parallel

I am trying to solve a linear system of equations of the form Ax=b with the LeastSquaresConjugateGradient of the Eigen library and A is a sparse matrix. LeastSquaresConjugateGradient < SparseMatrix < double > > solver; solver.compute( A ); x =…
zodiac
  • 291
  • 2
  • 15
2
votes
1 answer

Solve homogenous system Ax = 0 for any m * n matrix A in R (find null space basis for A)

How to solve a homogenous system Ax = 0, when A is any m * n matrix (not necessarily a square one) in R? # A=[-0.1 0.1]= 1x2 matrix; x=2x1 to be found; 0: 1x1 zero matrix A <- t(matrix(c(-0.1,0.1))) This question seems to be equivalent of finding…
Erdogan CEVHER
  • 1,788
  • 1
  • 21
  • 40
2
votes
1 answer

How do I solve a system of linear equations using SageMath?

I have system of linear equations, however I DO NOT want the answer to be a number - I want it in terms of the parameters. ax+by= m cx+dy= n I don't have the values for any of the constants, so I for the above equation, I'd just want the answer x =…
calanthe
  • 21
  • 1
  • 3
1 2
3
13 14