Given a row sum vector and a column sum vector, determine if they can form a boolean matrix

For example, for a boolean matrix of size $ 3×4$ , the row sum vector $ R = (3, 3, 0, 0)$ and the column sum vector $ C = (2, 2, 2)$ form a match because I can construct the boolean matrix:

$ $ \begin{matrix} & \begin{bmatrix} 1 & 1 & 0 & 0\ 1 & 1 & 0 & 0\ 1 & 1 & 0 & 0 \end{bmatrix} & \begin{pmatrix} 2\2\2 \end{pmatrix} = C \ R = &\begin{pmatrix} 2 & 2 & 0 & 0 \end{pmatrix} \end{matrix} $ $

However, the column vector $ C’ = (4, 1, 1)$ doesn’t form a match with $ R$ .

So given two vectors whose values are sorted in descending order $ R_{1, w}$ and $ C_{h, 1}$ , and whose accumulated sum is the same, $ T = \sum_jR[1, j] = \sum_iC[i, 1]$ , how can I polynomically check if $ R$ and $ C$ form a matching because I can form a matrix $ M_{h,w}$ having $ R$ and $ C$ as row and column sum vectors?

More specifically, in case it can help to make the check algorithm faster, in my specific case, R and C has the following properties:

  • $ h \leq w$
  • The number of positive values of $ R$ and $ C$ is $ > w$ . For example, $ R$ , in the example, has two positive values and $ C$ has three positive values, and it happens that $ 2 + 3 > w = 4$ .

How to compute a vector V when N points are given and V satisfies given properties

We are given N points P1,P2,…,PN in a 2D plane(All points are distinct and N is as large as 10^5). For each valid i, the coordinates of the point Pi are (xi,yi). Help me to find a vector V = (a, b) ( where |a|, |b| <= 1e9) such that the following holds:

