## Efficiently computing possible cases for roots in a polynomial system

I have a list of polynomials like this example but much longer:

polys = {a*b*c + c*d*e + f*g*h + u*v*w, a*c^2, g*l*m, g*l*m + a*b*d,    a*b*c + u*v*w, z*z*z + t*t*t}; 

I want to compute all the cases for roots that arise from the single term polynomials. For example:

tempPolys1 = polys; monos1 = Table[    MonomialList[tempPolys1[[i]]], {i, 1, Length[tempPolys1]}]; monolen1 = Table[Length[monos1[[i]]], {i, 1, Length[tempPolys1]}]; triplets1 = tempPolys1[[Flatten[Position[monolen1, Min[monolen1]]]]]; rules = Reduce[triplets1 == 0] (*(g == 0 && a == 0) || (g == 0 && c == 0) || (l == 0 &&     a == 0) || (l == 0 && c == 0) || (m == 0 && a == 0) || (m == 0 &&     c == 0)*) 

Then I want to iterate this by substituting each case separately into polys, seeing if any polynomials turn into a single term polynomial and generating the cases that arise from the new system of polynomials.

I realize Reduce essentially does this, but I want the individual cases to stop at the point where either all polynomials are zero or there isn’t one with just one term (there may be many polynomials left over with lots of terms and reduce will get stuck).

Here is the code I have written which seems to work but is not efficient on large lists of polynomials:

Clear[F, G]; FinalList = {}; numZeroed = {} F[rule_] :=   Module[{tempPolys, monos, monolen, triplets, monoMin},    tempPolys = Cases[polys /. ToRules[rule], Except];    monos =     Table[MonomialList[tempPolys[[i]]], {i, 1, Length[tempPolys]}];   monolen = Table[Length[monos[[i]]], {i, 1, Length[tempPolys]}];   monoMin = Min[monolen];   If[monoMin > 1, AppendTo[FinalList, rule];     AppendTo[numZeroed, Length[rule]]; Return[]];   triplets = tempPolys[[Flatten[Position[monolen, monoMin]]]];   G[BooleanMinimize[rule && Reduce[triplets == 0]]]] G[ORrules_] :=   Module[{rules1}, rules1 = List @@ ORrules;    Do[F[rules1[[j]]], {j, Length[rules1]}]]   G[rules]; FinalList (*outputs all possible cases*)  

The terms in the polynomials will each always be degree 3.

Is there a better way to take advantage of built-in functions to make this efficient on large lists of polynomials?

Posted on Categories cheapest proxies

## Plotting relationship between two variables when their relationship is given by a polynomial (2)

I would like to plot the following function $$p$$ in the $$x$$-axis and $$V$$ in the $$y$$-axis. The function is given by:

62.77142857142857*(6.5+2*(18.57 - V))*(0.005*p*(18.57-V)+(6.5+2 *(18.57-V))*V)*(0.01*p*(18.57-V)+(6.5+2*(18.57-V))*V)*(0.01 *(0.65+ 0.01*(18.57-V))+0.002275*(18.57-V)*V)+0.01*(65+0.0017499999999999998*(18.57-V))*(18.57-V)*((6.5 +2*(18.57-V))*V*(0.005*p*(18.57-V)+(6.5 +2*(18.57-V))*V)-(6.5+2*(18.57-V))*V*(0.01*p*(18.57-V)+(6.5 +2*(18.57-V))*V)+2*(0.005*p*(18.57-V)+ (6.5 +2*(18.57-V))*V)*(0.01*p*(18.57-V)+(6.5+2*(18.57-V))*V))*(-0.05869954325800593*(18.57-V)+0.39*(6.5+2*(18.57-V))*(0.01*(0.65+0.01*(18.57-V))+0.002275*(18.57-V)*V))=0

Note:

I posted a similar question yesterday and @Bob Hanlon was kind enough to provide me with a very helpful code. I tried doing the same thing for this polynomial today, and Mathematica shows an error.

Posted on Categories cheapest proxies

## NP-Complete Problem and Polynomial Hierarchy

I have tried to search the internet to check if the following is correct: If $$\sum_{2}$$ contains a NP-Complete problem then PH collapses to NP: $$PH=NP$$

For example if $$SAT\epsilon\sum_{2}$$ than: $$PH=NP$$

Posted on Categories proxies

## Provide a polynomial time algorithm that decides whether or not the language recognized by some input DFA consists entirely of palindromes

Everything needed to know is in the question statement. I believe that the DFA has to be acyclic (meaning its language is finite), which can be checked in polynomial time. However, finding all paths from the start state to an accept state can run in exponential time in worst-case.

Posted on Categories proxies

## I can verify solutions to my problem in polynomial time, how would a non-deterministic algorithm arrive to a solution if it always takes $2^n$ bits?

Decision Problem: Given integers as inputs for $$K$$ and $$M$$. Is the sum of $$2^k$$ + $$M$$ a $$prime$$?

## Verifier

