algebra precalculus – Deriving a general expression for the coefficient of $a_{n-2}$, given the roots of the equation are $(alpha)_k$ for k = 1,2,3…

I am self-studying Mathematical Methods for Physics using the book ‘Mathematical Methods for Physics and Engineering : A Comprehensive Guide’ by Riley.

For $ f(x) = a_nx^n + a_{n-1}x^{n-1} + … + a_1x +a_0
= a_n(x-alpha_1)(x-alpha_2)…(x-alpha_n)$

they derived a general expression for the coefficient of $x^{n-2}$ using summations.

How does one derive an expression for the $x^{n-2}$ from first principles and are there similar expressions that can be derived for the coefficients of $x^{n-k}$ for k = 3,4,5…?

calculus – Deriving logistic growth equation from the exponential

I’m following along with this: https://jdyeakel.github.io/teaching/ecology/section9/ and I just want to make sure my derivation is correct since this website seems to use prime notation not for derivatives, but for different values. (And that really took me an embarrassingly long time to figure out)

So, it’s as if we start off with exponential growth $frac{dN}{dt}=kN$ and then, for small population $N$, $k=b_0 – d_0$ (where those $0$‘s are the initial values, or y-intercepts).

So the equation becomes $frac{dN}{dt}=(b_0 – d_0)N$ but then, as population increases, we don’t want constant values, but linear equations $b$ and $d$. And these linear equations are are $b_0 -aN$ and $d_0 + cN$

Now we’d get $frac{dN}{dt}=((b_0 -aN) – (d_0 + cN))N$

So I guess my question is “is this how you make the connection between exponential growth and logistic growth”? Do we start with one and then build the other one on top of it, or should it be derived in a completely different way. In other words:

  • Do we start with exponential and then convert it into logistic

  • Do we start with constants for birth and death rate and then make them into lines

  • Do we start with the assumption things aren’t density-dependent, and then make it so that it is

Deriving the Mean Squared Error of an Estimator, where the estimator is the maximum order statistic.

I am confused as to how I can go about computing the MSE in the problem attached. I am able to proceed with a lot of the steps, but get stuck when it is time to do the actual computations.

enter image description here

private key – HD Wallet with BIP44 – workaround of deriving public keys knowing only a xpub

My goal: I don’t want to require a private key to hierarchically derive new addresses.

Sure, I can create a batch of addresses, given a private key, at first. But once I have surpassed that batch I’ll require the private key again to generate more addresses.

I want to derive addresses knowing only a public key. I know this is possible with BIP39, but understand there can be security concerns involved with this, ie. if an attacker stumbles upon an xpub and xprv they can derive as many addresses as they want and be able to sign transactions using them.

Attempting to derive from a HD public key with BIP44 results in a exception stating a hardened path requires a HD private key. However, I have found a workaround, but I fear it is cheating and might sacrifice the benefits of path hardening in BIP44.

Here’s an example:

// It starts off with a `userCode` that represents a BIP39 Mnemonic code.
const codeUser = new Mnemonic('select scout crash enforce riot rival spring whale hollow radar rule sentence')

// Convert to HD private key...
const hdUserPrivateKey = codeUser.toHDPrivateKey()

console.log(hdUserPrivateKey.hdPublicKey.toString())
// Gives: `xpub661MyMwAqRbcEngoXGfFNahZ5FzSDGqY8pWKTqo6vtXxK15otDNLXJmbeHV7DUjvPc7CAFhYp6hzBiTanr8rgoHPHf6NSgZAyejK5bk8MiW`
// But we won't use it...

// Instead, I can then derive a BIP44 without the `change`, `address_index` segments from `hdUserPrivateKey`...
console.log(hdUserPrivateKey.deriveChild(`m/44'/0'/0'`).hdPublicKey.toString())
// Gives: `xpub6CsrEMgU2f8uEGfFMvsPjKB9ekHuZiesLqSHLwCJuNFkP2uJGm7WjTo2gy95S4KEBc4etdodNQXAvn5Vsf4kupJQ1DKR4DMfcHwKdhQ3k6h`
// This is the xpub I can use to derive addresses without requiring the initial private key.

