linear algebra – Solving a system of equations with boolean variables in Z3

I have a problem that reduces to a system of 2n+1 inequalities on 4n variables all in $mathbb{Z}_3$, where the variables are constrained to be in {0,1}, ie:

$x_1 + x_2 + … + x_k equiv a ; mod ; 3$

$x_2 + x_3 + … + x_l equiv b ; mod ; 3$

$x_m + … + x_{4n} equiv c ; mod ; 3$

The right-hand side (a,b,c…) is known, but not necessarily in {0,1} but in {0,1,2}.

I have found no better way of solving this than a brute-force approach, because doing Gaussian elimination I can get a an upper triangular system, but that would only give me a solution if my variables were in {0,1,2}.

So my question is whether there is a more efficient way to solve this system that I may have missed ?

nt.number theory – Defining set of $r$ bit squares in mixed integer linear programs with fewer than $r$ integer variables

Consider the set $mathcal R(A,b)$ defined by

$$mathcal R(A,b)={zinmathbb Zcap(0,2^r-1):exists(x,y)inmathbb Z^ktimesmathbb R^{2^m} mbox{ such that }A(x,y,z)’leq b}$$
holds where $k=o(r)$, $m=o(r)$, $mk=Omega(r)$, $Ainmathbb Q^{elltimes(k+2^m+1)}$, $binmathbb Q^ell$, $ell=poly(r)$, $log max_{i,j}|A_{ij}|=O(2^{t})$, $log max_{i}|b_i|=O(2^{t})$ and $t=o(r)$ holds.

Is it known
$$mathcal R(A,b)neqmathcal{Sq}_r$$
always holds for any $A,b$ where $mathcal{Sq}_r$ is squares in ${0,1,2,dots,2^r-1}$ ($r$ bit squares)?

Verbally speaking I am asking to define set of square values of $r$ bits it is necessary $k=Omega(r)$.

Is it clear it cannot be defined with a single existential quantifier when we are allowed only $o(r)$ integer variables ($zinmathbb Z^{k}$) in our program and up to $2^{o(r)}$ real variables ($yinmathbb R^{2^m}$) and coefficients have $2^t$ bits with $t=o(r)$ in the program?

Note if $k=r$ then even $m=t=O(log r)$ suffices and so the question is if we reduce number of integer variables then increasing number of real variables cannot be helpful to define squares.

classes – Setters dependent on other instance variables in Java

I am relatively new to java and I am trying to set up a class with non-trivial setters, but I wonder if setting an instance variable via another one is allowed/good practice?

public class Pdf {

    private byte() bytearray;
    private String name;
    private PDDocument pddocument;
    private int lastPage;

