Monday

pdg-control, aside exercise

Lab group commented that optimum in Reed model looks unrealistic due to frequency with which it shuts down all fishing. This is an artifact of not having extraction costs increase sufficiently for small catch, and can be easily fixed by increasing that cost (c in the profit eq, profits-costs = p*x-c/x)

view sourcecode, Reed.R

NIMBioS short visitor application

Have been thinking that it would be really useful to have some extra time at Nimbios to meet with folks at the time of our next working group meeting (March 12-15).  I’ve applied for short-term visitor support to come out a week early.

A little exercise

Nick posed this question to me about dealing with exponents of large numbers numerically. Apparently he needs to calculate

\[ \log( e^{a_1 + K} + e^{a_2 + K} + ... ) \] for some very large values of $ K $ and $ a$. R cannot compute this for exponents greater than 307 using the default double precision. First, the K is no problem, just factor it out:

\[ \log( \exp(a_1)\exp(K) + \exp(a_2) \exp(K) + ... ) \] \[ \log( \exp(K) * ( \exp(a_1) + \exp(a_2) + ... )) \] \[ K + \log( (exp(a_1) + exp(a_2) + ... )) \]

Now just $a_1, a_2, a_3 $ etc are the problem. Let’s say the \(a_i\) are in the vector \(a\). Then we just rescale by choosing some \(c\) such that we can take the exponents of something smaller:


if ( max(abs(a)) > max(a) )
  c <-  min(a)
else
  c <- max(a)
ans <- log(sum(exp(a-c))) + c

HT Prof, J. Blevins, but not perfect of course, some numbers will still be too large if a covers a range of large magnitude and small magnitude values.

Reformatting the css for kcite and twitter

Several modifications to my theme. Ought to be added to my child theme to keep updates working, but may be non-trivial to make sure the modifications appear in the correct places as the theme changes, so a few notes are probably more practical.


/* KCite formatting */
div.kcite-bibliography { padding:10px;}
div.csl-entry { padding:10px;}
/* jetpack twitter widget formatting */
ul.tweets {padding:5px;}

Quite frustrating to update these because I didn’t realize cloudflare caches my css.

Other theme file changes

Add stat counter and post-revision display to sidebar in single.php, after “Comments” link:


  <span class="cat-links"><?php if(function_exists('the_views')) { the_views(); } ?></span>

          <span class="cat-links"><?php the_revision_note_prd() ?></span>
          <span class="cat-links"><?php the_revision_list_prd() ?></span>
          <span class="cat-links"><?php the_revision_diffs_prd() ?></span>