// So knowing this, I can build a HD public key given that xpub...
const hdPublicKey = Mnemonic.bitcore.HDPublicKey('xpub6CsrEMgU2f8uEGfFMvsPjKB9ekHuZiesLqSHLwCJuNFkP2uJGm7WjTo2gy95S4KEBc4etdodNQXAvn5Vsf4kupJQ1DKR4DMfcHwKdhQ3k6h')

const derivative = 0

// We can derive from it this path, but what is this path defined as? Are we back in BIP39 territory now?
const publicKey = hdPublicKey.deriveChild(`m/0/${derivative}`).publicKey

const address = new Mnemonic.bitcore.Address(publicKey)

console.log(address.toString()) // 12XyHwtmoq5w4VQ5mzcu6BQzdLqCLxUv5e

…and of course, I can increment the derivative as many times as I wish to create new addresses from the public key.

Whenever I wish to sign a transaction…

const codeUser = new Mnemonic('select scout crash enforce riot rival spring whale hollow radar rule sentence')
const hdUserPrivateKey = codeUser.toHDPrivateKey()
const derivative = 0

// BIP 44 derivation path for private key...
const privateKey = hdUserPrivateKey.deriveChild(`m/44'/0'/0'/0/${derivative}`).privateKey

Is this approach valid or am I dodging BIP44 standards?

integration – What are the standard ways of deriving and verifying the formulas for integral transforms where the formal formula for the transform diverges?

There are multiple formulas for integral transforms of various functions in the tables of integral transforms, but in many cases the integral, formally representing the transform diverges.
What is the usual way of deriving and verifying those formulas then?

It seems, the current practice is inconsistent: sometimes the tables give a kind of regularized value without even warning that this is some kind of regularization, while in other cases delta function and its derivatives get involved, etc.

solution verification – Deriving the Fourier coefficient equations and notation

I want to start by saying I understand the process of how to obtain equations for $a_n$ and $b_n$ are derived, but there is something about the notation in the derivation that I don’t understand.

Lets say $$f(x) = frac{a_0}{2}+sum _{n=1}^{infty }left(a_n:cosleft(nxright)+b_n:sinleft(nxright)right)$$

In the derivation, perhaps of $a_n$, the function is multiplied by $cos(mx)$ and then after simplification we get:
$$sum _{n=1}^{infty }left(a_n:delta _{mn}right)$$

Which gives a formula for $a_m$
But what I don’t get is how we can just replace ‘m’ with ‘n’… If I retry doing the derivation, multiplying $f(x)$ by $cos(nx)$ instead, won’t the $a_n$ obtained correspond to the $n$ in the newly multiplied $cos(nx)$, and not the $n$ in the $a_n$ subscript? It is easier to see what I
mean if I use $n_1$ for the coefficient of cos($n_1$x) (in $f(x)$) and $n_2$ inside the argument in the multiplied $cos(nx)$, which gives me
$$sum _{n_1=1}^{infty }left(a_{n_1}:delta _{n_1n_2}right) = a_{n_2}$$ and not a formula for $a_{n_1}$ as I would have expected from the actual derived equation.

java – Importing bitcoinj mnemonic into electrum or deriving private keys from mnemonic

I am having a really hard time backing up my bitcoinj mnemonic and importing it somewhere else.

I am backing up the mnemonic like so:

    Wallet wallet = Wallet.createDeterministic(params, Script.ScriptType.P2WPKH);
    DeterministicSeed seed = wallet.getKeyChainSeed();
    System.out.println("seed: " + seed.toString());
    System.out.println("creation time: " + seed.getCreationTimeSeconds());
    System.out.println("mnemonicCode: " + Utils.SPACE_JOINER.join(seed.getMnemonicCode()));

This gives me: cram approve decline tobacco truly giant remember author install dirt spare law

The wallet dump for this wallet/mnemonic looks like this:

