Saturday, July 9, 2022

Why the area of a square of side L is LxL?

Recently I watched a video talking about the difference of the volume of the sphere of radius 1 and the cube of side 1 in N-dimensions, and I asked myself why the cube volume is always 1 in any dimension, or, which is an equivalent question:

Why the area of a square of side L is LxL?

Because the unit to measure areas is the square of side 1.

Why the unit to measure areas is the square of side 1?

Because it's convenient, since we usually measure areas by dividing them in rectangles and then measuring the sides of those rectangles. But it's not mandatory!

What happens if we change the unit to measure areas?

Well, you can continue doing maths, but then, the area formulas will be all wrong. Yes, they only work if you first state that the area of a square of side 1 is 1. Anyway, the resulting formulas will only be different by a multiplying constant.

It's an interesting exercise to derivate the main area formulas by choosing, for example, the equilateral triangle of side 1 as the area unit if you like square roots and Pythagoras, or the circle of radius 1 as the area unit if you like π and how to measure circles with triangles and vice versa.

As with the common use of our arbitrary base 10, it's important to note that much of our mathematical knowledge, as the formula of the area of the rectangle, is just conventional. Think about it before talking to any aliens, or perhaps you will not be able to understand each other...

Thursday, May 12, 2022

Add or subtract seconds to a subtitles .SRT file

Do you have a subtitles .SRT file not synchronized with the video?

Recently I recovered an old program that I wrote and I made it better. Now it supports milliseconds and negative numbers: add_seconds_to_srt.pl

> perl add_seconds_to_srt.pl
usage: add_seconds_to_srt.pl SECONDS[,MILLISEC] <INPUTFILE >OUTPUTFILE
> perl add_seconds_to_srt.pl -17,995
00:00:18,994 --> 00:00:24,594
00:00:00,999 --> 00:00:06,599
>

Enjoy it!