필터 지우기
필터 지우기

Find integer root in a given range of an equation

조회 수: 3 (최근 30일)
Khanh
Khanh 2011년 11월 21일
Given an equation $\sum_{i=1}^{n} C_{ij}*(x_i - k_i)^2 = R$ with C is a covariance n*n matrix of vector x; R and vector k is given.
It's obvious that there are infinite number of real roots for this equation.
However, I wonder if I'm only interesting in integer roots which are in the range between some value [a, b], then is there any function in Matlab that can find them?
I'm looking at fsolve function but I don't see anyway to specify the conditions that I need (i.e. integers in a certain range).
Does any one have any suggestion, please?
Thanks,
  댓글 수: 1
Khanh
Khanh 2011년 11월 21일
I see the brute force solution would be checking all the possible solutions which is (b-a)^n which is all the possible integer vectors of vector x. However, I wonder if there is any better way to solve it?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 11월 21일
Remap the search space to be between 1 and (1 + (b-a+)/2^53), and then the adjacent floating point numbers within that space would correspond exactly to integers over a to b.
I make no representation that this would be efficient.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by