Questions tagged [equation-solving]

763 questions
38
votes
4 answers

Solving simultaneous equations with R

Suppose I have the following equations: x + 2y + 3z = 20 2x + 5y + 9z = 100 5x + 7y + 8z = 200 How do I solve these equations for x, y and z? I would like to solve these equations, if possible, using R or any other computer tools.
mlzboy
  • 14,343
  • 23
  • 76
  • 97
33
votes
7 answers

SymPy - Arbitrary number of Symbols

I am coding a function that solves an arbitrary number of simultaneous equations. The number of equations is set by one of the parameters of the function and each equation is built from a number of symbols - as many symbols as there are equations.…
thornate
  • 4,902
  • 9
  • 39
  • 43
22
votes
1 answer

How to implement MATLAB's mldivide (a.k.a. the backslash operator "\")

I'm currently trying to develop a small matrix-oriented math library (I'm using Eigen 3 for matrix data structures and operations) and I wanted to implement some handy MATLAB functions, such as the widely used backslash operator (which is equivalent…
maddouri
  • 3,737
  • 5
  • 29
  • 51
14
votes
2 answers

Equation Threading: Why the default behavior?

I recently rediscovered a small package by Roman Maeder that tells Mathematica to automatically thread arithmetic and similar functions over expressions such as x == y. Link to Maeder's package. First, to demonstrate, here's an example given by…
telefunkenvf14
  • 1,011
  • 7
  • 19
11
votes
2 answers

Solve system of two equations with two unknowns

Solve the system of two equations with two unknowns below: a1, b1, c1, a2, b2 and c2 are inputted by the user himself. I've been trying to find a math solution for the problem first and I can't seem to go far.. What I've tried so far is : From…
user2925251
  • 117
  • 1
  • 1
  • 6
10
votes
5 answers

How to solve a math equation in a programming language?

I need help to solve this formula ((n * 2) + 10) / (n + 1) = 3, preferably in PHP. (The numbers 2, 10 and 3 should be variables that can be changed.) I'm able to solve this equation on paper quite easily. However, when I try to implement this in…
xidew
  • 411
  • 1
  • 5
  • 12
10
votes
8 answers

What good libraries are there for solving a system of non-linear equations in C++?

In a C++ application I'm coding, I need to solve a system of non-linear equations (N equations, N unknowns). The systems I'm solving will be rather small (up to 10 equations/unknowns), so performance is not going to be a real issue. I've searched…
hoffer
  • 649
  • 2
  • 7
  • 11
10
votes
1 answer

Algorithm - solving linear equation in one variable

Given an expression in the form of a string, solve for x. The highest power of x in the expression will be equal to 1. Operators allowed are +, * and -. These are all binary operators. So, 2x would be written as 2*x. Every operator will be followed…
9
votes
6 answers

Pythonic way to manage arbitrary amount of variables, used for equation solving.

This is a bit difficult to explain without a direct example. So let's put the very simplistic ideal-gas law as example. For an ideal gas under normal circumstances the following equation holds: PV = RT This means that if we know 3 of the 4…
paul23
  • 8,799
  • 12
  • 66
  • 149
8
votes
2 answers

solving an exponential equation in Raku

I'm trying to solve this exponential equation like this: my ($l,$r); for (1 .. 100) -> $x { $l = $x * e ** $x; $r = 5 * (e ** $x - 1); say $x if $l == $r; } But it doesn't work. How to solve it in a straightforward and…
Lars Malmsteen
  • 738
  • 4
  • 23
8
votes
3 answers

Equation of curve generated by QuadCurve2D in Java?

I have drawn a quadratic curve using the QuadCurve2d in java using start, end and one control points. Is there a way I can find out the equation of this curve? The reason why I need is that at some point of this curve it might intersect a circle and…
Shehroz
  • 81
  • 2
8
votes
3 answers

Solving system using linalg with constraints

I want to solve some system in the form of matrices using linalg, but the resulting solutions should sum up to 1. For example, suppose there are 3 unknowns, x, y, z. After solving the system their values should sum up to 1, like .3, .5, .2. Can…
Dania
  • 1,648
  • 4
  • 31
  • 57
8
votes
2 answers

A few questions about checking whether a set in C++ is an algebraic group

I've started making a library for doing things with abstract algebra. Right now I'm trying to make a function that checks whether a set is a group. It should be self-explanatory: In mathematics, a group is a set of elements together with an…
7
votes
3 answers

Is there a built-in Mathematica function to find operators rather than numbers in equations?

How can the following be best accomplished in Mathematica? In[1] := Solve[f[2,3]==5,f ∈ {Plus,Minus,Divide}] Out[1] := Plus
Cetin Sert
  • 4,497
  • 5
  • 38
  • 76
7
votes
3 answers

resolve a system of linked equations with different modulo

Is there any algorithm to solve a system of equations expressed in different modulo spaces? For exemple, consider this system of equations: (x1 + x2 ) % 2 = 0 ( x2 + x3) % 2 = 0 (x1 + x2 + x3) % 3 = 2 One of the solutions of this system…
1
2 3
50 51