iki.fi/o

Misc

Miscellaneous works and designs

2008-08-08

A fluorescent patch

"NED", a fluorescent & phosphorescent patch

This was sold along with tickets for Histoni’s NED parties. The stuff in the tube is a combination of glue and a phosphorescent powder intended for fish lures.

2008-01

A shirt

A shirt

For the shirt I used a coat as a model for the pieces.

2007-09-19

Fingerpaint on canvas, with Hilla Mattus

Fingerpaint on canvas, with Hilla Mattus

2003-12-25

Spooky mansion gingerbread house / Hexenhaus / piparkakkutalo, made together with my brothers

Detail of the gingerbread house

Marginal notes

These are miscellaneous notes and recipes.

2010-06-22

Calculation of Boltzmann factors in Google

A google search for (-6 kcal/mol) * -1 / (Avogadro constant)/ (Boltzmann constant) / (273.15 K + 42 K)) calculates the Boltzmann factor for a molecule being in a state with a free energy of -6 kcal / mol, at 42 degrees Celsius, 9.5805616.

2010-03-30

Logarithm of a sum of large numbers

When dealing with large numbers, it can be useful, as an approximation, not to deal with the numbers themselves, but with their logarithms. This has the added benefit that multiplication of two numbers corresponds to taking the sum of their logarithms. But what if you want to take the sum of the numbers, a and b, how can you avoid dealing with the possibly horrendously large numbers themselves? This problem is encountered for example when computing the total unnormalized probability (a Boltzmann factor or partition function) of mutually exclusive events. Here’s a way:

Presume that a>0, b>0, and a \ge b. If a < b you can always swap the two numbers.

\mathrm{ln}(a + b) = \mathrm{ln}\big(a(1+\frac{b}{a})\big) = \mathrm{ln}\,a + \mathrm{ln}(1+\frac{b}{a}) = \mathrm{ln}\, a + \mathrm{ln}\big(1 + \mathrm{e{x}p}(\mathrm{ln}\,b - \mathrm{ln}\,a)\big) .

If \mathrm{ln}\,b - \mathrm{ln}\,a is a very large negative number, then \mathrm{ln}(a + b) \approx \mathrm{ln}\,a.

For the logarithm of the difference of a and b, we would proceed similarly:

Presume that a>0, b>0, and a > b. These conditions are necessarily satisfied if \mathrm{log}\,a, \mathrm{log}\,b, and \mathrm{log}(a - b) can be calculated.

\mathrm{ln}(a - b) = \mathrm{ln}\big(a(1-\frac{b}{a})\big) =  \mathrm{ln}\,a + \mathrm{ln}(1-\frac{b}{a}) = \mathrm{ln}\, a +  \mathrm{ln}\big(1 - \mathrm{e{x}p}(\mathrm{ln}\,b - \mathrm{ln}\,a)\big)  .

If \mathrm{ln}\,b - \mathrm{ln}\,a is a very large negative number, then \mathrm{ln}(a - b) \approx \mathrm{ln}\,a.

\mathrm{ln}\big(1 + \mathrm{e{x}p}(x)\big) and \mathrm{ln}\big(1 - \mathrm{e{x}p}(x)\big)  are called Gaussian logarithms, because Carl Friedrich Gauss was the first to publish printed tables of them.

2010-03-02

Newbie bug with C++ nested templates

Say, you want to create a map from stings to vectors of strings. Why does this (with the appropriate STL includes):

typedef std::vector<std::string> VectorOfStrings;
typedef std::map<std::string, VectorOfStrings> StringToVectorOfStrings;

work, while this doesn’t:

typedef std::map<std::string, std::vector<std::string>> StringToVectorOfStrings;

The latter works if you modify it a little bit, so that the consecutive >’s are not recognized as >>:

typedef std::map<std::string, std::vector<std::string> > StringToVectorOfStrings;

2009-10-15

Two IRC channels in different windows using EPIC IRC client

Start your IRC session like this:

/window new
/window show 1
/bind ^I parse_command {/window size 6} {/window last} {/window move 1}