m = int(input('Enter integer for M: ')) sum_of_2**K+M=int(input('enter the sum of 2^k+m: '))  if AKS.sum_of_2**K+M == True:    # Powers of 2 can be verified in O(N) time   # make sure there is all 0-bits after the 1st ONE-bit      # Use difference to verify problem    if sum_of_2**K+M - (M) is a power_of_2:     OUTPUT Solution Verified 

The powers of 2 have approximately $$2^n$$ digits. Consider $$2^k$$ where $$K$$ = 100000. Compare the amount of digits in $$K$$ to the amount of digits in it’s solution! Also take note that the powers of 2 have $$2^n$$ bits as its 0-bit Unary essentially for the exponent $$n$$.

## Question

How would a non-deterministic machine solve this problem in polynomial time?

Posted on Categories proxies

## Nondeterministic polynomial time algorithm versus certificate/verifier for showing membership in NP

In this paper (https://arxiv.org/pdf/1706.06708.pdf) the authors prove that optimally solving the $$n\times n\times n$$ Rubik’s Cube is an NP-complete problem. In the process, they must show that the relevant decision problem belongs in NP (section 2.5 on page 6). To do this, they describe an algorithm that nondeterministically solves the Cube in polynomial time. It seems to me that this is more effort than necessary.

In particular, the relevant decision problem is as follows: The Rubik’s Cube problem has as input a permutation $$t$$ and a value $$k$$. The goal is to decide whether $$t$$ can be solved in $$k$$ or fewer moves. So rather than constructing a nondeterministic polynomial time solution algorithm, they could simply give a certificate that a "yes" decision is just a list of at most $$k$$ moves and verify that checking this is polynomial time.

So my questions are as follows. Are the two definitions below actually equivalent?

1. NP is the complexity class of decision problems that are solvable by a nondeterministic Turing machine in polynomial time.
2. NP is the complexity class of decision problems for which a solution can be confirmed in polynomial time (deterministically)?

And if they are equivalent, why would the authors of the linked paper choose the more difficult method (or am I wrong about this assumption)?

Note that I am posting this question on multiple StackExchange websites as I’m not sure where it’s best fit. If it is inappropriate here, I’ll happily delete it. Similarly, I’ll link to a good solution on another site if it gets answered there.

Posted on Categories proxies

## How to simplify polynomial to get to particular factor?

If I have an expression like this

ex = -l + l t - 2 t^2 + T + (l - 2 t) y 

This can be written as

ex1 = -l + (l - 2 t) (t + y) + T 

However, if I try

FullSimplify[ex] 

I get

T + l (-1 + t + y) - 2 t (t + y) 

How can I get the form of ex1 without having to manually copy, paste and modify?

Posted on Categories cheapest proxies

## How do I decode a received polynomial code with an error?

As a message I get (5,0,1,3), which is coding a sequence of numbers of length 2 in $$\mathbb{F}_7$$ as polynom with the 4 support points a1 = 0, a2 = 1, a3 = 2, a4 = 6. In the transimission occured an error. Calculate the original message.

How do I do this? In my script we didnt’t talked about polynomial codes directly just about the cyclic code. And the topic of this exercise is polynomial codes.

Could someone please get me through this or explain a way? Thanks for any help!

Posted on Categories proxies

## Given an algorithm, decide whether it runs in polynomial time?

This problem is not decidable (reducible to halting problem) but is semi-decidable and therefor verifiable (as those two definitions are equivalent: How to prove semi-decidable = verifiable?).

However, is this problem poly-time verifiable? A decision problem 𝑄 is in poly time verifiable iff

there is an algorithm 𝑉 called verifier such that V runs in $$O(x^{c})$$ for some constant c for all inputs 𝑥,

if 𝑄(𝑥)=𝑌𝐸𝑆 then there is a string 𝑦 such that 𝑉(𝑥,𝑦)=𝑌𝐸𝑆, if 𝑄(𝑥)=𝑁𝑂 then for all strings 𝑦, 𝑉(𝑥,𝑦)=𝑁𝑂.

Example: for an enumeration of P (such as this): How does an enumerator for machines for languages work? for each string $$p$$ in the enumeration, does there exist some other string (certificate) $$c$$ that allows you to verify $$p$$ is a member of the enumeration in poly time?

Posted on Categories proxies

## Do all languages in $P$ have polynomial proofs that they are in $P$?

A proof for a language $$L$$ belonging to a complexity class $$C$$ that is accepted by a mathematical journal can be framed as there existing a verifier $$V$$ that accepts this proof as the first part of its input and the language as the second. The verifier (referee) verifies this language is a member (a word) in the language representing the complexity class.

$$Verifier$$: (Proof for $$L$$ in $$C$$, $$L$$)$$–>$$[0,1]

Do all languages in $$P$$ have a proof of the fact that they are in $$P$$ that can be verified in polynomial time? Given a language, determining if an arbitrary $$L$$ is in $$P$$ or not is undecidable; however, given a proof for a language being in $$P$$, can that language be verified to be in $$P$$ in polynomial time?

Posted on Categories proxies