Questions tagged [equation-solving]

763 questions
3
votes
1 answer

How to get the sum of row on sympy matrix?

I would like to get at least one solution for one t for this: row_sum(Y) = x.t + row_sum(B) Y and B are matrix(n, m) and x a vector(n). I know B, I know row_sum(Y) but not x. I would like to get the Y and x for some t value. Y variate linearly with…
Cyril
  • 485
  • 4
  • 15
3
votes
1 answer

Solving a system of transcendental equations with python

Assuming I have the following four equations: cos(x)/x = a cos(y)/y = b a + b = 1 c sinc(x) = d sinc(y) for unknown variables x, y, a and b. Note that cos(x)/x=a has multiple solutions. Similar goes for variable y. I am only interested in x and y…
skrat
  • 648
  • 2
  • 10
  • 27
3
votes
1 answer

std::regex to identify coefficient of polynomial equation

I am new to C++ and I am asked to create a solver of a second degree polynomial function. To do this, I first need to parse the equation and reduce it to show it in the reduced form, i.e: 8 * X^0 - 6 * X^1 + 5.6 * X^2 = 3 * X^0 becomes 5 * X^0 - 6…
ziKmouT
  • 175
  • 2
  • 2
  • 13
3
votes
1 answer

Solve mod equation in JS

I need to find an x value that satisfied: x * a % m == b x * c % n == d Is there a smarter way to find the solution without iterating all the possibilites ? function solve() { for (x=0;x
Blair d
  • 78
  • 5
3
votes
2 answers

Solve multivariable equation with constraints - Choco

I want to solve a nonlinear multivariable equation with discrete values like this one: x*y + z + t - 10 = 0 with constraints: 10 < x < 100 etc.. I am trying to do it with Choco library, but I am a little lost. I found this code: // 1. Create a…
dirac
  • 309
  • 1
  • 9
3
votes
0 answers

Java: Solve equation String with variables

Imagine I have the following String: "10*x = 20" How would I get x using Java? I am looking for something like: String str = "10*x = 20"; int x = Integer.parseInt( str.solve("x") ) //==> 2; It should also work for equations like: 10-x+y = 5 //x =…
d0n.key
  • 1,318
  • 2
  • 18
  • 39
3
votes
1 answer

How to solve this system of two equations in SymPy?

I have the function: f(x) = 1 / (x + a)^t + b And I would like to solve for a given t for a and b the equation system {f(0)=1 and f(1)=0}. For t=1 a solution is successfully calculated: import sympy as sp a,b = sp.symbols("a b") res =…
Raffael
  • 19,547
  • 15
  • 82
  • 160
3
votes
2 answers

Solve indeterminate equation system in R

I have a equation system and I want to solve it using numerical methods. I want to get a close solution given a starting seed. Let me explain. I have a vector of constants ,X, of values: X <- (c(1,-2,3,4)) and a vector W of weights: W <-…
arodrisa
  • 300
  • 4
  • 17
3
votes
1 answer

Error: Singular Matrix

I'm having an error in my code, I hope you can help me!: (When I paste the code something weird happens (not all of it is written like code) but here we go: I want to linalg.solve(A,Res) . The first one (A) has 10 rows and 10 columns,i.e, matrix([10…
Tarik Riadi
  • 39
  • 1
  • 1
  • 4
3
votes
0 answers

How to find critical points of equations in matlab?

In matlab, we use meshgrid instead of a double for-loop to increase the speed, especially when the number of iterations is large. In my application, I am using meshgrid to find the critical point of a matrix. syms…
andy_tse
  • 189
  • 1
  • 5
  • 13
3
votes
4 answers

can someone explain the steps to compute this equation? Java

Write a program that computes the following equation. 100/1+99/2+98/3+97/4+96/5...3/98+2/99+1/100 I am not asking for a solution. Yes this is a homework problem, but I am not here to copy paste the answers. I asked my professor to explain the…
happy face
  • 43
  • 9
3
votes
0 answers

finding more than one root for a set of trigonometric equations: python

I am using python's fsolve to find roots of a set of equations using the script below: from scipy.optimize import fsolve from scipy.interpolate import spline import math import numpy as np #from mpldatacursor import datacursor %pylab from…
Nikhil Gupta
  • 551
  • 10
  • 28
3
votes
1 answer

What is the most efficient way to solve system of equations containing the digamma function?

What is the most efficient way to solve system of equations involving the digamma function? I have a vector v and I want to solve for a vector w such that for all i: digamma(sum(w)) - digamma(w_i) = v_i and w_i > 0 I found the gsl function…
Neil G
  • 32,138
  • 39
  • 156
  • 257
3
votes
1 answer

Is there an algorithm for choosing a few strings from a list so that the number of strings equal the number of different letters in them?

Edit2: I think the solution of David Eisenstat works but I will check it before I call the question solved. Example list of strings: 1.) "a" 2.) "ab" 3.) "bc" 4.) "dc" 5.) "efa" 6.) "ef" 7.) "gh" 8.) "hi" You can choose…
3
votes
0 answers

Solving nonlinear system of n equation, n unknowns using GPU

Is this possible to solve a nonlinear system of n equation, n unknowns on Matlab, using graphical processor? I can't think of any parallel solution for such an application, and solve function seems not implemented for GPU arrays in…
sorush-r
  • 10,490
  • 17
  • 89
  • 173