JJ's random experiments
Umbrella project for various codes by JJ. more…
Tools: Python + NumPy et al; Octave 3.2.4; wxMaxima 0.8.x.
magnets_and_pendulum
Simulation code for a standard popular science tourist attraction in chaotic dynamics. more…
If this was a physics exam, the question would be…
Consider a pendulum, consisting of a massless, infinitely rigid rod and a pointlike metal weight placed at the end. The pendulum is suspended over a plane (z = 0) with N (pointlike) magnets placed in regular intervals along the perimeter of a circle. A uniform gravitational field applies, pointing downwards.
Let the weight start from rest at a given point. Consider the set of admissible starting positions as the lower half of the sphere defined by the rod origin (0,0,L) and length of the rod, L. You can take L = 1.
Assume that the pendulum loses energy at a constant rate (due to frictional losses, air resistance…). Thus, the system eventually stops, as time t grows without bound.
Q1) Find the trajectory from a given starting point.
Q2) Find which magnet wins from a given starting point. The “winner” is defined as the magnet that minimizes the distance between the weight and itself in the final stopped state. Plot the winner as a function of a discrete approximation of the set of all admissible starting positions. Present the result as a colour sheet with each pixel representing a starting position.
Technically, the source code of these solvers demonstrates using Python, NumPy, Matplotlib, mpi4py, Cython and the C interface in Cython, while actually running the solvers will make pretty pictures of trajectories and attraction pools.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/magnets_and_pendulum.git magnets_and_pendulum
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/magnets_and_pendulum.git magnets_and_pendulum
Then you can go to your repository:
cd magnets_and_pendulum
mdl_example
Automatic truncation of basis in least-squares curve fitting using a family of functions (1D). Given a set of basis functions Phi = {phi_0, phi_1, …, phi_m} (m < n, where n is the number of data points), this fitter will try the subsets {phi_0}, {phi_0, phi_1}, {phi_0, phi_1, phi_2, …, phi_{k-1}, phi_k}, …up to and including the original full set Phi, performing a least squares fit to the data for each subset. more…
The optimal value of k is then chosen automatically, based on balancing the least squares error of the fit against total estimated code length (where any deviations from the fitted function are assumed as samples from Gaussian noise).
Supports both trigonometrics and polynomials, and has the required infrastructure to easily support a custom basis (although currently the actual “custom” basis functions used for demonstrating this are hardcoded).
This is based on an exercise in the Information-Theoretical Modeling course (2010).
Technically, this demonstrates the use of code generation using lambda and exec in Python, how to do regex substitutions in Python, and how to use the LaTeX labelling feature of Matplotlib. It also demonstrates how to adjust font size and background transparency in legends. Note that the generated functions operate on NumPy objects without this being known at the definition time.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/mdl_example.git mdl_example
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/mdl_example.git mdl_example
Then you can go to your repository:
cd mdl_example
mandelbrot
Generator for fractals of the Mandelbrot and Julia types. Configurable recursion formula. more…
Both serial and MPI-enabled versions available.
No user interface at the moment. See README.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/mandelbrot.git mandelbrot
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/mandelbrot.git mandelbrot
Then you can go to your repository:
cd mandelbrot
miniprojects
Codes related to small projects for which a separate repository would be overkill.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/miniprojects.git miniprojects
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/miniprojects.git miniprojects
Then you can go to your repository:
cd miniprojects
freya
FREYA (Finite element based Radically ElementarY Applied mathematics library) is a Python library for numerical solution of partial differential equations (PDEs) by the finite element method (FEM), in one and two space dimensions, with C0 or C1 continuity across element interfaces. Given an element type, it discretizes weak forms automatically. more…
The focus is on simplicity, and ease of use from the viewpoint of the programmer using the library. FREYA includes some features of a domain-specific language, enabling the user to write the equations directly in their weak form. The software then automatically discretizes the equations, numbers the unknowns, and builds and solves the discrete equations.
Linear PDEs are supported directly. An iterative linearization facility is provided for solving nonlinear PDEs.
In two dimensions, quadrangular elements are used; the reference element is built as a cartesian product of two 1D elements of the same type.
FREYA is a work in progress; currently, only topologically cartesian meshes (“meshgrid” in common software terminology) are supported in 2D. However, the geometry can be arbitrarily distorted via the coordinate mapping, as long as the quads stay convex.
Supported elements (1D):
– P0 (piecewise constant; discontinuous)
– P1 (C0 linear)
– P2 (C0 quadratic)
– P3 (C0 cubic)
– Beam (C1 Hermite).
Supported elements (2D):
– Q0 (piecewise constant; discontinuous)
– Q1 (C0 bilinear)
– Q2 (C0 biquadratic, 9 nodes)
– Q3 (C0 bicubic, 16 nodes)
– Bogner-Fox-Schmit (“BFS”; C1 Hermite, cubic).
P0 and Q0 cannot support derivatives, and are only provided for special cases such as some discretizations of the pressure term in Navier-Stokes.
FREYA is designed to handle up to 4th order problems (in terms of spatial derivatives of the corresponding strong form); the beam/BFS elements provide the required C1 continuity over the element seams.
MPI support is available. MPI can be utilized for parallel processing of the matrix assembly, half-integrand term generation (basis or test parts of integrands), and evaluation of known fields.
The aim of the project is to make a suite of solvers for a variety of equations (depending on the needs of the FSI team at JYU), hence the name.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/freya.git freya
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/freya.git freya
Then you can go to your repository:
cd freya
generic-latex-makefile
A generic Makefile for compiling LaTeX documents. Includes support for BibTeX (optionally with per-chapter bibliographies), makeindex and automatically compiling .svg figures using Inkscape in CLI mode. Will automatically run pdflatex several times when needed. more…
instructions provided in both English and Finnish.
Cloning this repository:
If you need read and write access use this command:
git clone git@yousource.it.jyu.fi:jjrandom2/generic-latex-makefile.git generic-latex-makefile
If you only want to clone (and not push) use this command:
git clone git://yousource.it.jyu.fi/jjrandom2/generic-latex-makefile.git generic-latex-makefile
Then you can go to your repository:
cd generic-latex-makefile
Activities 
-
Tuesday April 30 2019
-
Push
13:31
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from ab850c0 to 57d18f0
-
-
Tuesday April 16 2019
-
Push
15:13
Juha Jeronen pushed 2 commits to jjrandom2/miniprojects:master
master changed from df46447 to ab850c0
-
-
Thursday April 11 2019
-
Push
14:05
Juha Jeronen pushed 2 commits to jjrandom2/miniprojects:master
master changed from 5a223c1 to df46447
-
-
Thursday December 20 2018
-
Push
12:11
-
-
Wednesday October 24 2018
-
Push
16:32
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from 3f71ff1 to 5a223c1
-
-
Thursday October 18 2018
-
Push
14:49
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from 361a805 to 3f71ff1
-
Push
14:40
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from c886fbc to 361a805
-
-
Monday November 13 2017
-
Push
03:25
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from de1a736 to c886fbc
-
-
Saturday November 11 2017
-
Commit
03:48
-
Push
03:47
Juha Jeronen pushed 1 commit to jjrandom2/miniprojects:master
master changed from d282175 to de1a736
-
-
Monday June 19 2017
-
Push
17:40
-
-
Tuesday June 13 2017
-
Push
02:51
-
Push
02:23
-
Push
01:30
-
-
Monday June 12 2017
-
Push
13:08
-
-
Saturday June 10 2017
-
Push
01:25
-
-
Friday June 09 2017
-
Push
21:13
-
Push
15:06
-
-
Thursday June 08 2017
-
Push
17:31
-
Push
13:50
-
Push
13:02
-
-
Monday May 08 2017
-
Push
15:10
-
Push
15:04
-
Push
14:54
-
Push
14:16
-
Push
14:09
-
Push
13:19
-
-
Friday March 24 2017
-
Push
14:57
-
-
Tuesday December 13 2016
-
Push
16:54
-
Push
15:08
-