Now you have two windows on top of each other, and you are doing things in the bottom one. You can switch between the windows by pressing tab.

The normal usage is to join on two different channels:

/join #firstchannel

Press tab.

/join #secondchannel

Whenever you want to view or talk on the other channel, press tab.

2009-09-12

Embedding a Java Applet in a WordPress 2.8.4 post

In the HTML editor:

<div id="dyemixer">APPLET HERE<script type="text/javascript">// <![CDATA[ document.getElementById('dyemixer').innerHTML = '<applet width="550" height="420" code="DyeMixer.class" archive="http://yehar.com/blog/wp-content/uploads/2009/09/DyeMixer.jar" alt="To use this applet, you need a Java virtual machine (Java plug-in) for your web browser.">'; // ]]></script></div>

This also survives editing the post in the visual editor. You can even center the applet like you would a normal paragraph.  Note that the div’s id and the argument to getElementById must be identical. Using a similar JavaScript script, you should be able to put also other arbitrary HTML in a WordPress post or page.

2009-07-30

Generation of random numbers from a truncated exponential distribution

To generate a random number with a truncated exponential distribution:

  1. Generate a random number x from an exponential distribution with the rate parameter you want
  2. Calculate x modulo where-to-truncate. This would not be integer modulo but for example fmod() floating-point remainder.

Could be useful if you have exponentially distributed random numbers handy.

2002-11-25

Anti-imaged wavelet transform

This is an idea of a wavelet-type audio processing scheme, where you decompose the audio into octave bands, each octave sampled at half the sampling frequency compared to the one-up octave band. Then you process the bands in whatever way you wish, and reconstruct the signal from the bands. The benefit of the method compared to usual wavelets is the low level of imaging noise when bands are processed separately. The original music-dsp posting has the details:

http://aulos.calarts.edu/pipermail/music-dsp/2002-November/018600.html

multi

The processing scheme ("/2" means decimation by 2, "*2" means dilution by zeros to 2x samplerate)

fir

Frequency responses of filters that could be used in the scheme

2001-09-02

Frequency shifting (audio effect)

Frequency shifting can be an interesting audio effect, although it does not usually preserve harmonic relations. Here is how to do it the wrong and the right way:

blah

Complex exponential modulation illustrated on z-plane unit circle

Complex exponential modulation illustrated on z-plane unit  circle

The ugly mixture. Complicated aliasing caused by discarding the imaginary part from a complex exponential modulated signal.

baa

Anti-aliased frequency shifting illustrated on z-plane unit circle

2000-08-10

Daubechies wavelets 1-38 in a .h file

I copied some daubechies wavelets from a published database into this C header file, confirmed the data to be error-free and wrote a little introduction into wavelets in the comments.

Music

Music by me in mp3 and ogg format, sometimes with source files.

~1998

Yehar – Driving SAAB 96 on the Highway of Emotions

Yehar – The East Wing Study

~1995

PEHMOPOP

Tuna pie

2009/4/28

tuna1

This is how to make tuna pie. Heat oven to 225 °C (200 °C is better if you can wait longer).

tuna1

Take a plate.

tuna1

Take a can of tuna. Do not discard the oil!

tuna1

Spread the oily tuna on the plate.

tuna1

Spread mashed potatoes from yesterday, on top.

tuna1

Put the dish in the oven.

tuna1

Cook for 25 minutes (longer if 200 °C).

tuna1

Wash dishes while waiting.

tuna1

When it’s a bit brown on the surface, it’s ready.

tuna1

Enjoy with fresh lemon palm sprinkled on top (I didn’t have it for the picture). Be careful, the plate and the food are hot! In this dish, the almost crispy and well done edges are the best part.

Posters

2009/12/05

Research group poster

Research group poster

2009/01/23

A poster for a scientific meeting

A poster for a scientific meeting

2008/09/04

An older poster for a party

A poster for a party

2008/03/13

An older poster for a party

A poster for a party

Powered by WordPress - Hosted by SuniSoft oy