Keys:
Earliest creation time: 2020-09-10T23:01:55Z
Seed birthday: 1599778915 (2020-09-10T23:01:55Z)
Ouput script type: P2PKH
Key to watch: xpub685v329L5UXezQQmCRgftKRud7hYHHR2U9RPCzRVwQNNWQuTHawgzBXD5RgAYLroJFiqTxEhF5jmbXJAWB341x8r3hdUFWfZd1Rh9uycNR3
Lookahead siz/thr: 100/33
addr:13ScJMSbxg6JYVaWNJAawZMaKW9KDdsz2H hash160:1ac81dec190ab5981f5b8d9627136c806b013ff8 (M, root)
addr:18jGHhTXzKJcU1TqpMkozYQQBKHsnExT1H hash160:54c71cd14809d8e4695d0ab8881b9c971c28d833 (M/0H, account)
addr:1HJbGGSZ42tG9nrTU6aGS2xJwCSEb6rKfg hash160:b2d5af74fb0d34e5a072cf0514c9d0a6d949a699 (M/0H/0, external)
addr:19kEr724cNCXWgybTDPhNqN5rTVCcajdjD hash160:5fee7381e26b401c7aca2d031e950aa7b6ff634d (M/0H/1, internal)

Seed birthday: 1599778915 (2020-09-10T23:01:55Z)
Ouput script type: P2WPKH
Key to watch: zpub6mkSeMVANqccjQLrtYC39g9eob95YG9cNvGFFBvXVgsT7mrJno4ChARSa1WWYdtuygHLDdkc5Bg6Lc45wx8xL2tSzgHsnzfqt4oSYR1Lecv
Lookahead siz/thr: 100/33
addr:bc1qrtypmmqep26es86m3ktzwymvsp4sz0lcurmxp8 hash160:1ac81dec190ab5981f5b8d9627136c806b013ff8 (M, root)
addr:bc1qppm602vv0ee29mndy37c3h5h4y753vyz82h5qt hash160:0877a7a98c7e72a2ee6d247d88de97a93d48b082 (M/1H, account)
addr:bc1qz88ttzmmlr2w6d5wz40e9ejqxmr5avtmq2d6qq hash160:11ceb58b7bf8d4ed368e155f92e64036c74eb17b (M/1H/0, external)
addr:bc1q0v7emmg95uj738fnge70hwle23jdehpqxezqne hash160:7b3d9ded05a725e89d33467cfbbbf95464dcdc20 (M/1H/1, internal)

Now importing the bip39 mnemonic into electrum or the iancoleman site gives me completely different adressess no matter what derivation path I use. How can I import the mnemonic so that it creates the exact adresses as bitcoinj/android schildbach wallet? Or how else should I backup?

address generation – Procedure for Deriving Payment Addresses

I’m trying to understand the HD wallet payment derivation procedure, so assume:

  • Ownership of a Bitcoin HD Wallet on an external smart device
  • Exported account level extended public key (xpub….) from the first account.
  • Derivation Path “m/44’/0’/0’/0/0”

What is the step-by-step procedure that one would use to derive a valid bitcoin payment address that can be confirmed with the external wallet?

The process, according to BIP32 – Child key derivation (CKD) functions, seems simple and straight-forward enough that it should be able to be written as a single function in any programming language with two processes: Base58 and HMAC-SHA512, which are such standard functions that I don’t believe that it’s necessary to install a platform tool and a bloated spaghetti code library to perform the derivation.

UPDATE 20190718:

Here’s what I’ve been able to cobble together from various sources. PHP code and reference source for the derivation process:

<?php

  // https://iancoleman.io/bip39/ - Downloaded and used offline.
  // Bip39 Test Mnemonic: abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about

 $Pub = "xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhawA7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj";

 $Index = "00000000";

 $ExtPubKey = bin2hex(base58_decode($Pub));

 $Type = substr($ExtPubKey,0,8);

 $Depth = substr($ExtPubKey,8,2);

 $Fingerprint = substr($ExtPubKey,10,8);

 $Account = substr($ExtPubKey,18,8);

 $ParentChainCode = substr($ExtPubKey,26,64);

 $ParentPublicKey = substr($ExtPubKey,90,66);

 $PubChecksum = substr($ExtPubKey,-8);

 $PublicKey = hash_hmac('sha512',$ParentChainCode,$ParentPublicKey.$Index);

 $PublicKey = "04".$PublicKey;

 $PublicKeyHash = hash('ripemd160',hash('sha256',$PublicKey,False));

 $BaseAddress = "00".$PublicKeyHash;

 $PreChecksum = hash('sha256',hash('sha256',$BaseAddress));

 $Checksum = substr($PreChecksum,0,8);

 $Address = $BaseAddress.$Checksum;

 $PaymentAddress = base58_encode(hex2bin($Address));

 echo "Payment Address: $PaymentAddressn";

?>

I’m using xpub to prove that the procedure works. Ultimately would like to be able to derive for ypub and zpub.

It seems like I’m just missing something important, like maybe variable typing, maybe binary something…I’m at a loss.

I’ve been told by Andreas that there’s something about adding two numbers together, but I’m not finding the reference to it.

One source referenced something about elliptic curve and a mystical variable “G” but with no explanation.

According to BIP32, this process is supposed to be really easy.

Any assistance would be appreciated. TIA.

calculus and analysis – Deriving the maximum likelihood estimates for a multivariate Gaussian

I am new to Mathematica and wonder if anyone can give me skeleton of a solution to a simple problem that I will then modify for my purposes as so far I have not managed to properly grasp the syntax.

The test case is simply deriving the closed form estimates of the sample mean vector and the variance co-variance matrix for a multivariate normal distribution. It would be nice to do so for an arbitrary number of variables $k$, with sample size $n$.

Note that $mathbf{mu}$ is the sample mean vector of length $k$, and $mathbf{Sigma}$ is the $k$ by $k$ variance-covariance matrix.

Aim:

From PDF:

$f_{mathbf{x}}(x_1,…,x_k)=2pi^{-k/2}|mathbf{Sigma}|^{-1/2}text{exp}left ( -frac{1}{2}(mathbf{x}-mathbf{mu})^Tmathbf{Sigma}^{-1}(mathbf{x}-mathbf{mu})right )$

i) define likelihood function:

$L(mathbf{mu},mathbf{Sigma}|mathbf{x}^{(i)})=prod_{i=1}^{n}2pi^{-k/2}|mathbf{Sigma}|^{-1/2}text{exp}left ( -frac{1}{2}(mathbf{x}^{(i)}-mathbf{mu})^Tmathbf{Sigma}^{-1}(mathbf{x}^{(i)}-mathbf{mu})right )$

ii) define log-likelihood function:

$l(mathbf{mu},mathbf{Sigma}|mathbf{x}^{(i)})=-frac{nk}{2} text{ln}left (2pi right ) – frac{n}{2}text{ln}|mathbf{Sigma}| – frac{1}{2}
sum_{i=1}^{n}(mathbf{x}^{(i)}-mathbf{mu})^Tmathbf{Sigma}^{-1}(mathbf{x}^{(i)}-mathbf{mu})$

iii) Compute partial derivatives of $l$ w.r.t $mathbf{mu}$ and $mathbf{Sigma}^{-1}$. On paper the derivative w.r.t. the matrix $mathbf{Sigma}^{-1}$ is performed by first substituting $(mathbf{x}^{(i)}-mathbf{mu})^Tmathbf{Sigma}^{-1}(mathbf{x}^{(i)}-mathbf{mu})$ with the trace $trleft ((mathbf{x}^{(i)}-mathbf{mu})^T(mathbf{x}^{(i)}-mathbf{mu})mathbf{Sigma}^{-1}right )$, and then noting that

  • $frac{partial}{partialmathbf{Sigma^{-1}}}trleft ((mathbf{x}^{(i)}-mathbf{mu})(mathbf{x}^{(i)}-mathbf{mu})mathbf{Sigma}^{-1}right )=(mathbf{x}^{(i)}-mathbf{mu})(mathbf{x}^{(i)}-mathbf{mu})^T$

