## When does a Monte Carlo alogrithm solve a problem?

I am asking myself the following:

When can we say that a Monte Carlo algorithm solves a problem?

To quote from Wikipedia on Monte Carlo algorithms

For instance, the Solovay–Strassen primality test is used to determine whether a given number is a prime number. It always answers true for prime number inputs; for composite inputs, it answers false with probability at least ½ and true with probability less than ½.

What would happen if the Solovay–Strassen Test would answer true for only 1% of composite inputs? Would we than still say that it solves the problem of testing primality? Or is there some requirement like that a Monte Carlo algorithm has to answer true for more than half the cases?

## How to solve recurrence $T(n) = 5T(\frac{n}{2}) + n^2\lg^2 n$

I have tried solving it using substitution. Apparently, it is exact for some $$n$$ and the order of the general solution can be found from this exact solution.

By substitution I got the following (not sure if it is correct):

$$T(n) = 5^kT(n) + \sum_{i = 0}^{k}{5^{i}\left(\frac{n}{2^{i}}\right)^{2}\lg^{2}\left(\frac{n}{2^{i}}\right)}$$

I am not sure how to proceed from this. I don’t even know if this approach is correct so far. How do I solve this recurrence?

Posted on Categories proxies

## How to solve this using NTT?

I need to find the first N coefficients of $$\prod_{i = 1}^{i = Q}(1 + x^{a_i})^{b_i}$$ modulo a NTT favourable prime. Can someone suggest an algorithm with worst-case complexity $$O(nlogn)$$ or $$O(qlogq)$$? I think this is to be done using NTT but cannot get of an exact method.I tried Divide and Conquer but it is $$O(qnlogn)$$.

Posted on Categories proxiesTags , ,

## I have four variable and four equation how to solve it?

Solve[{w == x + e - Sqrt[(a/m)*(x - y - e)],y == z + f - Sqrt[(z + f)*(x - w + e)], x == w - e + Sqrt[(a/(m - h))*(z - w - e)],z == y - f + Sqrt[(a/s)*(y - f)]} {w, x, y, z}] .  

Here w, x, y and z are variables while others like a, m, e and f are constants.

## How to solve recursion \$T(n)=T(n/2)+T(n/3)+n?

How to solve recursion T(n)=T(n/2)+T(n/3)+n? I do not really know how to approach this kind of recurrence.

Posted on Categories proxies

## Solve boundary value problem with NDSolve. How to print out approximations to a solution?

I solve particular boundary-value-problem for ODE with NDSolve “Shooting” method. The case is that solution is attained very slow, that seems to mean that boundary-value-problem which is supposed to be well-defined enough, in fact, is ill at some place. So i try figure out. First step is to see concrete values of a produced approximations to a solution. What language constructs should i use for that?

Simple example. Suppose we consider particle motion in vertical plane. We throw our particle from initial point with coordinates {x0,y0} := {0,0} and initial trajectory angle 45 degrees. And try to achieve point with coordinates {x1,y1} := {1,0} by varying particle initial velocity. We don’t know two things here: initial velocity and a duration of a motion. Here is how that toy problem can be presented and solved in mathematica:

gravity = 10; bvpsol = NDSolve[     {      {       (* ODE system (5th order) *)       {x''[u] / c[u]^2 == 0,        y''[u] / c[u]^2 == -gravity,        c'[u] == 0},       (* boundary conditions (5 items) *)       {x == y == 0,        x == 1,        y == 0,        x' == y'}       }      }, {x[u], y[u], c[u]}, u,      Method -> {"Shooting",        "StartingInitialConditions" -> {x == y == 0,          x' == y' == 1, c == 1}}] // Flatten;  {dxdu, dydu} = D[{x[u], y[u]} /. bvpsol, u]; {vx0, vy0} = ({dxdu, dydu} / c[u] /. bvpsol) /. {u -> 0}; duration = c[u] /. bvpsol /. {u -> RandomReal[]};  ivpsol = NDSolve[{     (* ODE system *)     {x''[t] == 0, y''[t] == -gravity},     (* initial values *)     {x == y == 0, x' == vx0, y' == vy0}     }, {x[t], y[t]}, {t, 0, duration}];  ParametricPlot[{x[t], y[t]} /. ivpsol, {t, 0, duration},   GridLines -> Automatic, AspectRatio -> 1/2] Question: Now what options or language construct should i use to see approximations which are produced NDSolve while solving boundary-value-problem?

Posted on Categories cheapest proxies

## When does Gaussian elimination solve exact 1-in-3 SAT?

Terms:

A literal is a variable or its negation.

A clause is a set of literals.

An exact 3-in-1 clause is satisfied if an assignment of values to variables results in exactly 1 true literal and 2 false literals.

Exact 3-in-1 SAT is the problem, given a set of exact 3-in-1 clauses, is there as assignment of variables that satisfies all clauses?

Question:

This corresponds to a linear algebra problem, sort of:

Let true be 1 and false be -1.

For each variable v and its negation w, add the equations:

v + w = 0

(This is because 1 + (-1) = 0)

For each exact 3-in-1 clause (a b c), add the equations:

a + b + c = -1

(This is because two -1‘s and one 1 will add up to -1.)

It’s possible solving the equations results in a value other than 1 or -1. However if the solution to the system of equations is only 1 and -1, I suspect that’s a valid solution to the original exact 1-in-3 problem.

So, when does Gaussian elimination solve exact 1-in-3 SAT?

Here’s an example when it does:

These clauses:

(1 2 3) (2 3 -2) (2 3 -3)

Correspond to this matrix:

1, 0, 0, 1, 0, 0, 0 0, 1, 0, 0, 1, 0, 0 0, 0, 1, 0, 0, 1, 0 1, 1, 1, 0, 0, 0, -1 0, 1, 1, 0, 1, 0, -1 0, 1, 1, 0, 0, 1, -1 

Reduced row echelon:

1, 0, 0, 0, 0, 0, 1 0, 1, 0, 0, 0, 0, -1 0, 0, 1, 0, 0, 0, -1 0, 0, 0, 1, 0, 0, -1 0, 0, 0, 0, 1, 0, 1 0, 0, 0, 0, 0, 1, 1 

Therefore solution (via far-right column) is: (1 -2 -3)

Does this always work on larger matrices with 2*n rows and 2*n+1 columns where n is the number of variables? (I think it may need non-redundant (linearly independent?) rows.)

Posted on Categories proxies

## Are any two complexity classes equipped with an oracle to solve the halting problem equivalent?

Equip any complexity class $$C$$ and $$B$$ (to be more specific: any complexity class that contains only standard decidable problems) with an oracle $$O$$ to solve the halting problem. Is $$C^O = B^O$$ for any $$B$$ and $$C$$ that only contain problems decidable by a normal TM (meaning a TM with no access to an oracle (only the empty oracle))?

Posted on Categories proxies

## Is this an LL(1) grammar? How to solve First – Follow conflict?

im trying to check if this grammar is LL(1).

S -> L = R
L -> * L | id
R -> L | R + R | num

As you can see there is a Left recursion on R production. So i remove that and what i get is:

S -> L = R
L -> * L | id
R -> L R’ | num R’
R’ -> + R R’ | ε

Now the problem that i have is that First and Follow set of R’ rule have a common non-terminal (“+”) and also FIRST(R) and FOLLOW(R’) has a common non-terminal. So i wonder how to create the parsing table if there’s this conflict. My question is: is there a way to solve this problem or simply this isn’t an LL(1) grammar?

Thanks.

## How Joint Probability Distributions are used to solve the problem of missing inputs in Classification

With n input variables, we can now obtain all 2^n diﬀerent classiﬁcation functions needed for each possible set of missing inputs, but the computer program needs to learn only a single function describing the joint probability distribution.

This is page 98 of Ian Goodfellow’s Deep Learning Book. My confusion comes from how joint probability distributions are used to solve the problem of missing inputs. What are the random variables in this scenario? I don’t really understand the connection here so if someone could please elaborate that would be great.

Posted on Categories proxies