    public Pdf() {

    public Pdf(String name, byte() bytearray) {
        super(); = name;
        this.bytearray = bytearray;

    public String getName(String name) {
        return name;

    public void setName(String name) { = name;

    public byte() getBytearray() {
        return bytearray;

    public void setBytearray(byte() bytearray) {
        this.bytearray = bytearray;

    public PDDocument getPddocument() {
        return pddocument;

    public void setPddocument() {
        PDDocument pddocument = null;
        try {
            pddocument = org.apache.pdfbox.pdmodel.PDDocument.load(this.bytearray);
        } catch (IOException e) {
        this.pddocument = pddocument;

    public int getLastPage() {
        return lastPage;

    public void setLastPage() {
        this.lastPage = this.pddocument.getNumberOfPages()-1;
} – Document queryselector-based variables in structured data via GTM keep returning ‘undefined’ in Rich Results Test

I use GTM queryselector variables to populate the JSON-LD structured data on my pages dynamically – or at least I’m trying to. The variables are pulled correctly in GTM preview mode, they render fine in Chrome Console, but they load as ‘undefined’ in Google Rich Results test! Here’s an example:

Custom JS Variable

custom html
Structured Data JavaScript in GTM (custom HTML tag)

Render readout in Console

rich results
Rich Results: undefined

The site ( is on WordPress and I’m wondering if some plugin could be messing with the Googlebot render, or something.

measure theory – Nested conditional expectation and independent random variables

I am facing the following issue:
I have a sequence of iid random variables $X^n$ and a random variable $Y$ that is independent of $X^n$. There is also another random variable (irrelevant for the matter) $W$ also independent of $X^n$ and $Z$.

I have the following expression (assuming this $sup$ is actually measurable wrt $dP_Y$) :
$$mathbb{E}_Y( sup_z( P_{X^n}(f(S,Y,z)>epsilon))).$$
I am getting confused by the fact that $X^n$ is independent of $Y$. In particular, the probability inside is a random variable wrt to $Y$. Hence, I would write it as $mathbb{E}_{X^n}(mathbb{1}_{{…}}|sigma(Y))$ but since they are independent, the conditioning isn’t really there, is it?
Also, if I use some Markov-like inequality (should it be a conditional version?), and say I have the following expression:
$$exp(eta)mathbb{E}_Y( sup_z mathbb{E}_{X^n}(exp(f(S,Y,z))|sigma(Y))),$$
and I want to refine the conditional expectation, do I get the following
$$exp(eta)mathbb{E}_Y( sup_z mathbb{E}_{X^{n-1}}(mathbb{E}_{X_n}(exp(f(S,Y,z))|sigma(X^{n-1}))|sigma(Y)))?$$
Is this then (because of the independent of the sigma-fields/random-variables) equal to:
$$exp(eta)mathbb{E}_Y( sup_z mathbb{E}_{X^{n-1}}(mathbb{E}_{X_n}(exp(f(S,Y,z))|sigma(X^{n-1},Y))))?$$

How do I found the value of any of the variables given two- x and y- within two different equations?

If the first equation is 2x+y=152, and the second is x+2y=100, and it is a fact that both variables are whole numbers and x is larger than y, what is the value of x?

cv.complex variables – Is surjective holomorphic self-map on compact complex manifold finite?

I have already asked this question on stack exchange, but didn’t get any answer.

Let $X$ be a compact connected complex manifold.

Let $f:X to X$ be a surjective holomorphic map then can we say that $f$ is a finite map (i.e., every point has finitely many preimages)?

If $X$ is one dimensional then the answer to the above question is yes. If $X$ is a complex projective space then also answer is yes.

If we don’t assume surjectivity then we can easily construct non constant non finite map (just consider product manifold and $f$ to be projection on one of the coordinates).

I am unable to produce counterexample in the general case. Thanks for any help!

r – After multiplying two variables, how can I filter those products based on the value of the original variables?

I am interested in multiplying subsets of two variables, Z and x in my dataset, but the two subsets are of different lengths so I can’t subset both before multiplying them. How can I filter the product based on the value of the original variables?

Here is a simplified data sample. I want to multiply Z and x, but keep only the products for which Z is greater than the 50th percentile and for which abs(x) is less than 100. My code below generates 10 values for each. There are 5 values for Z > 50th percentile, but only 4 values for abs(x) < 100.

## Create dataframe
Z <- rnorm(10, mean = 5, sd = 1)
x <- rnorm(10, mean = -101, sd = 3) 
df <- data.frame(cbind(Z, x))

## Keep only Z above 50th percentile, multiply by x
Z <- df %>% filter(Z > quantile(Z, 0.5)) %>% select(Z)
Zx <- Z*df$x

Z and Zx are both 5×1.

If I try to filter after obtaining Zx through multiplication, I get the following error message telling me the dimensions are wrong:

Error: Problem with filter() input ..1.
x Input ..1 must be of size 5 or 1, not size 10.
ℹ Input ..1 is abs(df$x) < 100.

How can I achieve this? Thanks for the help.

polyhedra – Size of integer variables around mean in an integer program

Consider the linear integer program

$$underline xinmathbb Z^n$$
$$Aunderline xleq b$$

where number of rows in $A$ is $m$ and number of bits to represent $A$ and $b$ is $L$.

  1. Is there a bound on $|underline x|_infty$?

Denote $x_{mean}$ to be $frac{sum_{i=1}^nunderline x_i}n$.

  1. Is there a bound in $|underline x-x_{mean}|_infty$?

c# – Refactoring a Unity script into two, and reading variables in one from the other

We got this SelectionManager Script from an Asset which allows us to select a building.

We wanted to track if the building is selected and then show a small menu above it. We managed to get it to work, but it was all in the SC_SelectionManager script and we wanted to separate it into two scripts.

So we wrote the micromenuScript which basicly just copied the working code. But we were not able to get the isSelected variable into the micromenuScript.

Can anyone please explain how to access a variable from one script in another?

We tried to get a reference to the selection manager script by calling microMenuScript.Find("_SelectionManager") as shown below, but got the following error:

‘GameObject.Find(string)’ cannot be accessed with an instance reference; qualify it with a type name instead.

I added both scripts.


using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SC_SelectionManager : MonoBehaviour
    public Texture topLeftBorder;
    public Texture bottomLeftBorder;
    public Texture topRightBorder;
    public Texture bottomRightBorder;
    //public GameObject micromenu;
    public bool isSelected;
Texture2D _borderTexture;
Texture2D borderTexture
        if (_borderTexture == null)
            _borderTexture = new Texture2D(1, 1);
            _borderTexture.SetPixel(0, 0, Color.white);

        return _borderTexture;

bool selectionStarted = false;
Vector3 mousePosition1;

public static List<SC_Selectable> selectables = new List<SC_Selectable>();
List<int> selectedObjects = new List<int>();

void Start(){
  isSelected = false;
// Update is called once per frame
void Update()
    // Begin selection
    if (Input.GetMouseButtonDown(0))
        selectionStarted = true;
        mousePosition1 = Input.mousePosition;
    // End selection
    if (Input.GetMouseButtonUp(0))
        selectionStarted = false;
    //Script für die Selection von Objecten
    if (selectionStarted)
        // Detect which Objects are inside selection rectangle
        Camera camera = Camera.main;
        isSelected = false;
        Debug.Log("isSelected auf false gesetzt? =" + isSelected);
        for (int i = 0; i < selectables.Count; i++)
            Bounds viewportBounds = GetViewportBounds(camera, mousePosition1, Input.mousePosition);
            if (viewportBounds.Contains(camera.WorldToViewportPoint(selectables(i).transform.position)))
              isSelected = true;
              Debug.Log("isSelected auf true gesetzt? =" + isSelected);

/*private void Update()
    if (Input.GetMouseButtonDown(0))

void OnGUI()
    if (selectionStarted)
        Rect rect = GetScreenRect(mousePosition1, Input.mousePosition);
        DrawScreenRectBorder(rect, 2, Color.cyan);

    // Draw selection edges
    if(selectedObjects.Count > 0)
        Camera camera = Camera.main;
        for (int i = 0; i < selectedObjects.Count; i++)
            DrawSelectionIndicator(camera, selectables(selectedObjects(i)).GetObjectBounds());

void DrawScreenRectBorder(Rect rect, float thickness, Color color)
    // Top
    DrawBorderRect(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color);
    // Left
    DrawBorderRect(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color);
    // Right
    DrawBorderRect(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color);
    // Bottom
    DrawBorderRect(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color);

void DrawBorderRect(Rect rect, Color color)
    GUI.color = color;
    GUI.DrawTexture(rect, borderTexture);
    GUI.color = Color.white;

Rect GetScreenRect(Vector3 screenPosition1, Vector3 screenPosition2)
    // Move origin from bottom left to top left
    screenPosition1.y = Screen.height - screenPosition1.y;
    screenPosition2.y = Screen.height - screenPosition2.y;
    // Calculate corners
    var topLeft = Vector3.Min(screenPosition1, screenPosition2);
    var bottomRight = Vector3.Max(screenPosition1, screenPosition2);
    // Create Rect
    return Rect.MinMaxRect(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y);

Bounds GetViewportBounds(Camera camera, Vector3 screenPosition1, Vector3 screenPosition2)
    Vector3 v1 = camera.ScreenToViewportPoint(screenPosition1);
    Vector3 v2 = camera.ScreenToViewportPoint(screenPosition2);
    Vector3 min = Vector3.Min(v1, v2);
    Vector3 max = Vector3.Max(v1, v2);
    min.z = camera.nearClipPlane;
    max.z = camera.farClipPlane;

    Bounds bounds = new Bounds();
    bounds.SetMinMax(min, max);
    return bounds;

void DrawSelectionIndicator(Camera camera, Bounds bounds)
    Vector3 boundPoint1 = bounds.min;
    Vector3 boundPoint2 = bounds.max;
    Vector3 boundPoint3 = new Vector3(boundPoint1.x, boundPoint1.y, boundPoint2.z);
    Vector3 boundPoint4 = new Vector3(boundPoint1.x, boundPoint2.y, boundPoint1.z);
    Vector3 boundPoint5 = new Vector3(boundPoint2.x, boundPoint1.y, boundPoint1.z);
    Vector3 boundPoint6 = new Vector3(boundPoint1.x, boundPoint2.y, boundPoint2.z);
    Vector3 boundPoint7 = new Vector3(boundPoint2.x, boundPoint1.y, boundPoint2.z);
    Vector3 boundPoint8 = new Vector3(boundPoint2.x, boundPoint2.y, boundPoint1.z);

    Vector2() screenPoints = new Vector2(8);
    screenPoints(0) = camera.WorldToScreenPoint(boundPoint1);
    screenPoints(1) = camera.WorldToScreenPoint(boundPoint2);
    screenPoints(2) = camera.WorldToScreenPoint(boundPoint3);
    screenPoints(3) = camera.WorldToScreenPoint(boundPoint4);
    screenPoints(4) = camera.WorldToScreenPoint(boundPoint5);
    screenPoints(5) = camera.WorldToScreenPoint(boundPoint6);
    screenPoints(6) = camera.WorldToScreenPoint(boundPoint7);
    screenPoints(7) = camera.WorldToScreenPoint(boundPoint8);

    Vector2 topLeftPosition =;
    Vector2 topRightPosition =;
    Vector2 bottomLeftPosition =;
    Vector2 bottomRightPosition =;

    for (int a = 0; a < screenPoints.Length; a++)
        //Top Left
        if (topLeftPosition.x == 0 || topLeftPosition.x > screenPoints(a).x)
            topLeftPosition.x = screenPoints(a).x;
        if (topLeftPosition.y == 0 || topLeftPosition.y > Screen.height - screenPoints(a).y)
            topLeftPosition.y = Screen.height - screenPoints(a).y;
        //Top Right
        if (topRightPosition.x == 0 || topRightPosition.x < screenPoints(a).x)
            topRightPosition.x = screenPoints(a).x;
        if (topRightPosition.y == 0 || topRightPosition.y > Screen.height - screenPoints(a).y)
            topRightPosition.y = Screen.height - screenPoints(a).y;
        //Bottom Left
        if (bottomLeftPosition.x == 0 || bottomLeftPosition.x > screenPoints(a).x)
            bottomLeftPosition.x = screenPoints(a).x;
        if (bottomLeftPosition.y == 0 || bottomLeftPosition.y < Screen.height - screenPoints(a).y)
            bottomLeftPosition.y = Screen.height - screenPoints(a).y;
        //Bottom Right
        if (bottomRightPosition.x == 0 || bottomRightPosition.x < screenPoints(a).x)
            bottomRightPosition.x = screenPoints(a).x;
        if (bottomRightPosition.y == 0 || bottomRightPosition.y < Screen.height - screenPoints(a).y)
            bottomRightPosition.y = Screen.height - screenPoints(a).y;

    GUI.DrawTexture(new Rect(topLeftPosition.x - 16, topLeftPosition.y - 16, 16, 16), topLeftBorder);
    GUI.DrawTexture(new Rect(topRightPosition.x, topRightPosition.y - 16, 16, 16), topRightBorder);
    GUI.DrawTexture(new Rect(bottomLeftPosition.x - 16, bottomLeftPosition.y, 16, 16), bottomLeftBorder);
    GUI.DrawTexture(new Rect(bottomRightPosition.x, bottomRightPosition.y, 16, 16), bottomRightBorder);

//Methode zum aktivieren des MicroMenues
  /* void activeMenu(bool state)
      if(state == true)




using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class micromenuScript : MonoBehaviour

      //public SC_SelectionManager selectionManager;
      public GameObject micromenu;
      void Start()

      void Update()

      public void menuVisibility()
        if(micromenu.Find("_SelectionManager").GetComponent<SC_SelectionManager>().isSelected == true)

Thanks for your time.

Have great day.