Questions tagged [equation-solving]
763 questions
3
votes
1 answer
Find the maximum integer such that this algebraic constraint is satisfied in Mathematica
For example, I have an expression as a (arbitrary) function of integer n
f[n_]:=10^n*(n^2+4*n)
I want to find the maximum integer n such that f[n]<=m for another number m.
I could formulate this as an integer programming/optimization problem. But…

Qiang Li
- 10,593
- 21
- 77
- 148
3
votes
1 answer
How to solve an overdetermined non linear set of equations numerically in python?
I am trying to solve a system of 4 exponential equations with two variables. However If I use fsolve python will only allow me two use as many equations as I have variables. But as I have infinitely many pairs of solutions (if only two equations are…
user21056350
3
votes
1 answer
How do I solve inequalities with Sympy?
Objective: I want to implement a Fourier-Motzkin Elimination using Sympy. The first step for this would be to solve a number of inequalities.
Problem: The tools for solving inequalities with Sympy like solveset, solve_poly_inequality or…

R.Deilke
- 65
- 8
3
votes
2 answers
r How do I rescale a range of numbers with these constraints?
I need to rescale a series of numbers with certain constraints.
Let's say I have a vector like this:
x <- c(0.5, 0.3, 0.6, 0.4, 0.9, 0.1, 0.2, 0.3, 0.6)
The sum of x must be 6. Right now the sum of x = 3.9.
The numbers cannot be lower than 0
The…

Rene
- 363
- 2
- 7
3
votes
1 answer
Maxima: eliminate variables from equations
Given N equations in K variables,
can Maxima produce N-J equations in K-J variables?
SOLVE and ELIMINATE seem unable, about to reach for pen and paper.

Devon
- 1,019
- 9
- 20
3
votes
2 answers
Solving equation. Counting (x,y)
I'm having a trouble with my math:
Assume that we have a function: F(x,y) = P; And my question is: what would be the most efficient way of counting up suitable (x,y) plots for this function ? It means that I don't need the coordinates themself, but…

Dmitri
- 2,451
- 6
- 35
- 55
3
votes
1 answer
SymPy: solving overdetermined system of linear equations
I know that SymPy is able to solve overdetermined systems of linear equations, but I'm running into the following problem:
Let's start with something that works:
from sympy import *
x, y, z = symbols('x y z')
matrix = Matrix([
[1, 0, 0,…

jonas87
- 672
- 2
- 8
- 22
3
votes
1 answer
Solving multivariate equation for a subset of variables
I am using sympy to solve some equations and I am running into a problem. I have this issue with many equations but I will illustrate with an example. I have an equation with multiple variables and I want to solve this equation in terms of all…
user2882307
3
votes
1 answer
Equation solver in Python
Given a simple equation such as:
x = y + z
You can get the third variable if you bind the other two (ie: y = x - z and z = x - y). A straightforward way to put this in code:
def solve(args):
if 'x' not in args:
return args['y'] +…

Aillyn
- 23,354
- 24
- 59
- 84
3
votes
2 answers
how to solve trigonometric equations on python
I am trying to solve 3 of trigonometric equations in python. I used Sympy library but I got a error such as 'TypeError: can't convert expression to float'
Here is My Python Source code:
from sympy import Symbol, solve, Eq
from math import*
# Robot…

Suyoung Park
- 31
- 1
- 1
- 3
3
votes
0 answers
How to solving a system of linear equations over $\mathbf{Z}_p$ in python
Let us consider a system of linear equations :
$$
a_0+a_1+a_2+a_3=5
a_0+2a_1+4a_2+8a_3=14
a_0+3a_1+9a_2+27a_3=33
a_0+4a_1+16a_2+64a_3=5
$$
I want to solve this above system of equations over the integer modulo $p$, where $p$ is a prime number. …

MKS
- 149
- 1
- 5
3
votes
2 answers
How to solve a linear system for only one component in MATLAB
I need to solve the linear system
A x = b
which can be done efficiently by
x = A \ b
But now A is very large and I actually only need one component, say x(1). Is there a way to solve this more efficiently than to compute all components of x?
A is…

rehctawrats
- 221
- 5
- 16
3
votes
2 answers
Find common tangent line between two cubic curves
Given two functions, I would like to sort out the common tangent for both curves:
The slope of the common tangent can be obtained by the following:
slope of common tangent = (f(x1) - g(x2)) / (x1 - x2) = f'(x1) = g'(x2)
So that in the end we have…

DavidC.
- 669
- 8
- 26
3
votes
2 answers
Fastest method to solve multiple nonlinear independent equations in MATLAB?
MATLAB has two methods to solve a nonlinear equation:
fzero: solves a single nonlinear equation
fsolve: solves a system of nonlinear equations
Therefore, one can use the following methods to solve a system of n nonlinear independent…

m7913d
- 10,244
- 7
- 28
- 56
3
votes
2 answers
Python - Sympy - Solving equations numerically for multiple parameters in a grid
A given equation depends on an unknown variable (y) and a set of parameters. I would like to numerically solve for y, given each element of a grid with values of the parameters.
A simplified example of my attempted solution is as follows (y is the…

CarlosH
- 319
- 1
- 4
- 8