## Showing \$NP\$ is closed under intersection

I was solving the fallowing question :

Show that $$L_1 cap L_2 in NP$$ for $$L_1,L_2 in NP$$.

I came a cross this solution on the internet which is :

M : on input w

1. run $$M_1$$ on $$w$$ if $$M_1$$ reject then REJECT
2. Else run $$M_2$$ on w if $$M_2$$ reject then REJECT
3. Else ACCEPT

But is it the proof true ? Are we allowed to state "if M_1 reject then do something" knowing $$M_1$$ is non-deterministic machine ?
maybe the fallowing could be a correct solution

M : on input w

1. run $$M_1$$ on $$w$$ if it accept then run $$M_2$$ on $$w$$ if it accept then ACCEPT.

## graphics3d – Where is wrong in this code to plot intersection of a plane and a sphere?

I am trying to plot the circle is intersection of the sphere with center `O(0,0,0)` and radius `R` and the plane `z = h`. I tried

``````R = 4;
h = R - 5;
p = {0, 0, h};
v = {0, 0, 1};
sph = Sphere({0, 0, 0}, R);
hp = Hyperplane(p, v);
reg = RegionIntersection(sph, hp);
Graphics3D({{Opacity(.5), sph}, {Opacity(.5), hp}, {Opacity(.5),
reg}}, Boxed -> False)
``````

I cannot get the result. How can I get correct result?

## programming – How to use Intersection[] but keep the original list order

One way to keep the order in `l1` is this:

``````l1 = {"qwe", "abc", "abb", "aba", "ddd"};
l2 = {"abc", "abd", "aba", "qwe"};
Select[l1, MemberQ[l2, #] &]//InputForm
``````

which evaluates to `{"qwe", "abc", "aba"}`. The
`Select` function has been in Mathematica since
version 1.0, otherwise the alternative
`Map[If[MemberQ[l2, #], #, Nothing] &, l1]`
does the same thing. A variant is
`Reap[If[MemberQ[l2, #], Sow[#]] & /@ l1][[2, 1]]`.

## How to plot a point in the intersection of two functions?

I’m trying to plot the intersection of a Sum function with a horizontal line and automatically highlight the intersection points.
The code below shows my knowledge of Mathematica and for different values of “d” I am calculating with Solve the intersection points (ex p1,p2 and p3) and manually typing the value in the Epilog option. I tried Point({p1,1}) but it doesn’t work. I also tried it with MeshFunctions -> {g(#) – f(#) &}, Mesh -> {{0}}, MeshStyle ->
PointSize(Large) but I get an error “functions must be pure functions”. I would also like to be able to define the ranges of “d” and “pc” as {d, {min,max,incr}} instead of a list.

``````np = 2
f(pc_) := 1
q(d_, pc_) := (pc/(100*0.48)) *
Sum(((Pi/4)*(d - (2*n*0.48))^2), {n, 1, np})
p(d_) := Sum(Pi*(d - (2*n - 1)*0.48), {n, 1, np})
p1 = Solve(q(20, pc)/p(20) == f(pc), pc)
p2 = Solve(q(10, pc)/p(10) == f(pc), pc)
p3 = Solve(q(8, pc)/p(8) == f(pc), pc)
g(d_, pc_) := q(d, pc)/p(d)
Plot({Evaluate(Table(g(d, pc), {d, {8, 10, 20}})), f(pc)}, {pc, 0,
50}, PlotRange -> All, AxesLabel -> {"%", "li/lp"},
FrameLabel -> {Style("pc", 12, Bold), Style("li/lp", 12, Bold)},
PlotLabels -> {"d=8", "d=10", "d=20"}, PlotTheme -> "Scientific",
GridLines -> Automatic, PlotLabel -> "Razão comprimentos",
Epilog -> {PointSize(0.02), Point({10.6053, 1}), Point({23.6134, 1}),
Point({31.2426, 1})})
``````

## analytic geometry – Intersection of a circle and sphere with the equations

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

## geometry – intersection between box and convex set

I have a task to make an intersection between the convex set and the box , the equation describing the convex set is r1r2r3 – r1 -r2 – r3 + 2 cos(phi) > 0, phi = 45 ,and I plot it using
p2 = ContourPlot3D(xyz – x – y – z + 2*Cos(45) == 0, {x, 0, 4}, {y, 0, 4}, {z, 0, 4}).
but , I have no idea how to plot the box and how to make the intersection between them to obtain the figure (b). note that to plot the box r1=3.7, r2=1.3 , r3=3. can anyone help me?

## functional analysis – Equivalent norms in the intersection

Let $$V$$ be a vector space. Two norms $$|cdot |_1,|cdot |_2: V longrightarrow mathbb{R}$$ in $$V$$ are said equivalent if there exists $$a,b>0$$ such that
$$a|u|_1 leq |u|_2 leq b |u|_1,; forall ; u in V.$$

Now,, consider $$X=(X, |cdot|_X)$$ and $$Y=(Y, |cdot|_Y)$$ two normed spaces. It is easy to show that $$Z:= X cap Y$$ is a normed space with norm $$|cdot|_Z: Z longrightarrow mathbb{R}$$ given by
$$|u|_Z=|u|_X+|u|_Y,; forall ; u in Z.$$

Question. If, for some some $$alpha, beta>0$$, we consider $${rm N}: Z longrightarrow mathbb{R}$$ as
$${rm N}(u)=alpha |u|_X +beta |u|_Y,; forall ; u in Z$$
then $${rm N}$$ defines a equivalent norm (in $$Z$$) with respect the norm $$|cdot|_Z$$?

I don’t see, for instance, how to prove that
$$alpha |u|_X +beta |u|_Y leq gamma( |u|_X + |u|_Y),; forall ; u in Z tag{1}$$
for some $$gamma>0$$. Can I to use some property of $$max$$ or $$min$$? Or, can I only prove $$(2)$$ instead of the equivalence of norms? The equivalence is more stronger than $$(2)$$.

## intersection between box and convex set

I try to make intersection between the box and the convex set, actually I plot the convex set but I don’t know how to plot the box in the same coordinates. is any one have an idea?

## Intersection of convex hulls of roots over all primitives of a polynomial

Let $$p=sum_{i=0}^dc_i z^i$$ be a polynomial with complex coefficients and let
$$P_a=a+sum_{i=0}^d c_ifrac{z^{i+1}}{i+1}$$ be the primitive of $$p$$ with constant coefficient $$a$$ in $$mathbb C$$.

We denote by $$mathcal R_a={sum _{i=1}^{d+1}t_irho(a)_i,0leq t_1,ldots,t_{d+1}leq 1=sum_{i=1}^{d+1}t_i}$$ the subset of $$mathbb C$$ obtained by
considering the convex hull of all $$d+1$$ (not necessarily distinct) complex roots
$$rho(a)_1,ldots,rho(a)_{d+1}$$ of the polynomial $$P_a$$. Since the convex hull of
roots of a polynomial $$Q$$ contains all roots of the derived polynomial $$Q’$$,
the intersection $$tilde{mathcal R}=bigcap_{ainmathbb C} mathcal R_a$$ is a compact convex set containing the convex hull $$mathcal R’$$ of all roots of $$p$$.

I believe that the convex set $$tilde{mathcal R}$$ is an interesting object naturally
associated to polynomials. Has it been studied?

A few natural questions concerning $$tilde{mathcal R}$$ are:

1. What is its shape?

(Partial answer: It is a segment if and only if $$p$$ is the derivative of a polynomial with aligned roots. This should imply $$tilde{mathcal R}=mathcal R’$$ (with equality
only in this case). In the general case, I guess that $$tilde{mathcal R}$$ is somewhat Reuleux shaped with corners exactly
on extremal roots (defining vertices of $$mathcal R’$$) of $$p$$ and corresponding to
primitives $$P_a$$ of $$p$$ with double roots on corners of $$mathcal R’$$.

1. (In the non-segment case:) The boundary $$partialtilde{mathcal R}$$ of $$tilde{mathcal R}$$ should correspond to parameters $$a$$ forming a simple closed curve in the parameter space.
The boundary curve $$partialtilde{mathcal R}$$ and the associated parameter curve
are probably given by piecewise analytic maps from real intervals into $$mathbb C$$.

2. Computational aspects? I ignore how to construct these objects concretely:
Smoth (curved) parts of $$partialtilde{mathcal R}$$ should correspond to the envelope of pairs of roots $$rho,sigma$$ “ending respectively at two adjacent vertices of $$mathcal P’$$” and corresponding to parameters $$a$$ given respectively by $$a=-P_0(rho)$$ and $$a=-P_0(sigma)$$ at endpoints. I ignore however the shape of the parameter curve joining these endpoints (I guess it is to naive to hope for an affine segment, envelopes of affine segments are however probably reasonably easy to compute and define
boundary components of a convex set (probably strictly) containing $$tilde{mathcal R}$$.)

3. Can the area ratio (or length-ratio) of $$tilde{mathcal R}$$ and $$mathcal R’$$ become arbitrarily large (perhaps even for polynomials of a fixed degree). (The answer is “no” in degree $$1$$ and $$2$$ (where everyting is given by segments).)
The answer to this question is perhaps easy: It is certainly unbounded if there exists
$$p$$ such that the convex hull
$$mathcal R’$$ of roots of $$p$$ is segment and $$tilde{mathcal R}$$ has non-empty interior.
(I did not search but I believe such polynomials exist.)

## dnd 5e – When casting a cube spell on a hex grid do you pick a honeycomb for origin or an intersection for origin?

I would answer this from the effect it has on the game. i.e. what is the number of squares (effectively creatures) that this spell affects? For squares, it’s 36 squares (more for cube, but stay 2-D for now) So, pick a group of hexes, and count out 36 of them, keeping the shape roughly square-shaped. Done and done.

From there, you have two options, define the exact shape of the effect right then and there, and always use it exactly, or, allow the caster to subtly manipulate the ‘leftover’ hexes as he casts it.

In your specific example, choose either a row of 5+row of 6 +5+6+5+6 and you have a squarish shape of 33 hexes, and you can start a 7th row with the leftover 3 hexes, or you could define the shape as 6 rows of 6 and be more rectangular.