For each i (1 ≤ i ≤ N), let Si= dot(V, G(Pi, Pi+1)). lets assume PN+1=P1. where G(v1, v2) = ((v2(x) – v1(x)), (v2(y) – v1(y)) and dot(V1, V2) denotes dot product of two vectors

How to choose V such that It is possible to find two integers l and r (1 ≤ l ≤ r ≤ N) such that:

Si < 0 if(i <= r and i >= l) and Si > 0 otherwise

(or)

Si > 0 if(i <= r and i >= l) and Si < 0 otherwise

I need to know if there is a way of choosing vector (a, b) to satisfy the above conditions(If the solution is possible)

find the vector v

Chef John is given N points P1,P2,…,PN in a plane. For each valid i, the coordinates of the point Pi are (xi,yi). Help him find a vector v→=(xv,yv) such that the following holds:

For each i (1≤i≤N), let Si=v→⋅PiPi+1. Here, we define Pn+1=P1. The coordinates xv and yv are integers and |xv|,|yv|≤2⋅109. It is possible to find three integers w, l and r (1≤l≤r≤N) such that: For each i (l≤i≤r), Siw>0. For each other valid i, Siw<0. If there are multiple solutions, you may find any one. If there are no solutions, let’s define xv=yv=0. (Note that the vector v→=(0,0) cannot be a valid solution.)

calculate the flux of a vector field through a surface

How to calculate the flux of a vector field through a surface in mathematica? I’ve this field:

F = (x, x^2 * y, y^2 * z)  

and this surface:

S = { (x,y,z) ∈ R^3 | 2 * Sqrt[x^2+y^2] <= z <= 1 + x^2 + y^2} 

So, I’m trying:

region = ImplicitRegion[2 * Sqrt[x^2+y^2] <= z <= 1 + x^2 + y^2, {x, y, z}];  Integrate[#, {x,y,z} ∈ region]& /@ ({x, x^2 * y, y^2 * z} . {x, y, z}) 

I expect Pi/30 as a result, but it comes out "Infinity"…

Using slot and application to variable length vector

I have a list of 2D coordinates with a maximum length of 3, e.g.

peakdatAB {{1007.81, 8.64842}, {1008.38, 8.19264}} 

I need to generate something like this

({PointSize[0.01], Blue, Point[#1], Red, Point[#2], Black, Point[#3]}) & @@ peakdatAB 

but here the problem is the variable length of peakdatAB as when there is say no third point, it returns an error. How can I fix this?

Solving integral involving absolute value of a vector

I am trying to integrate the following in mathematica:
$ \int_0^r \frac{exp(-k_d(|\vec{r}-\vec{r_j}|+|\vec{r}-\vec{r_i}|)}{|\vec{r}-\vec{r_j}|\times|\vec{r}-\vec{r_i}|}r^2dr$ .
I have first defined, the following functions,
$ \vec p(x,y,z)= (x-x_j)\hat i + (y-y_j)\hat j+(z-z_j)\hat k$
Similarly,
$ \vec q(x,y,z)= (x-x_i)\hat i + (y-y_i)\hat j+(z-z_i)\hat k$ .
And,
$ \vec r(x,y,z)=x\hat i + y\hat j+z\hat k $
Then I clicked the integration symbol in the classroom assistant panel and typed the integrand in the $ expr$ portion. While typing this, I have used $ Abs$ to take modulus of the functions $ \vec p(x,y,z)$ and $ \vec q(x,y,z)$ . I have included the limits as $ 0$ to $ Abs(r)$ and the $ var$ as $ r$ in the integration symbol. But when I press( Shift + Enter ) no output value is shown . Can anyone tell me where I have made mistake ?

Setoolkit phishing website attack vector problems [closed]

I tried to use phishing methods in setoolkit and everything was fine when apache2 started and I was given an IP address to send.

The victim was out of the city and they were not able to open that link and when they clicked it, it started loading but they got "Page not found".

  1. Does phishing only work with the same wifi device connected because only I was able to open that link?

  2. How can I do phishing and send that IP address link to anyone and trap them?

User defined function for creating Row only listing first column of matrix or first element of a vector

I cannot figure out why my rowNameValue[] is only listing the first part of a column or vector. Below is the code.

objectName = Function[Null, SymbolName[Unevaluated[#]], {HoldFirst}]; ClearAll[m, b] m = {{1, 0, -5}, {0, 1, 1}, {0, 0, 0}}; MatrixQ[m] b = {1, 4, 0}; VectorQ[b] rowNameValue[symbol_, name_ : Null] := Block[{id, fn},    id = If[Head[name] === String, name, objectName[symbol],       objectName[symbol]];    id = If[MatrixQ[symbol] || VectorQ[symbol], Style[id, Bold], id,       id];    fn = If[MatrixQ[symbol] || VectorQ[symbol], MatrixForm,       TraditionalForm, StandardForm];    {Row[{id, " \[Rule] "}, " "], Apply[fn, symbol]}    ]; dataIn[m_, b_] = Block[{}, Grid[{     rowNameValue[m, "m"],     rowNameValue[b, "b"]     }]] dataIn[m, b] 

Replacement rules which for elements of a vector which meet conditions

I’m trying to create a function which will replace elements of a list with their values modulo 1, i.e. Mod[x,1], but only if Abs[x]>1. So, for example, the function would yield:

f[{-1.5,-1,0,1}]={.5,-1,0,1}].

I’m trying to do this in an elegant way. For example, I have a function for a related purpose:

C1[v_] := v /. _?Negative -> 0;.

This replaces negative elements of a list with 0, and it’s very clean.

I’d like to do something similar. My efforts so far have included breaking it into two functions:

CLim[x_] := Mod[x, 1] /; Abs[x] > 1;

C2[v_] := CQubitLim /@ v; But then, when I apply C2 to a list, it only seems to apply on some elements, for example

C2[{1,0,1.5}]={Clim[1],CLim[0],0.5}

My other idea was to use a conditional rule

v:>Mod[v,1]/;Abs[v]>1

But this doesn’t seem to evaluate when I put a vector through it.

Any ideas much appreciated.