## Decomposing the mutual information between conditionally independent variables and the conditioning variable?

Assume X and Y are conditionally independent given Z:
$$P(X,Y|Z)=P(X|Z)P(Y|Z)$$.

We are interested in the mutual information between P(X,Y) and P(Z): $$I(X,Y;Z)$$. Can we decompose this mutual information into two components reflecting the contribution of $$X$$ and $$Y$$ separately?

What I have tried:

$$I(X,Y;Z)=H(X,Y)-H(X,Y|Z)=H(X,Y)-H(X|Z)-H(Y|Z)$$

The second equality is due to the additivity of entropies of independent variables (it holds for each $$z$$). I am left with $$H(X,Y)$$ which doesn’t easily decompose ($$X$$ and $$Y$$ are not necessarily indepedent when not conditioned on Z).

Note: this question is superficially very similar to this one, but it is not equivalent to it.

## probability – Binomial Random Variable Task

I have a question regarding probability and statistics…

A certain Friday evening 1% of the car drivers are intoxicated.
a) At a road check 50 drivers are tested. Compute the probability
that at least one intoxicated driver is caught.
b) At a road check drivers are tested. Let X be the number of tested
drivers when the first intoxicated driver is caught. Compute the
expected number E(X) and the standard deviation SD(X).

I wanted to try and use the following method:

X binomial random variable: X ~ Binomial (n, p)
where n is the number of trials (50) and p = P(success)

So for task a) we have p = 1/100, n = 50, P(X>=1)=1-P(X=0)=1-binomial(50,0) * (1/100)^0 * (1-1/100)^50

How can I calculate this? It seems a bit confusing to me so I’d really appreciate the help

## c# – Como pasar una variable de un formulario a otro en WPF

Necesito pasar una variable de un formulario wpf a otro, he intentado lo siguiente

Form1:

``````            DocenteBE _doc = new DocenteBE();
_doc.Usuario = txtUsuario.Text;

if(docBL.ValidarAcceso(_doc))
{
MainWindow MW = new MainWindow(_doc.Id);
MW.ShowDialog();
this.Close();

}
``````

Form2:

``````public MainWindow(int ID)
{
InitializeComponent();

string pId = Convert.ToString(ID);
this.labelID.Content = pId;
``````

introducir el código aquí

Perdonen mi ignorancia, estoy empezando en la programación y es la primera vez que trabajo en WPf

## go – Why can we assign a struct pointer to an interface variable even though the struct pointer does not implement the interface?

I present two programs below: program 1 and program 2.

I expect program 1 to fail to compile and it indeed fails to compile. So that’s good.

I expect program 2 to fail to compile but it succeeds! This question is about why program 2 succeeds.

### Program 1

https://play.golang.org/p/qX9nY8VLlx0

``````package main

import (
"fmt"
"math"
)

type Abser interface {
Abs() float64
}

type Vertex struct {
X float64
Y float64
}

func (v *Vertex) Abs() float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

func main() {
var a Abser

a = Vertex{3, 4}
fmt.Println(a.Abs())
}
``````

This fails to compile with this error:

``````./prog.go:24:4: cannot use Vertex literal (type Vertex) as type Abser in assignment:
Vertex does not implement Abser (Abs method has pointer receiver)
``````

I was expecting this error because `*Vertex` implements `Abser` but `Vertex` does not, so we cannot assign a `Vertex` object to an `Abser` variable.

### Program 2

https://play.golang.org/p/4bIs-fHGhYm

``````package main

import (
"fmt"
"math"
)

type Abser interface {
Abs() float64
}

type Vertex struct {
X float64
Y float64
}

func (v Vertex) Abs() float64 {
return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

func main() {
var a Abser

a = &Vertex{3, 4}
fmt.Println(a.Abs())
}
``````

This compiles successfully. The output of the program is:

``````5
``````

Why did this succeed? Here, `Vertex` implements `Abser` but `*Vertex` does not implement `Abser`. How am I then able to assign a value of type `*Vertex` to `Abser`?

What are the language semantic rules I need to understand to know why this succeeds?

## ¿Como puedo activar una "function", dentro de otra "function" con una variable?

Quisiera activar una Función dentro de otra Función con una variable… dependiendo de la variable activaría la otra función. ¿Como se puede hacer?

``````function mifuncionbase(){
numvar = e.target.href.split("/").pop(); //aqui recibo un numero del 1 al 10 de un href
miotrafuncion+numvar();
}//me gustaria que mifuncionbase active mis otras funciones

function miotrafuncion1(){
}

function miotrafuncion2(){
}``````

con una variable recibida:

## How to pass query string containing variable names into mysql stored procedure

I have this procedure into which I need to pass variable parameters. Problem is this: once inside the procedure, the `IN` parameter needs to pick up already created variables in order to create the final query.

``````DELIMITER \$\$
DROP PROCEDURE IF EXISTS MY_PROCEDURE \$\$
CREATE PROCEDURE MY_PROCEDURE (
IN sql_string TEXT
)
BEGIN
SET @q1 := "SELECT * FROM table1";
SET @q2 := "SELECT * FROM table2";

-- capturing the string of the query from input
SET @sql = sql_string;
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

END\$\$
DELIMITER ;

-- calling the procedure
call MY_PROCEDURE('CONCAT(@q1, " WHERE id1 < 10")');
call MY_PROCEDURE('CONCAT(@q1, " WHERE id1 < 10", " UNION ", @q2, " WHERE id2 < 10")');
``````

No matter what I’ve tried, supplying the `@` variable with the `IN` string results in a syntax error.

I have considered that having 2 groups of `PREPARE` might do the trick:
First PREPARE converts the `IN` string to actual query by expanding variables, only return the string (Is this even possible???);
Second PREPARE then runs the query on the expanded string.

Phew!!! Any help?

## Llamar variable de archivo desde clase que incluya archivo PHP

tengo un problema que no puedo solucionar
Tengo un archivo de conexion a base de datos, un archivo php con variables
y tengo otro archivo que es una clase, en el archivo que tiene la clase hago un include de el archivo de conexión, pero no me llega el contenido de la variable, me marca nulo

``````include_once("conexion.inc");

class ejemplo
{

public function ejemplo()
{
return \$escape;
}

}
``````

y este es el archivo de conexion, para ejemplo de mostrar la prueba hice una variable asignandole el valor de 6

``````<?
\$escape = 6;

?>

Alguien podria ayudarme a saber que es lo que estoy haciendo mal? he investigado en internet pero no he podido resolverlo
``````

## Nginx – How to add a Map Variable to a String

I have below configuration in my nginx.conf, however, for some reason, it doesn’t recognise the \$site_name as a variable

``````map \$host \$site_name {
default example.com;
}
error_log  /var/www/vhosts/{\$site_name}/httpdocs/var/logs/nginx/error.log error;
``````

The error I get is

``````nginx: (emerg) open() "/var/www/"\$site_name"/httpdocs/var/logs/nginx/error.log" failed (2: No such...irectory)
``````

## I need to update a longblob value in the variable table using variable_set

This would be in an install file in a module. The purpose is to create setting for a module that is already installed (the module is node_revision_delete). I know how to use variable_set to change a value in the variable table but not when it is longblob. Do I just use the variables from the module? Do you know of any examples I could look at?

## mathematical optimization – Maximize an expression with respect to a variable and minimize it with respect to other variables

I started to use Mathematica a few time ago. I want to minimize the following expression (function of $$l,p,q,r,c$$) with respect to variables $$l, p, q, r$$ and then maximize the result obtained with respect to variable $$c$$. However, when I try to obtain an expression function of $$c$$ to maximize later using Minimize, I do not get any result because it takes too long. How can I solve this issue?

``````Minimize({(((l^2/2)*(1-(1/4-c))+(l*p)*(1-1/4)+(l*q)*(1-(1/4+c))+(l*r)*(1-1/2)+(p^2/2)*(1-c)+(p*q)*(1-2*c)+(p*r)*(1-(1/4+c))+(q^2/2)*(1-c)+(q*r)*(1-1/4)+(r^2/2)*(1-(1/4-c)))/((l^2/2)*(1-(1/4-c))+(l*p)*(1-1/4)+(l*q)*(1-(1/4-c))+(l*r)*(1-0)+(p^2/2)*(1-c)+(p*q)*(1-(1/4-c))+(p*r)*(1-0)+(q^2/2)*(1-(1/4-c))+(q*r)*(1-1/4)+(r^2/2)*(1-0))), l >= 1, p >= 0, q >= 0, r >= 0, l + p + q + r == 1000000, 1/7<c<1/5}, {l, p, q, r})
``````