iv) find maxima (well, stationary points at this stage) by setting both partial derivatives to zero and solve for the respective parameters giving:

$hat{mathbf{mu}}=frac{1}{m}sum_{i=1}^{n}mathbf{x}^{(i)}$ and $hat{mathbf{Sigma}}=frac{1}{m}sum_{i=1}^{n}(mathbf{x}^{(i)}-hat{mathbf{mu}})(mathbf{x}^{(i)}-hat{mathbf{mu}})^T$

If someone could guide me through the process in a Mathematica script I would be very grateful! Please note, I’m not a mathematician but I write quite a lot of code and while I can follow the derivation above, I would not have known to use the matrix-for-trace substitution.

Thanks,

J

Deriving the general formula of $mathcal{epsilon_{ijk}} mathcal{epsilon^{ijk}}$

As stated in the title, with $i,j,k=1,…,N$.

I expanded $mathcal{epsilon}_{ijk}mathcal{epsilon}^{ijk}$ as follows:
$$mathcal{epsilon}_{ijk}mathcal{epsilon}^{ijk}=underbrace{mathcal{epsilon}_{1jk}mathcal{epsilon}^{1jk}+mathcal{epsilon}_{2jk}mathcal{epsilon}^{2jk}+…+mathcal{epsilon}_{(N-1)jk}mathcal{epsilon}^{(N-1)jk}+mathcal{epsilon}_{Njk}mathcal{epsilon}^{Njk}}_{text{$N$ terms (without expanding $j$ and $k$)}} tag{1}$$
Considering only the leading term of $(1)$:
$$mathcal{epsilon}_{1jk}mathcal{epsilon}^{1jk}=underbrace{mathcal{epsilon}_{12k}mathcal{epsilon}^{12k}+mathcal{epsilon}_{13k}mathcal{epsilon}^{13k}+…+mathcal{epsilon}_{1(N-1)k}mathcal{epsilon}^{1(N-1)k}+mathcal{epsilon}_{1Nk}mathcal{epsilon}^{1Nk}}_{text{($N-1$) terms (without expanding $j$)}} tag{2}$$
where $j neq 1$.

Now for $mathcal{epsilon}_{12k}mathcal{epsilon}^{12k}$ only:
$$mathcal{epsilon}_{12k}mathcal{epsilon}^{12k}=underbrace{mathcal{epsilon}_{123}mathcal{epsilon}^{123}+mathcal{epsilon}_{124}mathcal{epsilon}^{124}+…+mathcal{epsilon}_{12(N-1)}mathcal{epsilon}^{12(N-1)}+mathcal{epsilon}_{12N}mathcal{epsilon}^{12N}}_{text{$(N-2)$ terms}} tag{3}$$
where $k neq 1,2$

Combining the results from $(1),(2)$ and $(3)$, I got
$$mathcal{epsilon}_{ijk}mathcal{epsilon}^{ijk}=N(N-1)(N-2) tag{4}$$


But from the identity that$$mathcal{epsilon}_{ijk}mathcal{epsilon}^{klm}=delta^{l}_{i}delta^{m}_{j}-delta^{m}_{i} delta^{l}_{j} tag{5}$$
$mathcal{epsilon}_{ijk}mathcal{epsilon}^{ijk}$ gives
$$mathcal{epsilon}_{ijk}mathcal{epsilon}^{ijk}=mathcal{epsilon}_{jki}mathcal{epsilon}^{ijk}=delta^{j}_{j}delta^{k}_{k}-delta^{k}_{j}delta^{j}_{k}=N^2-N=N(N-1) tag{6}$$
which is different to $(4)$.

Can someone please explain where my conceptual errors lie from $(1)$ to $(4)$ (if not from $(5)$ to $(6)$)?