- #36
JacobIA
- 13
- 1
Is that correct?JacobIA said:Ignore "is large..."
Is that correct?JacobIA said:Ignore "is large..."
sorry, i did not see the rest of your post. was using a small screen phone. now using laptop... ok. so your saying pythagoras theorem/formula in probably not in NP because some input values cannot be written in finite time. makes sense. am i on the same page with you now?fresh_42 said:Sure, but what has to be solved, i.e. what is the problem? Finding Pythagorean triples (in P), calculating the hypothenuse given the legs, or whatever did you have in mind? And what is a solution? E.g. ##1,414213562373095048801688724209\ldots ## cannot be written in finite time, ##\sqrt{2}## in constant time, and ##\sqrt{n}## in polynomial (linear) time.
This depends on what you mean by "verify". Say we have an Input ##\{a,b\}## of binary length ##n.## Then ##c=\sqrt{a^2+b^2}## is the answer. I can write down the expression ##\sqrt{a^2+b^2}\,## in time ##n+4##. One root symbol, two squares, one addition sign, and the length of the Input. But this is probably not the answer. If ##a## and ##b## are fixed, then I can write ##\sqrt{a^2+b^2}\,## even in constant time. I guess this isn't what you thought of either. So what is the Output ##c##? It is normally an irrational number of infinite length that cannot be "verified" at all!JacobIA said:Great answers guys!
If I understand (I hope I do!) What your saying is that the input I.e in the pythagoras theorem or formula a^2 + b^2 = c^2 . Say your given a, b and c. Verifyng c in polynomial time is not possible for large a and B. is large i.e close to infin
mmm! ok. so the pythagoras formula cannot be verified in poly time (for all values) and therefor not in np. correct? if correct then i think i understand now. many thanks!fresh_42 said:This depends on what you mean by "verify". Say we have an Input ##\{a,b\}## of binary length ##n.## Then ##c=\sqrt{a^2+b^2}## is the answer. I can write down the expression ##\sqrt{a^2+b^2}\,## in time ##n+4##. One root symbol, two squares, one addition sign, and the length of the Input. But this is probably not the answer. If ##a## and ##b## are fixed, then I can write ##\sqrt{a^2+b^2}\,## even in constant time. I guess this isn't what you thought of either. So what is the Output ##c##? It is normally an irrational number of infinite length that cannot be "verified" at all!
It doesn't even have an algorithm that stops at all! If you add the condition that, e.g. 100 digits after the comma is enough precision, then it can be verified in polynomial time. But that is a different problem. If you add the condition that ##\{a,b,c\}## all are integers, then we have Pythagorean triples. They are all known and can be written down in polynomial time.JacobIA said:mmm! ok. so the pythagoras formula cannot be verified in poly time (for all values) and therefor not in np. correct?
It can get murky I guess depending on how you define the input, and you have to be very precise in your definitions. Technically, any computable number can be encoded as a finite length string. E.g., if ##a## and ##b## are computable, then you can encode ##c## as ##\sqrt{a^2+b^2}##. ##\sqrt{2}##, ##\pi##, are examples of irrational but computable numbers. You can encode ##\pi## as a finite string, for example, by making that string the computer program that prints ##\pi##. Some real numbers aren't computable, meaning there is no computer program that prints them, and therefore, no finite representation of them. A non-computable number obviously can't be an input or output of a computer program.JacobIA said:mmm! ok. so the pythagoras formula cannot be verified in poly time (for all values) and therefor not in np. correct? if correct then i think i understand now. many thanks!
Not strictly true. As I pointed out you could define how you encode each number as being the computer program which prints it. Then you can have as input ##a,b## and ##c## all irrational, and you could parse the input in finite time. But I don't think you could answer yes or no correctly in finite time.fresh_42 said:If we have an input where ##a^2+b^2## isn't a perfect square, then our algorithm will always stop on False. This is because ##a^2+b^2\neq c^2## always (False), since in case ##a^2+b^2=c^2## we cannot even read ##c## because it's infinitely long, contradicting our assumption of a finite length of input.
Algorithms with an infinite input length cannot even start since they will be busy reading the input forever.
I am pretty sure it is.Jarvis323 said:Not strictly true.
This is a tautology. I can always have an algorithm that stops in one step if I do not bother whether my result is true or not.Jarvis323 said:But I don't think you could answer yes or no correctly in finite time.
There is some extent to which you can do symbolic computation on irrational numbers. Forumulating the input as a computer program generating the number is just a way to generalize the encoding. In some cases, that solver can correctly handle irrational numbers, but not every case, which I think can probably be proven based on undecidability.fresh_42 said:I am pretty sure it is.
This is a tautology. I can always have an algorithm that stops in one step if I do not bother whether my result is true or not.
That was why I have been repeatedly asking for a proper definition of the problem. If ##\sqrt{c}## is a valid output, then ##a^2+b^2=c## is computable in polynomial time and the algorithm is polynomial. But I admit that my usage of the term irrational was an abbreviation of a longer description on which inputs an algorithm does not stop, or cannot read the input. Anyway, that does not change my central statement:Jarvis323 said:There is some extent to which you can do symbolic computation on irrational numbers.
fresh_42 said:Whatever you do to tailor "Pythagoras" such that it makes sense to speak about ##NP##, you will either have an algorithm that a) doesn't stop reading the input, b) doesn't stop writing the output, or c) is in ##P##.
Hence, forget about "Pythagoras" in this context.
thank you for your time. but if we do assume pythagorean tripples...is the formula in np or not?fresh_42 said:You can find some examples of calculations on algorithms in the last attached document of
https://www.physicsforums.com/threads/solution-manuals-for-the-math-challenges.977057/
if you search the text for "algorithm".
None of them is NP-hard, but it illustrates how the typical questions in the field are dealt with.
JacobIA said:thank you for your time. but if we do assume pythagorean tripples...is the formula in np or not?
"... If a and b are fixed, then I can write a2+b2 even in constant ti
fresh_42 said:That was why I have been repeatedly asking for a proper definition of the problem. If ##\sqrt{c}## is a valid output, then ##a^2+b^2=c## is computable in polynomial time and the algorithm is polynomial. But I admit that my usage of the term irrational was an abbreviation of a longer description on which inputs an algorithm does not stop, or cannot read the input. Anyway, that does not change my central statement:
"That was why I have been repeatedly asking for a proper definition of the problem"fresh_42 said:That was why I have been repeatedly asking for a proper definition of the problem. If ##\sqrt{c}## is a valid output, then ##a^2+b^2=c## is computable in polynomial time and the algorithm is polynomial. But I admit that my usage of the term irrational was an abbreviation of a longer description on which inputs an algorithm does not stop, or cannot read the input. Anyway, that does not change my central statement:
This says everything that needs to be said; IMHO there is no point in continuing.fresh_42 said:Whatever you do to tailor "Pythagoras" such that it makes sense to speak about ##NP##, you will either have an algorithm that a) doesn't stop reading the input, b) doesn't stop writing the output, or c) is in ##P##.
Hence, forget about "Pythagoras" in this context.
If you do not know the answer to this question then, with respect, I suggest that you do not yet have sufficient understanding of the subject to consider P vs NP. You can find a free course on the subject here: https://ocw.mit.edu/courses/mathematics/18-404j-theory-of-computation-fall-2020/index.htmJacobIA said:Let n be an integer. Can we compute n^2 in polynomial time for any n?
Yes.JacobIA said:Let n be an integer. Can we compute n^2 in polynomial time for any n?
JacobIA said:Let n be an integer. Can we compute n^2 in polynomial time for any n?
I agree. Thread closed.pbuk said:This says everything that needs to be said; IMHO there is no point in continuing.
If you do not know the answer to this question then, with respect, I suggest that you do not yet have sufficient understanding of the subject to consider P vs NP.