On trouvera :
- TD_simulnum_gauss.py : méthode du pivot de Gauss
- TD_simulnum_riemann.py : méthodes d'intégration
- TD_simulnum_solve.py : recherche du zéro d'une fonction
pivot = ( | |
lambda m: | |
(lambda f: (lambda x: x(x))(lambda y: f(lambda *args: y(y)(*args)))) | |
(lambda g: | |
(lambda h,n: | |
g( | |
(lambda i: | |
[ | |
[ z - y[n]*i[n][k]/i[n][n] for k,z in enumerate(y) ] | |
if x!=n else |
Put the four relevant lines in your ~/.vimrc
file. The plugin has to be installed separately from here.
let g:repl_cmd = '/home/pi/APL/svn/trunk/src/apl --noSV --rawCIN --noColor'
let g:repl_stop = ')OFF'
let g:repl_send = "'REPL-VIM'"
let g:repl_detect = 'REPL-VIM'
-- Reproduire la table `CountryLanguage` à la différence près que la colonne Percentage doit maintenant contenir le pourcentage de locuteurs d'une langue dans un pays par rapport au nombre total de locuteurs de cette langue dans le monde. | |
SELECT CountryCode, Language, IsOfficial, | |
(A.Percentage * A.Population / B.nbr) AS Percentage | |
FROM ( | |
SELECT CountryLanguage.*, Country.Population | |
FROM CountryLanguage | |
LEFT JOIN Country | |
ON CountryLanguage.CountryCode = Country.Code | |
) AS A |
(https://gist.github.com/2b870728323456f71402)
This is my mathematical notebook; I put here the identities I find from time to time; this notebook is written in the markdown format with the vim editor. I use my own vim-notebook plugin for embedding Maxima code in it; thus I can evaluate each cell of code.
" quickmove.vim : move the cursor according to the more/less game | |
" Author: Thomas Baruchel | |
" Version: 1.0 | |
" Date: Mar 14, 2015 | |
" | |
let g:quickmove_version = "1.0" | |
if &compatible | |
finish | |
endif |
Dyalog APL is a great tool but the interface for working in an interactive session is rather poor. Editing previous lines by moving the cursor to some other location is rather painful. Of course Dyalog APL isn't allowed to use the great readline library. But it is not too difficult to replace the officiel ncurses interface by some more modern readline-based one as long as you do it with an external tool.
What you will get is:
# -*- coding: utf-8 -*- | |
import numpy as np | |
import scipy.ndimage.measurements | |
import random | |
def kMeans( data, k, centers=None, iter=64 ): | |
if len(data.shape) == 1: | |
data = np.vstack(data) |
# -*- coding: utf8 -*- | |
def library_sort(l): | |
# Initialization | |
d = len(l) | |
k = [None]*(d<<1) | |
m = d.bit_length() # floor(log2(n) + 1) | |
for i in range(d): k[2*i+1] = l[i] | |
# main loop |
# Adapted from: | |
# "A Floating-Point Technique for Extending the vailable Precision" | |
# by T.J. Dekker in Numer. Math. 18, 224-242, 1971. | |
# (adapted to Numpy from the Algol 60 code in the paper) | |
import numpy as np | |
import decimal | |
_npDecimal = np.vectorize(decimal.Decimal, otypes=[object]) |