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.

173 questions
0
votes
2 answers

Validating linear equations with regular expressions?

How can I validate linear equations with regular expressions or is there another way besides using regular expressions. I will use ^ to denote an exponent. 2x + 3 = 8 //This should validate fine 3x + 2y + 4z = 12 //This should validate fine 4x^2 +…
Xaisoft
  • 42,877
  • 83
  • 270
  • 415
0
votes
4 answers

Simple linear equation with binary search?

Is there a way to solve a simple linear equation like -x+3 = x+5 Using binary search? or any other numerical method? BACKGROUND: My question comes because I want to solve equations like "2x+5-(3x+2)=x+5" Possible operators are: *, -, + and…
capsula
  • 490
  • 1
  • 7
  • 21
-1
votes
0 answers

How do you get numpy to matrix equations by taking them from my directory because they are too big to fit in memory?

How do you get numpy to solve matrix equations by taking them one by one from my directory because they are too big to fit in memory? Any help is appreciated, thank you.
Emmanuel
  • 77
  • 1
  • 5
-1
votes
2 answers

Solve a linear equation which has 16 variables

I'm trying to solve a 16 variable linear equation. I tried in Matlab but it says that the solution could not be found. Is there an efficient way to solve the equations. The equations are a = a^2+e^2+i^2+m^2, b = a*b+e*f+I*j+m*n, c =…
-1
votes
2 answers

Regex Expression to extract coefficent of linear eq "2x-3y+0.5"

I want to convert my eq to vector form so i need to extract the coefficient r"[-+]?\d*\.\d+|\d+" I tried this but I am not able to get the "-" sign along with the integer. For 2x-3y+0 i am getting [2, 3, 0] but I need [2, -3, 0].
-1
votes
1 answer

Solving n linear systems efficiently

I have n (very large) independent linear systems (Ax = b_i). They all have the same A, but b_i is different for (i = 1, ..., n). I want to solve these n systems in parallel in CUDA. I was thinking that it might be most efficient to do the LU…
-1
votes
3 answers

Solving linear system with inequality constraints in Python or Matlab

I want to solve a linear system which is quite complicated, I take the following equations for an example: (1) x + y = 0; (2) x * y = -4; (3) x > 0; If only (1) and (2), there are two sets of solutions. So I add (3) to remove the ambiguity.…
-1
votes
1 answer

Read coefficients of linear equations from file into 2d array in c

I'm working on a program that reads linear equations from a file such as those - and solve them using matrices - : 3x+2y-2z=9 -2x+9y+12z=23 4x-7y+9z=45 The file is supposed to contain n equations with n variables , how to get only the numbers and…
Islams
  • 37
  • 2
  • 11
-1
votes
1 answer

Printing out: no solution, multiple solution with Apache in java

I have this code which give solution to 4x4 linear equations. how can i print out when a linear equation have no solution or have multiples ones. instead of prints error ? public class OvaWork { void fourthEquationSolver() { …
Volazh
  • 128
  • 2
  • 11
-1
votes
1 answer

Findig a solution for a linear equation system which has more variable then equtions

Let's divide the problem to 2 parts, the second one is optional. Part 1 I have 3 linear equtions with N variables where N usually bigger then 3. x1*a+x2*b+x3*c+x4*d[....]xN*p = B1 y1*a+y2*b+y3*c+y4*d[....]yN*p = B2 z1*a+z2*b+z3*c+z4*d[....]zN*p =…
GaborK
  • 1
-1
votes
1 answer

How do I use a point class, rational number class, and line class to Solve a system of 2 linear equations?

I am fairly new to computer science and have been trying, unsuccessfully, to use a point class, a line class, and a Rational number class in order to solve a System of linear equations. The code for the System is old and I'm adapting it to work for…
hell2the0
  • 1
  • 1
-1
votes
1 answer

Cholesky Factorization in C?

I am implementing the Cholesky Method in C but the program quits when it arrives at this point. After the answers : Now it works thanks to the answers of (devnull & piotruś) but it doens't give me the right answer /* Ax=b *This algorithm does: * …
-1
votes
1 answer

Matlab: how to display answers of underdetermined linear system as {a = r1, b = r1/2, c = r1}

I have a 3x3 matrix, for example A=[3,2,4;2,0,2;4,2,3], and I'm trying to solve the following linear system in the form A*[a;b;c] = [8*a;8*b;8*c]: 3 2 4 a 8a 2 0 2 * b = 8b 4 2 3 c 8c Ok, so I have: 3a + 2b + 4c = 8a 2a + 2c = 8b 4a +…
-1
votes
2 answers

Solving a system of 2 Linear Equations using c++

Hello I'm having trouble writing a solution code for my homework. I am required to ask the user to input 6 variable for two equations. After successfully pulling numbers only, I need to find the slope of each line, the y-intercept for each line, two…
-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
  • 55
  • 6
1 2 3
11
12