What I Learned Today

No frills, just learn

C# Lists and Dictionary

In C# there are several key differences to C++. Microsoft Website spells them all: https://msdn.microsoft.com/en-us/magazine/cc301520.aspx

Garbage collector instead of deconstructors providing a different approach to micromenagment of memory and lists, jagged arrays and dynamic memory allocation are already available into the language. It supports also negative index to counting from the last element, similarly to Python.

About lists instead of the usual self-made textbook-example class, there are specific embedded classes for Lists and Dictionaries.

List<type> name = new List<type>();
name.Add(element);
name.Remove(element);

Dictionary<type,type> name = new Dictionary<type,type>();
name.Add(key,element);
name.Remove(key,element);


Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /home/phme2432/public_html/wp-content/plugins/latex/latex.php on line 47

Calculation of Landau Parameters for Skyrme zero-range interaction and a hint to Gogny finite-range, starting from the definition of the particle-hole interaction.

Remember kids: is not the relative momentum, but the momentum in the relative space!

Landau Parameters

Bayesian concept of probability is linked not with frequency, but with state of information. The processing of this information proceeds in a propositional sense. In fact there are semantic work related to the use of Bayesian statistic as foundation for programming languages (BLOG), First kind logic (MEBN , also look at the fun Of Starships and Klingon) and thus the foundation principles of Network-Centric warfare and commerce.

Property of Baysian calculation of proabability are sometimes difficult to grasp and very counter intuitive, interesting consideration can hide behind apparently trivial formulas that can help to answer questions like: If you know your neighbour has a son born on Tuesday, which is the probability your neighbour has two sons? (more…)

The Practice of Programming

I started reading "The Practice of Programming" by Kernigan and Pike.

The book hinges on the concepts of simplicity, clarity and generality as foundation of a good code. Eventually automation can bring something to the table generating code from algorithms.

It starts by the usual "obvious" remarks about style: (more…)

Value at Risk on expected return

Value at Risk on expected return is the lower bound for the loss in an investement respect to a probability.
Is a way to estimating losses probabilities in terms of value, instead of standard deviation. E.g. in the case of , means that the investor have a probability of loosing € or more, investing € on the portfolio .

Considering the system ergodic and thus all the variances of the titles summing up coherently to for a variance of the portfolio distributed within the normal distribution, this is simply calculated considering the quantile (the value of the distribution corresponding to a certain fraction of probability) .

(!) The of a portfolio is not a weighted average of the of its component, because but is given by the covariance matrix due to the correlation of assets .

No-Arbitrage condition

No Arbitrage states the inadmissibility of Free Lunch in applying a structure (metric?) to the prices.

Considering a title with price and cash flow , or every time , where it is the discretized time .
Then we have the two No-Arbitrage condition:

  • Weak No-Arbitrage : if
  • Strong No-Arbitrage: if and

Let's suppose a world where I can borrow money with fixed interest rate , which will be the price of a product with interest over one year?
I can borrow money until I expect to be payed back by the revenue A, so the cash flow at and of year would be 0, which is . The price of the portfolio is given by the price of the product minus the borrowed money at time 0: .
Weak No-Arbitrage fixes then the price giving .
Same can be applied for selling, giving , thus the meeting of buying and selling is, unsurprisingly .

But, if we use the strong arbitrage condition -satisfied, since we assumed the interest of the product - we get that for the buyer, and for the seller (?). So buying and selling cannot be met. And why should they? You gain nothing by selling or buying if you can lend and borrow money indefinitely for a fixed interest rate, thus is better not to do anything at all...

The aim is the optimization either by maximizing total return (or minimizing risk), in keeping with the constraints of normalization for a given risk (or return).

Thus Lagrange method is perfectly suited for the job.
For minimizing risk, respect to a desired total return , one must consider the function of total risk


and minimize the lagrangian with constrain over the desired return and sum to one of weights.

Thus, provided that the constraints have non-zero derivatives,


by the fact that is a non--degenerate constant vector (otherwise fixing the Total Risk is given), the Lagrangian is given by


with the vector of lagrange multipliers.

Thus the minimization (maximization) is given by finding the extremant of the Lagrangian,

That is solved by considering the following linear system, that considering a symmetric covariance matrix is given by


where and in the definition of the matrix are linear vectors of equal dimension.

Finally considering the Hessian for operator to find the convexity.

Analogously could be done for a maximum return portfolio or relaxing the attribute for the desired best compromise.

Considering the vector of assets i weight in the portfolio (with constrain ) and  the vector of expect returns on the corresponding assets.

Considering the volatility of the given asset, corresponding to the standard deviation of the normal distribution of returns (and thus the risk), and the correlation between assets.

The Total Return is given by:

And the Total Risk is

with the covariance matrix with elements  

Theorical ArXiv of Cook and Rossi

There are several aspects of the paper of Norman Cook and Andrea Rossi that scream "amateurish": from layout to typos (hoping they're so), from historical concepts to bibliography, I'm not certainly the only one to have noted them.

But is the scientific thesis to be flawed, even without considering the disputed history of E-cat and LENR and possible prejudices one can have on the author and its reasons.

(more…)