equation-solving

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

与世无争的帅哥 提交于 2019-12-03 02:59:13
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 the web a bit for a non-linear solver library, and I couldn't get to something which looks easy to use (got to NOX and C/C++ Minpack , but both seem to be an overkill for my need). Any thoughts and ideas of easy-to-use libraries for this purpose? There are two options for you, you can use the sundials packages which includes a nonlinear solver,

Matlab Solve(): Not giving all the solutions

只愿长相守 提交于 2019-12-02 15:16:45
问题 I am trying to find intersection points of two curves syms x y g(x) = 20*(exp(-(x+30)/3.5)-1); [sol_x, sol_y] = solve((x+22.3097)^2+(y+16.2497)^2 == 25, y == g(x),x,y,'Real',true) ; It is giving only one solution. But according to the plot of the two equations, there should be two intersection points. How can I rectify this problem? 回答1: The solver can not find a analytic solution, thus a numeric solver is used. There is no reliable way in finding all solutions with a numeric method, but if

Matlab Solve(): Not giving all the solutions

馋奶兔 提交于 2019-12-02 07:56:37
I am trying to find intersection points of two curves syms x y g(x) = 20*(exp(-(x+30)/3.5)-1); [sol_x, sol_y] = solve((x+22.3097)^2+(y+16.2497)^2 == 25, y == g(x),x,y,'Real',true) ; It is giving only one solution. But according to the plot of the two equations, there should be two intersection points. How can I rectify this problem? The solver can not find a analytic solution, thus a numeric solver is used. There is no reliable way in finding all solutions with a numeric method, but if you have a good guess (e.g. from a plot) try vpasolve with a reasonable set initial value. In this case, with

Solve underdetermined system of equations in matlab

孤街浪徒 提交于 2019-12-02 03:32:39
问题 I have a system of under-determined linear equations Ax = b (i.e. more unknowns than equations) that I would like so solve in matlab. I know that this would usually mean an infinite number of solutions, but I also know the solutions should be positive integers and less than a certain number. Can I find all the solutions that meet those additional requirements? This problem come from having an unknown matrix where I know the sum of each row and column. e.g. unknown matrix to find 0 3 2 0 0 2 4

Solve underdetermined system of equations in matlab

╄→尐↘猪︶ㄣ 提交于 2019-12-02 00:12:55
I have a system of under-determined linear equations Ax = b (i.e. more unknowns than equations) that I would like so solve in matlab. I know that this would usually mean an infinite number of solutions, but I also know the solutions should be positive integers and less than a certain number. Can I find all the solutions that meet those additional requirements? This problem come from having an unknown matrix where I know the sum of each row and column. e.g. unknown matrix to find 0 3 2 0 0 2 4 1 2 1 0 0 Row sums known 5 7 3 Column Sums know 2 6 6 1 I've tried the lsqnonneg(A,b) function which

Fast solution of dense linear system of fixed dimension (N=9), symmetric, positive-semidefinite

纵然是瞬间 提交于 2019-12-01 16:53:27
问题 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 points. Such systems will be solved millions of times, so algorithm should be rather fast with respect to dimension (n=9). P.S. examples of robust C++ implementations for proposed algorithm are appreciated. 1) What do you mean by "solved million of

Fast solution of dense linear system of fixed dimension (N=9), symmetric, positive-semidefinite

守給你的承諾、 提交于 2019-12-01 16:33:04
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 points. Such systems will be solved millions of times, so algorithm should be rather fast with respect to dimension (n=9). P.S. examples of robust C++ implementations for proposed algorithm are appreciated. 1) What do you mean by "solved million of times"? Same coefficient matrix with a million of different right hand terms, or a million of distinct

SymPy - Arbitrary number of Symbols

谁说胖子不能爱 提交于 2019-11-28 20:27:54
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. This means that I can't simply hardcode the equations, or even the symbols needed to put together the equations; the function needs to be able to handle any number of equations. So, my question is, how do I produce a list of symbols? I have one possible solution, but my gut tells me that it's not going to be very efficient. Please let me know if

Solving simultaneous equations with R

拜拜、爱过 提交于 2019-11-28 05:18:59
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. This should work A <- matrix(data=c(1, 2, 3, 2, 5, 9, 5, 7, 8), nrow=3, ncol=3, byrow=TRUE) b <- matrix(data=c(20, 100, 200), nrow=3, ncol=1, byrow=FALSE) round(solve(A, b), 3) [,1] [1,] 320 [2,] -360 [3,] 140 For clarity, I modified the way the matrices were constructed in the previous answer. a <- rbind(c(1, 2, 3), c(2, 5, 9), c(5, 7, 8)) b <- c(20, 100, 200)

SymPy - Arbitrary number of Symbols

狂风中的少年 提交于 2019-11-27 13:09:13
问题 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. This means that I can't simply hardcode the equations, or even the symbols needed to put together the equations; the function needs to be able to handle any number of equations. So, my question is, how do I produce a list of symbols? I have one