Questions tagged [equation-solving]

763 questions
5
votes
2 answers

fsolve always returning the guess/estimate

I'm using scipy's optimize.fsolve function for the first time to find the roots to an equation. The problem is that whatever number I use as the guess/estimate value is what I get back as my answer (to within about 8 decimal places). When using…
scaevity
  • 3,991
  • 13
  • 39
  • 54
5
votes
1 answer

C++ library for undetermined equation systems

I have been looking for a library in c++ to solve an undetermined system like this q is a vector, w, x, y, z variables and a,b,c,d constants. argmin_q MAX(q) - MIN(q) s.t. q[1] = a - w - y q[2] = b - w - z q[3] = c - x - y q[4] = d - x - z It…
Altober
  • 956
  • 2
  • 14
  • 28
5
votes
2 answers

How to solve a system of ODE with time dependent parameters in R?

I am trying to solve this system of ODEs through deSolve, dX/dt = -X*a + (Y-X)b + c and dY/dt = -Ya + (X-Y)*b for time [0,200], a=0.30, b=0.2 but c is 1 for time [50,70] and 0 otherwise. The code I have been using is, time <- seq(0, 200,…
5
votes
1 answer

Is there any way to bound the region searched by NLsolve in Julia?

I'm trying to find one of the roots of a nonlinear (roughly quartic) equation. The equation always has four roots, a pair of them close to zero, a large positive, and a large negative root. I'd like to identify either of the near zero roots, but…
Robbie Rosati
  • 1,205
  • 1
  • 9
  • 23
5
votes
1 answer

scipy.sparse.linalg: what's the difference between splu and factorized?

What's the difference between using scipy.sparse.linalg.factorized(A) and scipy.sparse.linalg.splu(A) Both of them return objects with .solve(rhs) method and for both it's said in the documentation that they use LU decomposition. I'd like to…
5
votes
8 answers

How do I express this?

I'm trying to work out how to write the following: total = (value * 0.95 ^ 0) + (value * 0.95 ^ 1) + (value * 0.95 ^ 2) ... or: x = (y * z ^ 0) + (y * z ^ 1) + (y * z ^ 2) + (y * z ^ 3) ... This expresses how to calculate x for 4 iterations, but…
ChrisIzatt
  • 53
  • 4
5
votes
2 answers

Solving linear equations w. three variables using numpy

I'm currently in need of a class, which must be able to display and solve an equation system like this one: | 2x-4y+4z=8 | | 34x+3y-z=30 | | x+y+z=108 | I thought it would be a good idea to write a class to transform the left-side things of the…
5
votes
2 answers

Solving multiple argument equations, choosing the dependent variable. [Python, Scipy]

I have some equations that depend on a number of variables. I would like to solve the equations in python. Here is one of the simpler equations: f(x,y,theta,w) = x - y + theta * (w - y) How can I solve/find the roots of this equation for a…
user668074
  • 1,111
  • 10
  • 16
5
votes
1 answer

Non-linear system of equations Julia

I'm trying to solve a large number (50) of non-linear simultaneous equations in Julia. For the moment I'm just trying to make this work with 2 equations to get the syntax right etc. However, I've tried a variety of packages/tools - NLsolve, nsolve…
5
votes
2 answers

Function to translate linear equations into matrix form in R?

I was wondering whether there exist any packages or other pre-built solutions for R that are capable of translating sets of linear equations into matrix form (e.g. for solution via the Gauss Seidel algorithm), similar to the…
dreamon
  • 67
  • 7
5
votes
3 answers

Solving Ax=b where A is too big to be stored in a single array

Problem: A is square, full rank, sparse and banded. It has way too many elements to be stored as a single matrix in Matlab (at least ~4.6*1018 and ideally ~1040, both of which exceed max array size. EDIT: A is stored as sparse, and the problem is…
OOO
  • 51
  • 2
5
votes
2 answers

Solve Ax = b, A = lower triangular matrix in c++

I`m trying to do this function that solves linear systems, A*x = b, where A = lower triangular matrix, linear independent matrix and with only one solution. But the results always show 0 0 0 0 ... I have printed the sum, s, and it always shows 0 as…
user3369563
5
votes
2 answers

R: subtraction of elements of a matrix from the elements of another matrix

I am trying to apply an equation to two matrices. Since I am a beginner R user, it seems very difficult to me. I would be greatful if you could give me some advice. I have two similarity matrices: > r [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0 …
Sielu
  • 129
  • 2
  • 2
  • 6
4
votes
3 answers

How can I reference a specific point of my function inside NDSolve?

The problem: I am trying to solve this diffrential equation: K[x_, x1_] := 1; NDSolve[{A''[x] == Integrate[K[x, x1] A[x1], {x1, 0, 1}], A[0] == 0, A'[1] == 1}, A[x], x] and I'm getting errors (Function::slotn and NDSolve::ndnum) (it…
tsvikas
  • 16,004
  • 1
  • 22
  • 12
4
votes
1 answer

How to identify the roots of an equation by plotting it's real and imaginary parts

This is more of a general Maths question (might be silly even). But in high school we learn to identify the roots of an equation via it's plot right. For example, for the equation y = x^2 - 1 The blue line would show us the roots. This is when the…
Mac
  • 991
  • 3
  • 11
  • 22
1 2
3
50 51