This piece of code takes in two infinite sequences, and, with the help of a cute math function, can cross these two together into another infinite sequence. (This is related to the diagonalization proof that the rationals are countable.) It should guarantee that, given enough time, we can reach any particular element.
The integer square root function, or isqrt, is equivalent to floor(sqrt(x)) for non-negative x. For small x, the most convenient way to calculate isqrt is by calling int(x**0.5) or int(math.sqrt(x)), but if x is a large enough integer, the sqrt...
This script allows you to graph any function you enter on the scale of your choice, assuming you use the correct javascript syntax.
For example, to use Cos x, use Math.cos(x). Or, for x^2, use Math.pow(x, 2), etc.
Implement the argmin function from math, in a form that makes use of generator expressions in 2.4.
Lagrange is a function that calculate equations of motion (Lagrange's equations) d/dt(dL/d(dq))- dL/dq=0. It Uses the Lagrangian that is a function that summarizes the dynamics of the system. Symbolic Math Toolbox is required.
I wanted a way to easily plot up vectors for math problems, to get a better idea of the the gradient, divergence, curl and such looked like. So I made this function.
It has a number of user options (which are outline in help) and a...
General hash function algorithm implementations for series of commonly used additive and rotative string hashing in the object pascal programming language.For more information please visit:http://www.partow.net/programming/hashfunctions/index.html
UCalc Fast Math Parser is a 32-bit DLL component which allows programs to evaluate math expressions that are defined at run time. It supports conventional math operators and functions, as well as unlimited user operators, functions, and...
This recipe is a simple solution for turning a recursive function into a non-recursive function.
This is a hack to get around the read-only nature of __closure__ on function objects. Watch your step!
Simple 1KHz Audio Function Generator Using Standard Python In Linux - afg.py
This code is a stand alone program to generate a signal, at the earphone sockets, of 1KHz. It is a basic audio signal generator and can be used as a...
Please note that the present is a fork of the recipe 577283 "Decorator to expose local variables of a function after execution" of Pietro Berkes, available at...
Calculating area under the curve using Monte Carlo method for any given function.
Generating N random numbers that probability distribution fits to any given function curve.
I present a method of computing the 1F1(a,b,x) function using a contour integral. The method is based on a numerical inversion, basically the Laplace inversion. Integral is 1F1(a,b,x) = Gamma(b)/2\pi i \int_\rho exp(zx)z^(-b)(1+x/z)^(-a)dz, \rho...
The recipe presents a function overloading decorator in python that do type check. The type signature is marked with the @takes and @returns decorator, which causes the function to raise an InputParameterError exception if called with...
The recipe presents a simple decorator for function overloading in python. The @overloaded function searches for the first overloads that doesn't raise TypeError when called. Overloads are added to the overloads list by using the...
In some cases it may be desirable to parse the string expression "f1(*args)" and return some of the key features of the represented function-like call.
This recipe returns the key features in the form of a namedtuple....
This simple m-file plots the Soft Handover probability as a function of the Soft Handover Threshold value used in the UTRA Soft Handover Algorithm. The relationship has been dertived by taking the ratio between the Cell area where Soft Handovers... |