Questions tagged [equation-solving]
763 questions
7
votes
1 answer
Modular equations in Haskell
I want to solve linear and quadratic modular equations in Haskell in one variable. The way I am doing it right now is by putting x = [1..] in the equation one by one and finding the remainder (expr `rem` p == 0, if the equation is modulo p (not…

Iguana
- 247
- 1
- 8
7
votes
1 answer
Integral solution to equation `a + bx = c + dy`
In the equation a + bx = c + dy, all variables are integers. a, b, c, and d are known. How do I find integral solutions for x and y? If I'm thinking right, there will be an infinite number of solutions, separated by the lowest common multiple of b…

Joel
- 2,654
- 6
- 31
- 46
7
votes
4 answers
How to exactly solve quadratic equations with large integer coefficients (over integers)?
I read a problem about bullseyes in Google Code Jam. (The contest is over now, so it's okay to talk about it)
Maria starts with t millilitres of black paint, which she will use to draw rings of thickness 1cm (one centimetre). A ring of thickness…

Colonel Panic
- 132,665
- 89
- 401
- 465
7
votes
1 answer
Solving a system of equations in Prolog
Assume I have a number X and I wish to solve system of equations, say Y+Z=X, Z*Y = 1.
Now, this has solutions Y=1/Z and Z = (sqrt(X*X-4)+X)/2 or (X-(sqrt(X*X-4)))/2.
So I can write in Prolog:
solve(X,Y,Z):- Y is (sqrt(X*X-4)+X)/2, Z is…

Valtteri
- 463
- 1
- 5
- 11
7
votes
6 answers
Fast solution of dense linear system of fixed dimension (N=9), symmetric, positive-semidefinite
Which algorithm you would recommend for fast solution of dense linear system of fixed dimension (N=9) (matrix is symmetric, positive-semidefinite)?
Gaussian elimination
LU decomposition
Cholesky decomposition
etc?
Types are 32 and 64 bits floating…

qble
- 1,256
- 2
- 12
- 29
6
votes
4 answers
How to manipulate mathematical symbols?
This is more of an "educational" question. :)
Although, I probably would like to do something like this eventually.
So, let's say I got an equation. Could be any kind of equation, as long as it's not ridiculous and also a human who was good at math,…
user213265
6
votes
2 answers
Escaping local minimum with tensorflow
I am solving this system of equations with tensorflow:
f1 = y - x*x = 0
f2 = x - (y - 2)*(y - 2) + 1.1 = 0
If I choose bad starting point (x,y)=(-1.3,2), then I get into local minima optimising f1^2+f2^2 with this code:
f1 = y - x*x
f2 = x - (y -…

Stepan Yakovenko
- 8,670
- 28
- 113
- 206
6
votes
2 answers
Solving a system of nonlinear equations in R
Suppose I have the following system of equations:
a * b = 5
sqrt(a * b^2) = 10
How can I solve these equations for a and b in R ?
I guess this problem can be stated as an optimisation problem, with the following function... ?
fn <- function(a, b)…

Ladislas Nalborczyk
- 725
- 2
- 5
- 20
6
votes
1 answer
sympy Version 1.1.1: 'solve()' containing 'summation()'
How would I solve an equation containing a summation expression, i.e.
something like.
I would consider the following code fragment to solve this equation:
from sympy import *
i, N, x = symbols("n, N, x")
y = Function("y")
eq =…

Frank-Rene Schäfer
- 3,182
- 27
- 51
6
votes
2 answers
How do I solve a non-linear equation in Sympy?
How do I solve a non-linear equation in SymPy which is of the form
y = P*x + Q + sqrt(S*x + T)
where I know y(0), y'(0), y(c), y'(c). I want to find P, Q, S and T. and represent y as a function of x.
I am getting very confused with the…

Manish
- 458
- 6
- 19
6
votes
1 answer
How to solve absolute value equations using sympy?
Given the equation |x - 5| + |y| = 5, how can one solve it using SymPy?
If I'm using a combination of solve() and Abs() it gives me this error
solving Abs(x - 5) when the argument is not real or imaginary
But, at the beginning of my session I…

Accelerate to the Infinity
- 357
- 1
- 3
- 12
6
votes
3 answers
Is it possible to solve an algebraic equation in R?
I want to find the solution of:
-x^3+6*x^2+51*x+44=0
but with R. Is it possible?
I found the package Ryacas, but nobody seems to be able to make it work.
May sound trivial, but I'm not able to find an easy way to do this...
Do you have an…

M. Beausoleil
- 3,141
- 6
- 29
- 61
6
votes
2 answers
SymPy cannot solve polynomial equation of 4th order
I have an polynomial equation of 4th order and I need to find all roots.
Simple example:
from sympy import (Symbol,solve,I)
a=4+5*I; b=3+7*I; c=12-56*I; d=33+56*I; e=345-67*I; x=Symbol('x')
eq=a*x**4 + b*x**3 + c*x**2 + d*x +e
solve(eq,x)
If…

K4stan
- 61
- 4
6
votes
3 answers
Solving a modular equation (Python)
I have what seems to be an easy problem to solve in Python, but as I am new to python I am unaware on how to solve this.
All I am trying to solve is...
(x * e) mod k = 1 (where e and k are known values)
Is there any simple way of doing this?

Scalahansolo
- 2,615
- 6
- 26
- 43
5
votes
2 answers
Mathematica: FindRoot errors
FindRoot[
27215. - 7.27596*10^-12 x + 52300. x^2 - 9977.4 Log[1. - 1. x] == 0
,
{x, 0.000001}
]
converges to the solution {x -> -0.0918521} but how can I get Mathematica to avoid the following error message before the solution:
FindRoot::nlnum:…

CaptanFunkyFresh
- 159
- 1
- 3
- 8