## probability – Show that {I_k} is a sequence of independent random variables et {I_k}∼Ber(1/k)? (Q 2.2)

$$1$$-Objectives :

We provide for every student a dataplay. i.e., a vector $$(X_1;…;X_{500})inmathbb{R}^{500}$$.
This vector is the realization of a 500-sample $$(X_1;…;X_{500})$$ of a random variable X whose law of probability is unknown.We denote by f the probability density of X with respect to the Lebesgue measure on $$mathbb{R}$$ and F its distribution function.
The purpose of this project is twofold. On the one hand, it is a question of becoming familiar with the software R, and on the other hand, of finding the probability law of X from the observations $$(x_1;…; x_{500})$$.
We first assume that the probability law of X belongs to a set of classical probability laws whose list is given below with their codes on R.
$$2$$– Questions :
All the classical laws proposed above are parametric. In other words, f depends on a parameter $$theta$$. Exemple pour la loi de Pareto: $$theta$$ =(m,s), $$f_{Pareto}(x;θ) = frac{s}{m(s−1)}(1+frac{x}{m(s−1)})^{−s−1}$$.

Question 1: Décrire vos données par une simple statistique descriptive (on résumera
les résultats dans un seul tableau). Commentez

Question 2 : Let $${Y_{k}}_{kgeq 1}$$ be the sequence defined by $$Y_k = X_{L(k)}$$ with $$L(1) = 1$$ ; L(k + 1) = min{$$j : j > L(k); X_{j} > X_{L(k)}$$}; $$kgeq1:$$
So define the sequences of the v.a.r $${I_{k}}_{kgeq1}$$ et $${N_{n}}_{ngeq1}$$ with $$I_1=1$$ p.s
$$I_k=mathbb{1}_{{X_k > max(X_1;…;X_{k-1})}}, kgeq 2; et N_n=sum_{k=1}^{n}I_k$$.

Q2.1 : Propose a code on R which calculates respectively $${L_{k}} , {Y_{k}}$$ et $$N_n$$ for a
sample given $$(X_1;…;X_{n})$$. Apply this code to your data.
answer 2.1 : enter image description here enter image description here

Q2.2 : Show that $${I_{k}}$$ is a sequence of independent random variables et $${I_{k}}simmathbb{B}er(1/k)$$.

Q2.3 : Justify why, when $$ntoinfty$$ , $$N_n /log{n}xrightarrow{p.s} 1$$ et $$(N_n-log{n})/sqrt{log{n}}xrightarrow{mathcal{L}}mathcal{N}(0,1)$$

## interpolation – Numerical integration of a function with several variables

I need to calculate the next integral

$$F_l(R)=int_0^{infty} {dk k^2j_l(k R)*2*exp(-0.36k^2)(k)rho_l(k)(18/k^2)P_l(cos{beta})}$$

where A, B, C are constants and ρl(k) is given by

$$rho_l(k)=int_{0}^{infty}{dr r^2 j_l(k r)left(int_{0}^{pi}{2pirho(r,theta)Y_{l0}(theta)sin{theta}dtheta}right)}$$

At the same time ρ(r,θ) is given by

