Questions tagged [equation-solving]

763 questions
2
votes
1 answer

How to solve equation having summation?

I solve equation sum((2*x+1)/k^x)==3*k (where x belongs to Whole Numbers) as x=0:10000 y=function(k){sum((2*x+1)/k^x)==3*k} y(2) It returns TRUE. But I want a method to solve it automatically, how should I solve it?
Hemant Rupani
  • 145
  • 10
2
votes
1 answer

All possible solutions of an equations in R

I want to write an R code to generate all distinct solution of the equation x1+x2+...+xm=n, where n is a positive integer and xi>=0, is a non-negative interger. I have written an R code for this purpose, but I don't like its run time. Furthermore,…
Ehsan
  • 41
  • 3
2
votes
2 answers

Scipy - All the Solutions of Non-linear Equations System

I have a system of non-linear equations, where can be choosed any n, so length of vector x = (x1,...,xn) can be different. For example, system can be like that: f1(x1,...,xn) = sum( xi + xi^2 ) = 0, i={1,n} f2(x1,...,xn) = sum( e^xi + xi +…
Fruitty
  • 57
  • 2
  • 10
2
votes
1 answer

How to solve system of (non-linear) equations using Jacobian and Newton's Method in Matlab

I am trying to build a function that can solve a system of n-1 (non-linear) equations with n unknowns in Matlab making use of Newton's method. I did some research online and came to the following procedure: Use matlab's 'null' function applied to an…
2
votes
1 answer

0-by-1 sym - What do I need to change in order to get proper symbolic results?

I would like to solve a system of equations symbolically for beta1, beta2, and beta3. I defined variables as follows and set up the equation system: w1 = sym('w1', 'real'); w2 = sym('w2', 'real'); me1 = sym('me1', 'real'); me2 = sym('me2',…
imeisteri
  • 21
  • 1
  • 3
2
votes
2 answers

Solving equation using LU factorization without pivoting (Lapack library)

At the beginning I would like to apologise for my English. Now, let's go to my problem. I try to write a simple code which will find a solution of a system of linear equations: Ax = b where A is a square matrix nxn. In this program I use Lapack…
Michal
  • 43
  • 5
2
votes
0 answers

Solving overdetermined system of nonlinear conditional equations with MATLAB's lsqnonlin function

My functional model consists of a nonlinear conditional equation of the form a^x + b^x - 1 = 0 a and b are known. Therefore, I can solve this easily using Gauss-Newton iterations or MATLAB's in-built fsolve function. But: What if I have multiple…
2
votes
2 answers

MATLAB: MEX matrix division gives different result than m-file

I've used MATLAB's coder tool to create a MEX version of the matrix exponential function, to be used in another set of functions. The issue is, the MEX version gives different results than the original m-file. After debugging it, I believe that the…
G Boggs
  • 381
  • 1
  • 6
  • 19
2
votes
1 answer

Understanding Matlab linsolve

1.What is the difference between A\b and linsolve(A,b) (different algorithms?) ? 2.What is the difference solving A*x=b and A'*A*x=A'*b, which is more precise ? Second equation goes from Least squares approximation Simple matlab test…
mrgloom
  • 20,061
  • 36
  • 171
  • 301
2
votes
2 answers

Storing roots of a complex function in an array in SciPy

I have the complex function below: import numpy as np import scipy as sp from scipy.special import jv, hankel1, jvp, h1vp, h2vp, gamma nr = 2 m = 20 def Dm(x): return nr * jvp(m,nr*x,1) * hankel1(m,x) - jv(m,nr*x) * h1vp(m,x,1) I'm…
PeteyCoco
  • 149
  • 1
  • 7
2
votes
1 answer

error in using curve_fit function to sympy function

I have a problem in using curve_fit function. The task is to solve symbolic a cubic equation and then to use this solution in fitting function. import numpy as np import pylab import matplotlib.pyplot as plt from scipy.optimize import curve_fit from…
olgagl
  • 23
  • 4
2
votes
2 answers

linear equation system, least squares with constraints

i try to describe the preconditions first i have a number of images/matrices that can be imagined to be layers in an image manipulation program. these layers be will be added to form the final output. each layer has a factor from 0 to 1 x_1 * M_1 +…
vlad_tepesch
  • 6,681
  • 1
  • 38
  • 80
2
votes
2 answers

Displaying #'s 1 - 1000 not divisible by 13? In Java

I'm working on some homework for my Intro to Programming class and one of the questions is Write a program that displays all the integers from 1 to 1000 that are not evenly divisible by 13. (Hint: x is not evenly divisible by 13 if the expression x…
Dariani Disani
  • 79
  • 2
  • 3
  • 9
2
votes
2 answers

Find degree of equation in a string?

In JAVA:- Given an equation in a string: String equation = "4*x^3-19*x^2+2*x-1=0";, how to find its degree? I thought of looping through the string finding positions of carets'^', get the numbers after the carets and the highest among them would be…
Frozen Crayon
  • 5,172
  • 8
  • 36
  • 71
2
votes
1 answer

MATLAB - lsqnonlin for equation systems

I have a system as follows: A*(B-C-D) - ( sqrt( (E-x)^2 + (F-y)^2 ) - sqrt( (G-x)^2 + (H-y)^2 ) = p A*(I-J-K) - ( sqrt( (L-x)^2 + (M-y)^2 ) - sqrt( (N-x)^2 + (O-y)^2 ) = p The values of the coefficients [A-O] are know, and I'm trying to estimate…