Page 1 of 1
Problem 108
Posted: Tue Feb 26, 2008 9:15 am
by luke
i don't know if it's correct to consider distinct two solution (x1,y1) (x2,y2)of the diophantine equation if and only if
x1!=x2 and y1!=y2 or x1!=y2 and y1!=x2
is it correct?
thanks
luke
Re: problem 108
Posted: Tue Feb 26, 2008 3:51 pm
by daniel.is.fischer
Identify a solution of [frac]1,x[/frac] + [frac]1,y[/frac] = [frac]1,n[/frac] with the set {x,y}. So order doesn't matter, (x,y) is the same as (y,x).
Re: problem 108
Posted: Tue Feb 26, 2008 3:55 pm
by quilan
Well, if they're the same, then it's the following logic:
(x1==x2 and y1==y2) or (x1==y2 and y1==x2)
So, take the inverse of that to test if they're distinct, and any of the following tests should work (DeMorgan's Law I think?):
!((x1==x2 and y1==y2) or (x1==y2 and y1==x2))
!(x1==x2 and y1==y2) and !(x1==y2 and y1==x2)
(x1!=x2 or y1!=y2) and (x1!=y2 or y1!=x2)
(1,2) (2,1) for example would be detected as distinct in your example (which it is not, they're the same set)
-> ((1!=2) and (2!=1)) or ((1!=1) and (2!=2))
-> (T and T) or (F and F)
-> T or F
-> T
Re: problem 108
Posted: Tue Feb 26, 2008 4:05 pm
by daniel.is.fischer
quilan wrote:Well, if they're the same, then it's the following logic:
(x1==x2 and y1==y2) or (x1==y2 and y1==x2)
So, take the inverse of that, and any of the following tests should work (DeMorgan's Law I think?):
!((x1==x2 and y1==y2) or (x1==y2 and y1==x2))
!(x1==x2 and y1==y2) and !(x1==y2 and y1==x2)
(x1!=x2 or y1!=y2) and (x1!=y2 or y1!=x2)
(1,2) (2,1) for example would be detected as distinct in your example (which it is not, they're the same set)
-> ((1!=2) and (2!=1)) or ((1!=1) and (2!=2))
-> (T and T) or (F and F)
-> T or F
-> T
You mean (x1,y1) == (x2,y2) [equiv] (x1 == x2 /\ y1 == y2) \/ (x1 == y2 /\ y1 == x2) ?
Yes. But in the example you gave, you swapped 'and' and 'or', the test should unfold:
(1,2) != (2,1) [equiv] (x1 != x2 \/ y1 != y2) /\ (x1 != y2 \/ y1 != x2)
[equiv] (1 != 2 \/ 2 != 1) /\ (1 != 1 \/ 2 != 2)
[equiv] (T \/ T) /\ (F \/ F) [equiv] T /\ F = F.
Re: problem 108
Posted: Tue Feb 26, 2008 4:15 pm
by quilan
daniel.is.fischer wrote:You mean (x1,y1) == (x2,y2) [equiv] (x1 == x2 /\ y1 == y2) \/ (x1 == y2 /\ y1 == x2) ?
Yes. But in the example you gave, you swapped 'and' and 'or', the test should unfold:
(1,2) != (2,1) [equiv] (x1 != x2 \/ y1 != y2) /\ (x1 != y2 \/ y1 != x2)
[equiv] (1 != 2 \/ 2 != 1) /\ (1 != 1 \/ 2 != 2)
[equiv] (T \/ T) /\ (F \/ F) [equiv] T /\ F = F.
Yup. Was showing him an example where the logic he provided would fail to be the correct case (parent logic was: x1!=x2 and y1!=y2 or x1!=y2 and y1!=x2)
Re: problem 108
Posted: Tue Feb 26, 2008 4:58 pm
by daniel.is.fischer
Sorry, didn't link it with the first post.
Re: problem 108
Posted: Wed Feb 27, 2008 7:26 am
by luke
Hi,
yesterday I had a lot of thread open, I've made an error negating condition I'm use in my javaCode.
So I agree that (x1==x2 and y1==y2) or (x1==y2 and y1==x2) identify the same solution....
I've posted my question, cause my solution is wrong...so I've a bug in my code (I suppose some stuff related to float2int conversion)
thanks quilan&daniel
luca