$$rho(r,theta)=rho_0/(1+exp((r-1.07Ad^{1/3}(1+b_2Y_{20}(theta)+b_4Y_{40}(theta)))/0.54)$$

In order to calculate this integral I put everything in a single function and the integrate all variables θ, r and k for given value of l

``````fcd(R_, k_, r_, th_, Ad_, Zd_, b2_, b4_, l_) :=
k^2*SphericalBesselJ(l, k R)*(2*Exp(-0.36^2))*
(18/k^2)*(2 Pi*r^2*SphericalBesselJ(l, k r)*
Ddcd(r, Ad, Zd, th, b2, b4))*SphericalHarmonicY(l, 0, th, 0)*
Sin(th)
``````

Where Ddcd(r, Ad, Zd, th, b2, b4) is given by

``````Ddcd(r_, th_, Ad_, Zd_, b2_, b4_) := Zd/(NIntegrate(
2 Pi *r^2* fd(r, th, Ad, b2, b4)*Sin(th), {r, 0, Infinity}, {th, 0, Pi}, Method -> {Automatic,
b2, b4)
``````

where the function fd(r, th, Ad, b2, b4) is

``````fd(r_, th_, Ad_, b2_, b4_) := 1/(1 + Exp((r - Rd(th, Ad, b2, b4))/0.54))
``````

and finally

``````Rd(th_, Ad_, b2_, b4_) := 1.07 Ad^(1/3)(1 + b2*SphericalHarmonicY(2,0, th,0)+b4*SphericalHarmonicY(4,
0, th, 0))
``````

In all equations Ad=178, Zd=80, b2=-0.113 and b4=-0.026; the angle β can be 0 or Pi/2. The integral I am trying to calculate is given by the code

``````FR0(R_, Ad_, Zd_, b2_, b4_, l_) =
Interpolation(
Table({R,
NIntegrate(
fcd(R, k, r, th ,Ad ,Zd ,b2 ,b4 ,l), {k, 0, Infinity}, {r, 0, Infinity}, {th, 0, Pi}, Method ->
{Automatic, "SymbolicProcessing" -> 0}, PrecisionGoal -> 3, AccuracyGoal -> 2)}, {R, 0.01, 40, 0.1}))
(R)
``````

My problem is the integrals for l=0,2,4 are taking a lot of time (hours). How can I make the calculations faster ? Is there anyway to modify the integral so the calculations are faster ?Thank you in advance

## consistency – Regression with “error in variables”

Suppose that there is a deterministic relation $$y_t=ax_t$$ where $$x_t,y_t$$ are real sequences or real functions and $$a$$ a constant.
But only $$X_t=x_t+e_t/a$$ and $$Y_t+u_t$$ can be observed, with $$e_t, u_t$$ being zero mean i.i.d. random variables.

How can I estimate the parameter $$a$$ using $$X_t$$ and $$Y_t$$?

I looks simple, but when setting a linear regression model:
$$Y_t=beta X_t+v_t$$
the error is given by $$v_t=y_t-beta x_t+u_t-beta e_t/a$$. It doesn’t look good for a least squares problem and may cause inconsistency. What approach could I take to obtain reasonable estimates for $$a$$?

## python – Are set values faster than using variables

Using variables more convenient when values like MARGIN need to be changed

``````pygame.draw.line(screen, WHITE, (x - MARGIN, y - MARGIN), (x + TILESIZE, y - MARGIN), MARGIN)
pygame.draw.line(screen, WHITE, (x - MARGIN, y + TILESIZE), (x + TILESIZE, y + TILESIZE), MARGIN)
pygame.draw.line(screen, WHITE, (x - MARGIN, y - MARGIN), (x - MARGIN, y + TILESIZE), MARGIN)
pygame.draw.line(screen, WHITE, (x + TILESIZE, y - MARGIN), (x + TILESIZE, y + TILESIZE), MARGIN)
``````

But if they were already set, would it be faster to do:

``````pygame.draw.line(screen, WHITE, (x - 1, y - 1), (x + 20, y - 1), 1)#Top
pygame.draw.line(screen, WHITE, (x - 1, y + 20), (x + 20, y + 20), 1)#Bottom
pygame.draw.line(screen, WHITE, (x - 1, y - 1), (x - 1, y + 20), 1)#Left
pygame.draw.line(screen, WHITE, (x + 20, y - 1), (x + 20, y + 20), 1)#Right
``````

## automator – Applescript variables won’t change

I am new to automator, and was trying out some commands with applescript. I was trying to open terminals at folders with quick actions and run some aliased shell commands on them:

``````#get Path variable

tell application "Finder"
set dir to (quoted form of POSIX path of (target of window 1 as alias))
tell application "Terminal"
reopen
activate
do script "clear" in window 1
do script "exec zsh" in window 1
do script "cd " & dir in window 1
do script "newdir " & dir in window 1 #a custom command
end tell
end tell
``````

But the thing is, `dir` seemed to persist after every time I run the command, even on different folders. I can never quite seem to change it when I activate it on different folders. What am I missing here?

## analysis – Integration over multiple variables

Consider the variables $$H$$ and $$M$$ which make up the following integral:
begin{align} int_{H_1+M_1}^{H_2+M_2} Hd(H +M) &=int_{H_1}^{H_2} HdH+int_{M_1}^{M_2} HdM \ &= frac{H^2}{2}Big|_{H_1}^{H_2}+HMBig|_{M_1}^{M_2}\ &=frac{H_2^2}{2}-frac{H_1^2}{2}+HM_2-HM_1 end{align}
However, I am not sure about the solution as I do not know what to insert for $$H$$?

## Setting global variables with macOS Catalina

I use the `environment.plist` method to setup global variables in macOS.
I have this template in `~/Library/LaunchAgents`

``````<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>setenv.XDG</string>
<key>Program</key>
<string>/bin/zsh</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>-c</string>
<string>
launchctl setenv FOO BAR;
</string>
</array>
<true/>
</dict>
</plist>
``````

It works.

But: when I restart my computer, I need to open `Terminal.app` and close it at least once or the variables will not be available to GUI apps.

Question 1: how shall I change that setup to skip opening Terminal.app after a reboot?

Also, I have noticed that the command
`launchctl setenv FOO BAR` does not work in `iTerm` but only in `Terminal.app`.

Question 2: why is that? Is it related to the fact that `Terminal.app` gives you a login shell by default?

## How to use Toggle Field Code to halve the "PAGE" & "NUMPAGES" variables – (Microsoft Word)

I want to have my footer count every second page

(so that when I print doubled sided paper, each sheet of paper will be counted as 1 page)

_

Normally page footers would look like; page 1, page 2, page 3, page 4, page 5

I have different odd and even footers so mine looks like; page 1, page 3, page 5

I want my footers to increment every 2nd page and look like; page 1, page 2, page 3

_

I was hoping that if I entered "Page {={PAGE/2}} of {={NUMPAGES/2}}" into the footer it would work but I can’t seem to get around syntax errors or bookmark undefined errors.

## including and passing variables with php wordpress

I am using WordPress for my clients to log into the site, put data in a customized table and save it in a database table.
Through the code “example” that I put in funtions.php theme I can return my email at the top of the screen. Code below.

``````\$ current_user = wp_get_current_user ();
\$ logado1 = \$ current_user-> user_email;
echo \$ logged1;
``````

however through a new blank page I can put the HTML to make it work correctly, including with the css via plugin.
But I can’t include the php on the page is to retrieve the data from the \$ logado1 variable contained in theme / funtions.php.
Well, I need to retrieve the data from “\$ logado1 email”, and forward it to a next php referenced in.

``````<form action=" http://localhost/newphp.php" method="post">.
``````

do the treatment and save it in a new table in the “registration” database.

``````<div class = "divsearch">
<form action=" http://localhost/newphp.php" method="post">
<label class = "textout"> <b> Port 1 </b> </label>
<input type = "text" class = "box1">
<label class = "textout"> <b> Port 2 </b> </label>
<input type = "text" class = "box1">
</form>
<button type = "submit" class = "buttonacept1"> Save </button>
</div>
``````

Does anyone have any solution for this problem ?.

## c++ – ¿Las variables de una función ocupan un espacio en memoria?

Cuando declaro un entero ocupa un espacio en la memoria cuando declaro una funcion, ¿los valores tambien ocupan un espacio? como el ejemplo de abajo

``````#include <iostream>
using namespace std;

void cambiarPor6(int &n){//¿la variable n ocupa un espacio en memoria?
n = 6;
}

void cambiarPor7(int n){//¿la variable n ocupa un espacio en memoria?
n = 7;
}

int main(){

int num1 = 5;

cambiarPor6(num1);

cout<<num1;

return 0;
}
``````