New Gardening Project: A Hole III

The content of the hole. There would be no hole with it.

Cleaned the working place.
It is quite nice and clean sand, I can use it for the remodelling of our garden pond.

New Gardening Project: A Hole II

Fourth step: Do not drill too deep! The lower side of the groundwater is a watertight layer of some sort. Here it is marl (a kind of clay) of a greyish colour.

The watertight layer here is a greyish marl

There is absolutely no need to drill into it and a waste of time and money (I paid for the meter drilled including the necessary amount of well casing). Also: the lowest part of the well casing is a filter. In most cases it is just the same pipe as the well casing with fine slits (3mm is enough here but your mileage may vary) but there are more expensive solutions, too. Any length of this filter inside the watertight layer if of little use and reduces the area where the groundwater can flow in.

Fifth step: case the well, that is: put a pipe into the hole to avoid the collapse of the whole. The drill string should be hollow to allow for it and needs a drill bit that you can screw out from above.

Well with pipe

Peek into well-hole with pipe (blue) and some elongation (brownish)

The pipe is something you can buy at e.g.: Amazon, at least that’s what I thought but despite a lot of hits for “Brunnenrohr” at amazon.de I got nothing at amazon.com for “well casing” except for the caps for the top.

Sixth step: clean up the whole mess before you go on ;-)

Quite a mess!

Next: securing the well with the help of a bag of concrete.

New Gardening Project: A Hole

First step: find a good place for it. Hint: dowsing does not work.
Second step: mark it.

It’s just a stick in the ground. The story about the grounded Stick is over at the BBC.

Third step: empty out everything that’s not a hole.

This things costs a fortune and has no build-in level, save an auto-level?

The tomatoes do not grow very well this year.

We should have a nice little hole at this point. As this hole is deep enough to reach groundwater level and beyond we can make a lot more out of it, for example: a well.

A nice little how-to, a bit more useful than this will be put in my next post.

Multi-Precision Floats: Radix Conversion with Large Exponents

[UPDATE] bugfix in code listing
The method for the radix conversion of floating point numbers described more theoretically here and more practically here has one large drawback: albeit always correct it is abysmally slow for large magnitudes.

Is there a faster way to do it? Yes, there is! Continue reading

Adventures of a Programmer: Parser Writing Peril XXXX

The final[1] grammar together with the lexer. The whole file with a lot of comments is on Github. It is currently in one file for convenience but needs to be split into a lexer (Flex) and a parser (Bison) later.

The file has a lot of comments already, not much to say here, but nevertheless… Continue reading

The Pleasures and Sorrows of Study

The conciseness of the grammar does not reflect within the parser.

Anonymous CS-student in Sighs of the Pusillanimous, vol. CLXXXI

Computation of the Arcsin/Arccos

The MacLaurin (Taylor series at x=0) series for the arcsin

${\displaystyle{ \arcsin(x) = \sum_{k=0}^{\infty} \frac{(2k-1)!{\kern-1.25pt}!}{(2k)!{\kern-1.25pt}!} \frac{x^{2k+1}}{2k+1} }}$

is a very slowly converging one, especially close to the branchpoints at -1 and 1.
The MacLaurin series for arccos is the same as for arcsin because of

${\displaystyle{ \arccos x = \frac{\pi}{2} - \arcsin x }}$

so it has the very same problem.

The series for the arctan on the other side is simpler to compute.
Another good reason: I have it already implemented ;-)

The arcsin is related to the atan by

${\displaystyle{ \arcsin x = 2\arctan\biggl(\frac{x}{1 + \sqrt{1 - x^2} } \biggr) }}$

which seems to be of no help at all because the fraction does not get very small and the series for atan is also quite slow near -1 and 1. We can use another relation for this range.

${\displaystyle{ \arcsin x = \mathop{\mathrm{sgn}}(x)\arctan\Biggl(\sqrt{\frac{x^2}{1 - x^2 }} \Biggr) }}$

Seems not of much use but we can expand the root

${\displaystyle{ \arcsin x = \mathop{\mathrm{sgn}}(x)\arctan\biggl(\frac{x}{\sqrt{1 - x^2 }} \biggr) }}$

The closer x comes to the branchpoint the larger the fraction, but with

${\displaystyle{ \arctan x = \frac{\pi}{2} - \arctan \frac{1}{x} }}$

the actual value gets close to zero when x goes close to one and $\arctan 0 = 0$ so
$\arcsin 1 = \frac{\pi}{2}$ which is correct and as intended. The point where $\frac{x}{\sqrt{1 - x^2 }} = 1$ is at $x = \frac{1}{\sqrt{2}}$ and at this point $\arctan 1 = \arcsin \frac{1}{\sqrt{2}} = \frac{\pi}{4}$.

My cutoff points will be $\arcsin = 2\arctan \bigl(\frac{x}{1 + \sqrt{1 - x^2} } \bigr)$ for $|x| \le 0.8$ and $\arctan\bigl(\frac{x}{\sqrt{1 - x^2 }} \bigr)$ for $|x| > 0.8$.

No code yet, just twiddling with math, sorry ;-)

For $x \in\mathbb{R} \land |x| > 1$ the real part of the result is always $\frac{\pi}{2}$ and the imaginary part $\mathop{\mathrm{sgn}}(z) \log\bigl(x + \sqrt{x^2-1}\bigr)$. This comes from one of the definitions

${\displaystyle{ \arcsin x = -i\log\biggl(ix + \sqrt{1 - x^2 }\biggr) }}$

I will use this definition for complex arguments.