필터 지우기
필터 지우기

Bug in system solver? why it give wrong answer? here's proof

조회 수: 1 (최근 30일)
raymond
raymond 2012년 5월 16일
So i have an equation that i need to solve for Xtest, the rest are constants that have been defined,(T11,T12,R11,L11,L12)
>> T11(counter1,1)
ans =
4.1346 + 3.7345i
>> T12(counter1,1)
ans =
-4.8766 - 1.6522i
>> R11(counter1,1)
ans =
-1.2971 + 3.0915i
>> L11(counter1,1)
ans =
4.8939 + 0.8988i
>> L12(counter1,1)
ans =
-1.7834 + 9.5488i
>> S11e(counter1,1)
ans =
4.7170 + 2.3709i
>> S22e(counter1,1)
ans =
0.0222 - 0.2871i
>> S12e(counter1,1)
ans =
0.3975 - 2.3266i
>> syms Xtest
>> P = ((T11(counter1,1)-L11(counter1,1))/(T12(counter1,1)-(L12(counter1,1)*Xtest)))^2 - ((T12(counter1,1)*Xtest - L12(counter1,1))/(T12(counter1,1)*Xtest - L12(counter1,1)*(Xtest^2)))
P =
- (Xtest*(2745295363781011/562949953421312 + 7440648460943983/4503599627370496*I) - 8031595954485133/4503599627370496 + 335968815892787/35184372088832*I)/(Xtest*(2745295363781011/562949953421312 + 7440648460943983/4503599627370496*I) - Xtest^2*(8031595954485133/4503599627370496 - 335968815892787/35184372088832*I)) - 1/(Xtest*(8031595954485133/4503599627370496 - 335968815892787/35184372088832*I) - 2745295363781011/562949953421312 - 7440648460943983/4503599627370496*I)^2*(591387244714502586985380151581/79228162514264337593543950336 + 2729658162811733403516616363985/633825300114114700748351602688*I)
>> [Xtest] = double(solve (P))
Xtest =
-0.0750 - 0.5247i
-0.0844 + 0.5639i
-0.2597 - 1.7345i
>>
Matlab solve the equation and states that Xtest has 3 values
-0.0750 - 0.5247i
-0.0844 + 0.5639i
-0.2597 - 1.7345i
Xtest(1) is the first value, Xtest(2) is 2nd and Xtest(3)is third. now lets substitude Xtest(1,2&3) into the original equation, it should = to 0, or at least very cose to 0.
but see, only the 2nd and 3rd is =0 the 1st answer is clearly not 0, what went wrong here? is this a bug in matlab?
>> ((T11(counter1,1)-L11(counter1,1))/(T12(counter1,1)-(L12(counter1,1)*Xtest(1))))^2 - ((T12(counter1,1)*Xtest(1) - L12(counter1,1))/(T12(counter1,1)*Xtest(1) - L12(counter1,1)*(Xtest(1)^2)))
ans =
1.1977 + 0.1702i
>> ((T11(counter1,1)-L11(counter1,1))/(T12(counter1,1)-(L12(counter1,1)*Xtest(2))))^2 - ((T12(counter1,1)*Xtest(2) - L12(counter1,1))/(T12(counter1,1)*Xtest(2) - L12(counter1,1)*(Xtest(2)^2)))
ans =
-3.5527e-014 -4.9738e-014i
>> ((T11(counter1,1)-L11(counter1,1))/(T12(counter1,1)-(L12(counter1,1)*Xtest(3))))^2 - ((T12(counter1,1)*Xtest(3) - L12(counter1,1))/(T12(counter1,1)*Xtest(3) - L12(counter1,1)*(Xtest(3)^2)))
ans =
1.7347e-017 -8.6736e-019i
>>

답변 (2개)

Walter Roberson
Walter Roberson 2012년 5월 16일
It does appear to be a bug. That extra point is one of two singularities (the other singularity is its complex conjugate)
  댓글 수: 2
raymond
raymond 2012년 5월 16일
I'm sorry, i dont understand you :-(
shouldn't the answer be a one that, if substitude back into the equation, will yield 0?
if it doesn comply to the equation, then it shouldn't be consider an answer,
is there a way to make it, say, ignore the singularities (wrong answer)
Walter Roberson
Walter Roberson 2012년 5월 16일
Yes, the answers *should* be ones that substitute back to yield 0. You have correctly identified a bug that is giving back extra answers. The extra answer is at a location where (if you had enough decimal places) the expression would divide by 0. There is no way to make it ignore the wrong answers because it has a bug and does not know they are wrong answers.

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


raymond
raymond 2012년 5월 16일
how can i make the program not to display the extra singularities?

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by