Showing entries 1 to 9
Displaying posts with tag: math (reset)
Math with MySQL

I thought I posted this long ago... oh well....

We all know that math is the fundamental aspect of all life and the common language used around the world if not beyond. MySQL, like all databases, can help you with numerous aspects of math.

Here is a list of the functions: https://dev.mysql.com/doc/refman/5.6/en/mathematical-functions.html

Here are some simple examples to get you started. 

  • The Quadratic Formula  ax^2 + bx + c = 0


# 2x^2  – 4x – 3 = 0.
SET @a=  1;
SET @b=  3;
SET @c= -4;
SET @XX = ( -(@b) - SQRT(  POW(@b,2)  -4 * @a * @c) / POW(@a,2) ) ;
SET @YY = ( -(@b) + SQRT(  POW(@b,2)  -4 * @a * @c) / POW(@a,2) ) ; 
SET @XXX = MOD(@YY, @XX);

[Read more]
Understanding skew factors in Simplex/Improved Perlin Noise

[Here is a PDF version for readers whose browser does not understand MathML.]

The Simplex Noise (or Improved Perlin Noise) algorithm uses a somewhat mysterious "skew factor" of 3-12. I did not find any really satisfactory explanation for this factor in the descriptions of Simplex Noise that I read. But I managed to work it out nevertheless, which I thought was a fun exercise and worth a quick write-up.

Simplex noise is constructed by assigning random values to each point in a simplex grid. The simplex grid is a tiling of the plane using rhombuses, each rhombus consisting of two equilateral triangles. See the figure on the right.

Given a point (x,y) (expressed in normal rectangular coordinates), we …

[Read more]
Running Standard Deviation in MySQL

Calculating the standard deviation in MySQL is a no-brainer by using the build-in aggregate function STDDEV(). If you don't need the original data and only want to save aggregated values in your database, the whole matter is getting more complicated - but is worth from a space and performance point of view.

Read More »

Running Standard Deviation in MySQL

Calculating the standard deviation in MySQL is a no-brainer by using the build-in aggregate function STDDEV(). If you don't need the original data and only want to save aggregated values in your database, the whole matter is getting more complicated - but is worth from a space and performance point of view.

Read More »

MySQL Infusion UDF for statistical analysis

Since I use MySQL for the statistical analysis on a project, I wanted to optimize the database queries and learned a lot about stuff like number theory, set theory and partial sums. I took my MySQL UDF, I've published two years ago, for this purpose and added new functions for a deeper statistical analysis. The project is around for a while, so it's time to share things with the public to start a discussion of how things could be further optimized. The source and a small documentation can be found on Github:

Read More »

MySQL Infusion UDF for statistical analysis

Since I use MySQL for the statistical analysis on a project, I wanted to optimize the database queries and learned a lot about stuff like number theory, set theory and partial sums. I took my MySQL UDF, I've published two years ago, for this purpose and added new functions for a deeper statistical analysis. The project is around for a while, so it's time to share things with the public to start a discussion of how things could be further optimized. The source and a small documentation can be found on Github:

Read More »

Calculate date ratios

When I celebrated my birthday, I got the idea that there must theoretically be a date on which two peoples ages are in a certain ratio. The basic idea were born when I thought that there must be a date on which my mother is exactly twice as old as me. Actually, this is the point of time when I'm as old as my mother was, when I were born. That means

Read the rest »

Four short links: 4 August 2009
  1. NASA Nebula Services/Platform Stack -- The NEBULA platform offers a turnkey Software-as-a-Service experience that can rapidly address the requirements of a large number of projects. However, each component of the NEBULA platform is also available individually; thus, NEBULA can also serve in Platform-as-a-Service or Infrastructure-as-a-Service capacities. Bundles RabbitMQ, Eucalyptus, LUSTRE storage, Fabric deployment, Varnish front-end, MySQL and more. (via Jim Stogdill)
[Read more]
Tiny Victories, 2006-12-01

It's not often that I get to pull Knuth's The Art of Computer Programming down off the shelf and immediately solve a problem with it. Today, I did.

A big "Thank you!" goes to my parents for giving it to me long ago.

The problem is that for the way almost all computers work, floating-point numbers do not follow the associative property. This results in wrong results and a good bit of hilarity.

Showing entries 1 to 9