Python Source


  1. allen_cahn_pde, a Python code which sets up the Allen-Cahn reaction-diffusion partial differential equations (PDE) du/dt = nu * uxx - u * (u^2-1) / (2*xi) in one space dimension and time.
  2. alpert_rule, a Python code which sets up an Alpert quadrature rule to approximate the integrals of functions which are regular, log(x) singular, or 1/sqrt(x) singular.
  3. analemma, a Python code which evaluates the equation of time, a formula for the difference between the uniform 24 hour day and the actual position of the sun, based on a C program by Brian Tung.
  4. animation_test, a Python code which computes a sequence of solutions to a partial differential equation, using matplotlib(), displaying each solution to the screen without requiring the user to hit RETURN to see the next image.
  5. anishchenko_ode, a Python code which sets up and solves the Anishchenko ordinary differential equation (ODE), which has chaotic behavior and an attractor.
  6. annulus_distance, a Python code which estimates the typical distance between a pair of points randomly selected inside a circular annulus.
  7. annulus_grid, a Python code which computes a grid of points over the interior of a circular annulus.
  8. annulus_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of an annulus centered at the origin.
  9. annulus_monte_carlo, a Python code which uses the Monte Carlo method to estimate the integral of a function over the interior of a circular annulus in 2D.
  10. annulus_rule, a Python code which computes a quadrature rule for estimating integrals of a function over the interior of a circular annulus in 2D.
  11. approx_bernstein, a Python code which approximates a function f(x) in the interval [a,b] by constructing a Bernstein polynomial of order n.
  12. arclength, a Python code which estimates the arclength of curves of the form (x,f(x)) or (x(t),y(t)).
  13. arenstorf_ode, a Python code which sets up an ordinary differential equation (ODE) which defines a stable periodic orbit of a spacecraft around the Earth and the Moon.
  14. args, a Python code which reports the command line arguments with which it was invoked;
  15. arneodo_ode, a Python code which sets up and solves the Arneodo ordinary differential equation (ODE), which has chaotic behavior and an attractor.
  16. asa005, a Python code which evaluates the Cumulative Density Function (CDF) of the noncentral T Probability Density Function (PDF), by BE Cooper. This is a version of Applied Statistics Algorithm 5;
  17. asa006, a Python code which computes the Cholesky factorization of a symmetric positive definite (SPD) matrix, by Michael Healy. This is a version of Applied Statistics Algorithm 6;
  18. asa007, a Python code which computes the inverse of a symmetric positive definite (SPD) matrix, by Michael Healy. This is a version of Applied Statistics Algorithm 7.
  19. asa032, a Python code which evaluates the incomplete Gamma function, by G Bhattacharjee. This is a version of Applied Statistics Algorithm 32.
  20. asa047, a Python code which minimizes a scalar function of several variables using the Nelder-Mead algorithm, by R ONeill. This is a version of Applied Statistics Algorithm 47.
  21. asa053, a Python code which produces sample matrices from the Wishart distribution, by William Smith and Ronald Hocking. This is a version of Applied Statistics Algorithm 53.
  22. asa063, a Python code which evaluates the incomplete Beta function, by KL Majumder and G Bhattacharjee. This is a version of Applied Statistics Algorithm 63.
  23. asa066, a Python code which evaluates the Cumulative Density Function (CDF) of the normal distribution, by David Hill. This is a version of Applied Statistics Algorithm 66.
  24. asa076, a Python code which evaluates the Owen T function, needed to compute the Cumulative Density Function (CDF) of the noncentral T distribution, by Young and Minder. This is a version of Applied Statistics Algorithm 76.
  25. asa082, a Python code which computes the determinant of an orthogonal matrix; this is a version of Applied Statistics Algorithm 82, by J C Gower.
  26. asa091, a Python code which evaluates the percentage points of the Chi-Squared distribution, by Best and Roberts. This is a version of Applied Statistics Algorithm 91.
  27. asa103, a Python code which evaluates the digamma or psi function, by Jose Bernardo. This is a version of Applied Statistics Algorithm 103.
  28. asa109, a Python code which inverts the incomplete Beta function, by Cran, Martin and Thomas. This is a version of Applied Statistics Algorithm 109.
  29. asa111, a Python code which evaluates the percentage points of the normal distribution, by Beasley and Springer. This is a version of Applied Statistics Algorithm 111.
  30. asa121, a Python code which evaluates the trigamma function, by BE Schneider. This is a version of Applied Statistics Algorithm 121.
  31. asa147, a Python code which evaluates the incomplete Gamma function, by Chi Leung Lau. This is a version of Applied Statistics Algorithm 147.
  32. asa152, a Python code which evaluates the Probability Density Function (PDF) and Cumulative Density Function (CDF) associated with the hypergeometric distribution, by Richard Lund; this is a version of Applied Statistics Algorithm 152.
  33. asa183, a Python code which implements a random number generator (RNG), by Wichman and Hill. This is a version of Applied Statistics Algorithm 183.
  34. asa226, a Python code which evaluates the Cumulative Density Function (CDF) of the noncentral Beta distribution, by Russell Lenth. This is a version of Applied Statistics Algorithm 226.
  35. asa239, a Python code which evaluates the incomplete Gamma function, by Shea. This is a version of Applied Statistics Algorithm 239.
  36. asa241, a Python code which evaluates the percentage points of the normal distribution, by Michael Wichura. This is a version of Applied Statistics Algorithm 241.
  37. asa243, a Python code which evaluates the Cumulative Density Function (CDF) of the noncentral T distribution, by Russell Lenth; this is a version of Applied Statistics Algorithm 243.
  38. asa245, a Python code which evaluates the logarithm of the Gamma function, by Allan Mcleod; this is a version of Applied Statistics Algorithm 245.
  39. asa299, a Python code which computes the lattice points in an M-dimensional simplex, by Chasalow and Brand; this is a version of Applied Statistics Algorithm 299;
  40. atbash, a Python code which applies the Atbash substitution cipher to a string of text.
  41. autocatalytic_ode, a Python code which sets up and solves the autocatalytic ordinary differential equation (ODE), which has chaotic behavior and an attractor.
  42. axon_ode, a Python code which sets up the ordinary differential equations (ODE) for the Hodgkin-Huxley model of an axon.
  43. backtrack_binary_rc, a Python code which carries out a backtrack search for a set of binary decisions, using reverse communication (RC).
  44. backward_euler, a Python code which solves one or more ordinary differential equations (ODE) using the (implicit) backward Euler method, using fsolve() for the implicit equation.
  45. backward_euler_fixed, a Python code which solves one or more ordinary differential equations (ODE) using the (implicit) backward Euler method, using fixed point iteration for the implicit equation.
  46. ball_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from the interior of the unit ball in 3D.
  47. ball_grid, a Python code which computes grid points inside a 3D ball.
  48. ball_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit ball in 3D.
  49. ball_monte_carlo, a Python code which applies a Monte Carlo method to estimate integrals of a function over the interior of the unit ball in 3D;
  50. ball_positive_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected from the interior of the unit positive ball in 3D.
  51. bank, a Python code which computes the check digit associated with a US Bank Routing Number check digit, or reports whether a 9-digit code is actually valid.
  52. barycentric_interp_1d, a Python code which defines and evaluates the barycentric Lagrange polynomial p(x) which interpolates a set of data, so that p(x(i)) = y(i). The barycentric approach means that very high degree polynomials can safely be used.
  53. bdf2, a Python code which solves one or more ordinary differential equations (ODE) using BDF2, the (implicit) backward difference formula of order 2, using fsolve() to solve the implicit equation.
  54. bellman_ford, a Python code which implements the Bellman-Ford algorithm for finding the shortest distance from a given node to all other nodes in a directed graph whose edges have been assigned real-valued lengths.
  55. bernstein_approximation, a Python code which looks at some simple cases of approximation of a function f(x) by a Bernstein polynomial.
  56. bernstein_polynomial, a Python code which evaluates the Bernstein polynomials;
  57. besselj, a Python code which evaluates Bessel J functions of noninteger order;
  58. bicycle_lock, a Python code which simulates the process of determining the secret combination of a bicycle lock, an integer between 000 and 999.
  59. biharmonic_exact, a Python code which evaluates exact solutions w(x,y) to the biharmonic equation del^2 w = 0 or wxxxx + 2 wxxyy + wyyyy = 0
  60. biochemical_linear_ode, a Python code which sets up a linear biochemical ordinary differential equation (ODE).
  61. biochemical_nonlinear_ode, a Python code which sets up a nonlinear biochemical ordinary differential equation (ODE).
  62. bioconvection_ode, a Python code which approximates solutions to a system of ordinary differential equations (ODE) which model a bioconvection problem, and which are related to the Lorenz system.
  63. bird_egg, a Python code which evaluates some formulas for the shapes of bird eggs.
  64. bisect, a Python code which seeks a solution to the equation F(X)=0 using bisection within a user-supplied change of sign interval [A,B]. The procedure is written using classes.
  65. bisection_rc, a Python code which seeks a solution to the nonlinear equation F(X)=0 using bisection within a user-supplied change of sign interval [A,B]. The procedure is written using reverse communication (RC).
  66. black_scholes, a Python code which implements some simple approaches to the Black-Scholes option valuation theory, by Desmond Higham.
  67. blood_pressure_ode, a Python code which sets up and solves an ordinary differential equation (ODE) which models the variation in blood pressure in the human artery.
  68. blowup_ode, a Python code which sets up an ordinary differential equation (ODE) y'=y^2. whose solution "blows up" in finite time.
  69. boundary_locus, a Python code which uses the boundary locus method to display the region of absolute stability for a solver of ordinary differential equations (ODE).
  70. boundary_locus2, a Python code which uses the boundary locus method to plot the boundary of the absolute stability region for a solver of ordinary differential equations (ODE), based on a procedure by Randall Leveque.
  71. boundary_word_equilateral, a Python code which describes the outline of an object on a grid of equilateral triangles, using a string of symbols that represent the sequence of steps tracing out the boundary.
  72. boundary_word_hexagon, a Python code which describes the outline of an object on a grid of hexagons, using a string of symbols that represent the sequence of steps tracing out the boundary.
  73. boundary_word_square, a Python code which describes the outline of an object on a grid of squares, using a string of symbols that represent the sequence of steps tracing out the boundary.
  74. box_distance, a Python code which estimates the distribution and expected value of the distance between two points picked uniformly at random within a box.
  75. brc_data, a Python code which creates a file of randomly generated temperature readings to be associated with weather stations at 413 world cities. A file like this, with 1 billion records, is used for the billion record challenge (BRC).
  76. brownian_motion_simulation, a Python code which simulates Brownian motion in an M dimensional region.
  77. broyden, a Python code which implements the Broyden iterative method for nonlinear equations, by Tim Kelley.
  78. brusselator_ode, a Python code which sets up the Brusselator ordinary differential equation (ODE) system.
  79. burgers_exact, a Python code which evaluates exact solutions of the time-dependent 1D viscous Burgers equation.
  80. bvp_fd, a Python code which demonstrates the use of the finite difference method (FDM) to solve a boundary value problem (BVP).
  81. bvec, a Python code which demonstrates how signed integers can be stored as binary vectors, and arithmetic can be performed on them.
  82. c8lib, a Python code which implements certain elementary functions for 64 bit precision complex (C8) variables;
  83. caesar, a Python code which applies a Caesar Shift Cipher to a string of text.
  84. calpak, a Python code which computes various simple calendrical quantities. It can work with various calendars including Egyptian, English, French Revolutionary, Gregorian, Julian, and Julian Ephemeris Date. It can convert a date from one calendar to another. It can return the day of the week for a given date. It can convert from day-number/year to day/month/year format. It can calculate the time difference between two dates.
  85. candy_count, a Python code which counts the types of candy in a rectangular container, which might be a vector, matrix, or 3D box. The candy is assumed to have C possible types, and to have been entered into the container in a cycle that begins with type 1. While the vector case is easy, it is already difficult to come up with a general formula for the MxN matrix case.
  86. casino_simulation, a Python code which simulates a casino game that gives you 20% of your bet for heads, and only takes 17% for tails. How much will you end up winning?
  87. cauchy_method, a Python code which solves one or more ordinary differential equations (ODE) using the Cauchy method.
  88. cauchy_principal_value, a Python code which uses Gauss-Legendre quadrature to estimate the Cauchy Principal Value (CPV) of certain singular integrals.
  89. caustic, a Python code which generates an image of a caustic, by drawing n equally spaced points in a circle, and then connecting specific pairs of points using a spacing parameter m.
  90. ccn_rule, a Python code which defines a Clenshaw Curtis Nested (CCN) quadrature rule.
  91. ccs_io a Python code which reads and writes sparse linear systems stored in the Compressed Column Storage (CCS) format.
  92. ccs_to_st a Python code which converts a sparse matrix from Compressed Column Storage (CCS) to sparse triplet (ST) format.
  93. cellular_automaton, a Python code which prints or plots the evolution of Cellular Automaton rule #30.
  94. cfd_barba, a Python code which contains some of the iPython workbooks associated with the "12 Steps to Navier-Stokes" presentation by Lorena Barba.
  95. cg, a Python code which implements a simple version of the conjugate gradient (CG) method for solving a system of linear equations of the form A*x=b, suitable for situations in which the matrix A is symmetric positive definite (SPD).
  96. cg_rc, a Python code which implements the conjugate gradient (CG) method for solving a symmetric positive definite (SPD) sparse linear system A*x=b, using reverse communication (RC).
  97. change_diophantine, a Python code which sets up a Diophantine equation to solve the change making problem, which counts the number of ways a given sum can be formed using coins of various denominations.
  98. change_dynamic, a Python code which uses dynamic programming to solve the change making problem, in which a given sum is to be formed using coins of various denominations.
  99. change_greedy, a Python code which uses the greedy method to seek a solution to the change making problem, which tries to match a given amount by selecting coins of various denominations.
  100. change_polynomial, a Python code which uses a polynomial multiplication algorithm to count the ways of making various sums using a given number of coins.
  101. chebyshev, a Python code which computes the Chebyshev interpolant/approximant to a given function over an interval.
  102. chebyshev_interp_1d, a Python code which determines the combination of Chebyshev polynomials which interpolates a set of data, so that p(x(i)) = y(i).
  103. chebyshev_polynomial, a Python code which considers the Chebyshev polynomials T(i,x), U(i,x), V(i,x) and W(i,x). Functions are provided to evaluate the polynomials, determine their zeros, produce their polynomial coefficients, produce related quadrature rules, project other functions onto these polynomial bases, and integrate double and triple products of the polynomials.
  104. chebyshev1_exactness, a Python code which tests the exactness of Gauss-Chebyshev type 1 quadrature rules.
  105. chebyshev1_rule, a Python code which computes and writes out a Gauss-Chebyshev type 1 quadrature rule of given order.
  106. chebyshev2_exactness, a Python code which tests the exactness of Gauss-Chebyshev type 2 quadrature rules.
  107. chebyshev2_rule, a Python code which computes and writes out a Gauss-Chebyshev type 2 quadrature rule of given order.
  108. chen_ode, a Python code which sets up and solves the Chen system of ordinary differential equations (ODE).
  109. chinese_remainder_theorem, a Python code which demonstrates the Chinese remainder theorem, for reconstructing a number based on its remainders against a set of bases.
  110. chrpak, a Python code which manipulates characters and strings;
  111. chuckaluck_simulation, a Python code which simulates the Chuck-a-Luck gambling game.
  112. circle_arc_grid, a Python code which computes grid points along a circular arc.
  113. circle_circles_packing, a Python code which tries to randomly pack as many non-overlapping circles of equal size into a larger circle, with a typical final coverage density of about 0.547. This is an example of random sequential adsorption (RSA).
  114. circle_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected on the circumference of the unit circle.
  115. circle_integrals, a Python code which returns the exact value of the integral of any monomial over the circumference of the unit circle in 2D.
  116. circle_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function along the circumference of the unit circle in 2D;
  117. circle_positive_distance, a Python code which estimates the mean and variance of the distance between a random pair of points on the circumference of the unit positive circle in 2D.
  118. circle_rule, a Python code which computes quadrature rules for the unit circle in 2D, to approximate integrals of f(x,y) over the circumference of the circle of radius 1 and center (0,0).
  119. clausen, a Python code which evaluates a Chebyshev interpolant to the Clausen function Cl2(x).
  120. clenshaw_curtis_rule, a Python code which implements a Clenshaw Curtis quadrature rule;
  121. clock_solitaire_simulation, a Python code which simulates the game of clock solitaire. The deck is dealt into 13 piles of 4 cards each. Repeatedly, the top card a pile is removed, and its rank indicates the next pile to consider. Game continues until an empty pile is reached. The game is won if all piles are empty. The quantity of interest is the probability of winning.
  122. closest_pair_brute, a Python code which uses brute force to solve a 2D version of the closest pair problem, which identifies the closest pair of points in a given collection.
  123. closest_pair_divcon, a Python code which uses a divide and conquer approach to solve a 2D version of the closest pair problem.
  124. closest_point_brute, a Python code which uses brute force to find the nearest of a set of N points in D dimensions to a given test point. This is sometimes called a nearest neighbor calculation.
  125. cobweb_plot, a Python library which displays a cobweb plot illustrating the process of function iteration, by John D Cook.
  126. coin_simulation, a Python code which looks at ways of simulating or visualizing the results of many tosses of a fair or biased coin.
  127. collatz, a Python code which computes and analyzes the Collatz sequence, also known as the hailstone sequence or 3n+1 sequence;
  128. collatz_dict, a Python code which demonstrates how the Python dict variable type can be used to efficiently record data about the Collatz iteration.
  129. collatz_polynomial, a Python code which implements the Collatz polynomial iteration, a polynomial analog of the numerical iteration that is also known as the 3n+1 conjecture or the hailstone sequence.
  130. collatz_recursive, a Python code which demonstrates recursive programming by considering the simple Collatz 3n+1 problem.
  131. columns, a Python code which copies columns clo:chi from a text file to a new text file.
  132. combination_lock, a Python code which simulates the process of determining the secret combination of a lock.
  133. combo, a Python code which ranks, unranks, enumerates, lists and randomly selects balanced sequences, cycles, graphs, Gray codes, subsets, partitions, permutations, restricted growth functions, Pruefer codes and trees.
  134. companion_matrix, a Python code which computes the companion matrix for a polynomial. The polynomial may be represented in the standard monomial basis, or as a sum of Chebyshev, Gegenbauer, Hermite, Laguerre, or Lagrange basis polynomials. All the roots of the polynomial can be determined as the eigenvalues of the corresponding companion matrix.
  135. compass_search, a Python code which seeks the minimizer of a scalar function of several variables using compass search, a direct search algorithm that does not use derivatives.
  136. complex_numbers_test, demonstrates some of the features of using complex numbers.
  137. components, a Python code which organizes contiguous cells into labeled clusters, for a 1D, 2D, or 3D array. This code has uses in image analysis and percolation simulation.
  138. condition, a Python code which implements methods of computing or estimating the condition number of a matrix.
  139. conservation_ode, a Python code which monitors the conservation of a quantity that should be constant, during the solution of an ordinary differential equation (ODE).
  140. continued_fraction, a Python code which implements some simple algorithms for dealing with simple and generalized continued fractions.
  141. convergence, a Python code which is given a sequence of approximation errors and estimates the order of convergence, assuming the results correspond to a a sequence of decreasing mesh sizes h, or increasing mesh counts n.
  142. ConvexHull_test, a Python code which calls ConvexHull(), which is a scipy.spatial function to compute the convex hull of a set of points.
  143. cordic, a Python code which computes a few special functions using the CORDIC algorithm.
  144. cosine_transform, a Python code which demonstrates some simple properties of the discrete cosine transform (DCT).
  145. counterfeit_detection, a Python code which considers problems in which one or more counterfeit coins are to be identified by the fact that they do not have the standard weight.
  146. cpr, a Python code which implements the Chebyshev Proxy Rootfinder (CPR) to locate all the real zeros of a smooth real function f(x) within an interval [a,b], by John Boyd.
  147. craps_simulation, a Python code which simulates the gambling game of craps, in which a player rolls two dice. On the first roll, the player wins immediately if a 7 or 11 is rolled, and loses immediately if a 2, 3 or 12 is rolled. Otherwise, the sum of the dice on this first roll is called the point. The player now continues to roll the dice, winning if the point is rolled again, and losing if a 7 is rolled.
  148. crs_io a Python code which reads and writes sparse linear systems stored in the Compressed Row Storage (CRS) format.
  149. csv_test, a Python code which tests the csv() library for reading and writing Comma Separated Value (CSV) data files.
  150. cube_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the interior of the unit cube in 3D.
  151. cube_exactness, a Python code which tests the exactness of quadrature rules over the interior of a cube in 3D.
  152. cube_grid, a Python code which computes a grid of points over the interior of a cube in 3D.
  153. cube_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit cube in 3D.
  154. cube_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of the unit cube in 3D.
  155. cube_surface_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit cube.
  156. cuda_loop, a Python code which shows how, in a CUDA program running on a Graphics Processing Unit (GPU), the choice of block and thread factors determines the allocation of tasks to processors.
  157. cvt_1d_lloyd, a Python code which computes an N-point Centroidal Voronoi Tessellation (CVT) within the interval [0,1], under a uniform density, using the Lloyd iteration to compute the Voronoi regions exactly.
  158. cvt_1d_sampling, a Python code which computes an N-point Centroidal Voronoi Tessellation (CVT) within the interval [0,1], under a uniform density, using sampling to estimate the Voronoi regions.
  159. cvt_2d_sampling, a Python code which computes an N-point Centroidal Voronoi Tessellation (CVT) within the unit square [0,1]x[0,1], under a uniform density, using sampling to estimate the Voronoi regions.
  160. cvxopt_svm, a Python code which solves a support vector machine (SVM) problem by formulating it as a quadratic programming problem to be solved by cvxopt().
  161. cvxopt_test, a Python code which calls cvxopt(), which solves problems in convex optimization and quadratic programming.
  162. cycle_brent, a Python code which carries out an iterated function evaluation, and seeks to determine the nearest element of a cycle, and the cycle length, using the Brent method.
  163. cycle_floyd, a Python code which carries out an iterated function evaluation, and seeks to determine the nearest element of a cycle, and the cycle length, using the Floyd method.
  164. delaunay_test, a Python code which demonstrates the use of the scipy.spatial function Delaunay(), to compute a Voronoi diagram, and matplotlib.pyplot.triplot(), to display it.
  165. delsq, a Python code which is given a grid G, and returns a corresponding sparse matrix D that defines the Laplacian operator on G.
  166. dg1d_poisson, a Python code which applies the discontinuous Galerkin method (DG) to a 1D version of the Poisson equation, based on a code by Beatrice Riviere.
  167. dice_simulation, a Python code which simulates N tosses of M dice, making a histogram of the resulting sums.
  168. differ, a Python code which is given function values at equally spaced locations, and the order of a derivative, and uses the finite difference method (FDM) to compute a linear combination of these function values which approximates that derivative.
  169. diffusion_pde, a Python code which solves the diffusion partial differential equation (PDE) dudt - mu * d2udx2 = 0 in one spatial dimension, with a constant diffusion coefficient mu, and periodic boundary conditions, using the forward time, centered space (FTCS) difference method.
  170. digital_dice, a Python code which carries out the probability simulations described in "Digital Dice", by Paul Nahin;
  171. digraph_adj, a Python code which carries out operations on abstract digraphs, a kind of graph with directed edges, described by an adjacency matrix.
  172. digraph_dict, a Python code which carries out operations on abstract digraphs, with directed edges, represented by a Python dictionary. The dictionary has a key for each node; the values list the nodes which are immediately reachable from the key node.
  173. dijkstra, a Python code which implements a simple version of the Dijkstra minimum distance algorithm for graphs.
  174. diophantine, a Python code which finds one solution of a Diophantine equation in any number of variables.
  175. diophantine_nd, a Python code which is given a Diophantine equation in N variables, and returns all nonnegative solutions, or all strictly positive solutions.
  176. disk_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected inside the unit disk.
  177. disk_grid, a Python code which computes grid points within the interior of a disk of user specified radius and center in 2D, using matplotlib() to create an image of the grid.
  178. disk_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of a disk of radius R centered at the origin.
  179. disk_integrands, a Python code which defines several test integrals over the unit disk, making it possible to check the accuracy of quadrature rules.
  180. disk_monte_carlo, a Python code which applies a Monte Carlo (MC) method to estimate integrals of a function over the interior of the general disk in 2D;
  181. disk_positive_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected inside the unit positive disk.
  182. disk_rule, a Python code which computes a quadrature rule over the interior of the general disk in 2D.
  183. disk_triangle_picking, a Python code which estimates the expected value of the area of a triangle formed by three randomly selected points in the unit disk.
  184. disk01_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit disk in 2D.
  185. disk01_integrands, a Python code which defines several test integrals over the unit disk, making it possible to check the accuracy of quadrature rules.
  186. disk01_monte_carlo, a Python code which applies a Monte Carlo method to estimate integrals of a function over the interior of the unit disk in 2D;
  187. disk01_positive_monte_carlo, a Python code which applies a Monte Carlo method to estimate integrals of a function over the interior of the unit positive disk in 2D;
  188. disk01_rule, a Python code which computes a quadrature rule to approximate the integral of a function over the interior of the unit disk in 2D, with radius 1 and center (0,0).
  189. divdif, a Python code which creates, prints and manipulates divided difference polynomials from a table of values (x,f(x)). The code can compute the coefficients of the Newton and power sum forms of the interpolating polynomial. It can compute the derivative or antiderivate polynomial. It can compute the form of the Lagrange basis polynomials. It can compute the points and weights for Newton Cotes quadrature rules. It can compute the weights for a Lagrange interpolation scheme.
  190. dolfin-convert, a Python code which converts mesh file from gmsh(), medit(), METIS or SCOTCH format to an XML format suitable for use by dolfin() or fenics(), by Anders Logg.
  191. doomsday, a Python code which is given the year, month and day of a date, and uses John Conway's doomsday algorithm to determine the corresponding day of the week.
  192. dosage_ode, a Python code which sets up a system of ordinary differential equations (ODE) to simulate the blood levels of a medicinal drug that should stay between medicinal and toxic limits.
  193. double_well_ode, a Python code which sets up an ordinary differential equation (ODE) which models the motion of a particle in a double well potential.
  194. duel_simulation, a Python code which simulates N repetitions of a duel between two players, each of whom has a known firing accuracy.
  195. dueling_idiots, a Python code which carries out the probability simulations described in "Dueling Idiots", by Paul Nahin;
  196. duffing_ode, a Python code which sets up a second-order ordinary differential equation (ODE) whose solution can exhibit chaotic behavior.
  197. e_spigot, a Python code which produces N digits of the decimal expansion of e.
  198. eigs_test, a Python code which calls np.linalg.eig(), which is a built-in system function which computes the eigenvalues and eigenvectors of a matrix.
  199. elements, a Python code which stores the atomic number, atomic weight, element name and element symbol for the chemical elements.
  200. ellipse, a Python code which carries out geometric calculations for ellipses and ellipsoids, including area, distance to a point, eccentricity, perimeter, points along the perimeter, random sampling, conversion between standard and quadratic forms.
  201. ellipse_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected on the circumference of the ellipse (x/a)^2+(y/b)^2=1 in 2D.
  202. ellipse_grid, a Python code which computes grid points over the interior of an ellipse in 2D.
  203. ellipse_monte_carlo, a Python code which uses the Monte Carlo method to estimate the value of integrals over the interior of an ellipse in 2D.
  204. ellipsoid, a Python code which carries out geometric calculations for ellipsoids, including area, random sampling, conversion between standard and quadratic forms.
  205. ellipsoid_grid, a Python code which computes a grid of points over the interior of an ellipsoid in 3D.
  206. ellipsoid_monte_carlo, a Python code which uses the Monte Carlo method to estimate the value of integrals over the interior of an ellipsoid in M dimensions.
  207. elliptic_integral, a Python code which evaluates complete elliptic integrals of first, second and third kind, using the Carlson elliptic integral functions.
  208. epicycloid, a Python code which plots an epicycloid curve.
  209. eros, a Python code which implements elementary row operations (EROs) for the interactive solution of a system of linear equations.
  210. euclid, a Python code which investigates various versions of Euclid's algorithm for computing the greatest common divisor (GCD) of two integers.
  211. euler, a Python code which solves one or more ordinary differential equations (ODE) using the forward Euler method.
  212. exactness, a Python code which tests the exactness of quadrature rules that estimate the integral of a function with a density, such as 1, exp(-x) or exp(-x^2), over an interval such as [-1,+1], [0,+oo) or (-oo,+oo).
  213. exp_ode, a Python code which sets up an ordinary differential equation (ODE) whose solution is an exponential function.
  214. fair_dice_simulation, a Python code which simulates N tosses of 2 dice, making a histogram of the resulting sums.
  215. fd_predator_prey, a Python code which solves a time-dependent predator prey system using the finite difference method (FDM).
  216. fd1d_advection_lax_wendroff, a Python code which applies the finite difference method (FDM) to solve the time-dependent advection equation ut = - c * ux in one spatial dimension, with a constant velocity, using the Lax-Wendroff method to approximate the time derivative, creating a graphics file with matplotlib().
  217. fd1d_bvp, a Python code which applies the finite difference method (FDM) to a two point boundary value problem (BVP) in one spatial dimension.
  218. fd1d_heat_explicit, a Python code which implements a finite difference method (FDM), explicit in time, to solve the time dependent 1D heat equation;
  219. fd1d_heat_implicit, a Python code which implements a finite difference method (FDM), implicit in time, to solve the time dependent 1D heat equation;
  220. fd1d_wave, a Python code which applies the finite difference method (FDM) to solve the time-dependent wave equation utt = c * uxx in one spatial dimension.
  221. fd2d_convergence_test, a Python code which calls fd2d_poisson(), which repeatedly solves a Poisson equation on a sequence of finer meshes, so that the relationship between mesh size H and error norm E can be explored.
  222. fd2d_heat_steady, a Python code which implements a finite difference method (FDM) for the steady time-independent 2D heat equation;
  223. fem_basis, a Python code which defines and evaluates finite element method (FEM) basis functions for any degree in an M dimensional simplex (1D interval, 2D triangle, 3D tetrahedron, and higher dimensional generalizations.)
  224. fem_to_xml, a Python code which reads a pair of FEM files defining node coordinates and elements, of a 1D, 2D or 3D mesh, namely a file of node coordinates and a file of elements defined by node indices, and creates a corresponding XML file for input to dolfin() or fenics().
  225. fem1d, a Python code which applies the finite element method (FEM) to a boundary value problem (BVP) in one spatial dimension, using a procedural approach.
  226. fem1d_bvp_linear, a Python code which applies the finite element method (FEM), with piecewise linear elements, to a two point boundary value problem (BVP) in one spatial dimension, and compares the computed and exact solutions with the L2 and seminorm errors.
  227. fem1d_bvp_quadratic, a Python code which applies the finite element method (FEM), with piecewise quadratic elements, to a two point boundary value problem (BVP) in one spatial dimension, and compares the computed and exact solutions with the L2 and seminorm errors.
  228. fem1d_heat_explicit, a Python code which uses the finite element method (FEM) and explicit time stepping to solve the time dependent heat equation in 1D.
  229. fem1d_model, a Python code which applies the finite element method (FEM) to a boundary value problem (BVP) in one spatial dimension, using a procedural approach.
  230. fem2d_bvp_linear, a Python code which applies the finite element method (FEM), with piecewise bilinear elements, to a 2D boundary value problem (BVP) in a rectangle.
  231. fern, a Python code which computes and displays the Barnsley fractal fern.
  232. fibonacci_spiral, a Python code which displays points on a Fibonacci spiral, suggesting the arrangement of seeds in a sunflower, for instance.
  233. file_name_sequence, a Python code which generates a sequence of filenames, which can be useful when generating a sequence of still snapshots to be animated later.
  234. filum, a Python code which performs various operations on files;
  235. fire_simulation, a Python code which simulates a forest fire over a rectangular array of trees, starting at a single random location. It is intended as a starting point for the development of a parallel version.
  236. fisher_exact, a Python code which returns an exact solution of the Kolmogorov Petrovsky Piskonov Fisher partial differential equation (PDE) ut=uxx+u*(1-u).
  237. fisher_pde_ftcs, a Python code which estimates a solution of the Kolmogorov Petrovsky Piskonov Fisher partial differential equation (PDE) ut=uxx+u*(1-u), using the forward time centered space (FTCS) method, with an oscillating Dirichlet condition on the left, and a zero Neumann condition on the right. An animation of the solution is created.
  238. fitzhugh_nagumo_ode, a Python code which sets up the Fitzhugh-Nagumo system of ordinary differential equations (ODE).
  239. flame_exact, a Python code which returns the exact solution of an ordinary differential equation (ODE) which models the growth of a ball of flame in a combustion process. The exact solution is defined in terms of the Lambert W function.
  240. flame_ode, a Python code which sets up an ordinary differential equation (ODE) which models the growth of a ball of flame in a combustion process. The exact solution is defined in terms of the Lambert W function.
  241. flame_odefun, a Python code which uses odefun() from the multiple precision package mpmath() to solve an ordinary differential equation (ODE) which models the growth of a ball of flame in a combustion process. The exact solution is defined in terms of the Lambert W function.
  242. flies_simulation, a Python code which simulates an experiment in which two flies land on a plate of radius 1. By repeating the experiment many times, the average distance between the flies is to be estimated.
  243. florida_cvt_geo, a Python code which explores the creation of a centroidal Voronoi Tessellation (CVT) of the state of Florida, based solely on geometric considerations.
  244. florida_cvt_pop, a Python code which explores the creation of a centroidal Voronoi Tessellation (CVT) of the state of Florida, based on population considerations.
  245. floyd, a Python code which implements the Floyd algorithm for finding the shortest distance between pairs of nodes on a directed graph.
  246. fly_simulation, a Python code which simulates an experiment in which a fly lands on a plate of radius 1. By repeating the experiment many times, the average distance of the fly from the center is to be estimated.
  247. fn, a Python code which evaluates elementary and special functions using Chebyshev polynomials; functions include Airy, Bessel I, J, K and Y, beta, confluent hypergeometric, error, gamma, log gamma, Pochhammer, Spence; integrals include hyperbolic cosine, cosine, Dawson, exponential, logarithmic, hyperbolic sine, sine; by Wayne Fullerton.
  248. football_dynamic, a Python code which uses dynamic programming to count the ways of achieving a given score in football, respecting the order of events.
  249. football2_diophantine, a Python code which uses diophantine analysis to count the ways of achieving a given score in football, ignoring the order of events.
  250. football2_dynamic, a Python code which uses dynamic programming to count the ways of achieving a given score in football, respecting the order of events.
  251. four_fifths, a Python code which searches for a solution to the problem of finding four fifth powers that sum to a fifth power, that is, integers a, b, c, d and e such that a^5+b^5+c^5+d^5=e^5. Euler conjectured that no solution was possible. The code is by Brian Hayes.
  252. freefem_msh_io, a Python code which reads and writes files used by the FreeFem++ finite element program to store mesh information.
  253. fsolve_test, a Python code which calls fsolve() which seeks the solution x of one or more nonlinear equations f(x)=0.
  254. full_deck_simulation, a Python code which simulates a process in which a random card is drawn from a deck of 52, and then replaced, continuing until every card has been seen at least once.
  255. gamblers_ruin_simulation, a Python code which simulates a game in which a gambler never stops playing until all money is lost.
  256. gauss_seidel, a Python code which uses the Gauss-Seidel iteration to solve a linear system with a symmetric positive definite (SPD) matrix.
  257. gauss_seidel_stochastic, a Python code which uses a stochastic version of the Gauss-Seidel iteration to solve a linear system with a symmetric positive definite (SPD) matrix.
  258. gaussian, a Python code which evaluates the Gaussian function and its derivatives.
  259. gaussian_2d, a Python code which evaluates a general Gaussian function of a 2D argument.
  260. gaussian_prime_spiral, a Python code which computes a twisting spiral path along the Gaussian primes, and displays a plot of the total trajectory.
  261. ge_to_crs, a Python code which converts a matrix from General (GE) to Compressed Row Storage (CRS) format.
  262. gegenbauer_cc, a Python code which computes the Gegenbauer weighted integral of a function f(x) using a Clenshaw-Curtis approach.
  263. gegenbauer_exactness, a Python code which tests the exactness of Gauss-Gegenbauer quadrature rules.
  264. gegenbauer_polynomial, a Python code which evaluates the Gegenbauer polynomial and associated functions.
  265. gen_hermite_exactness, a Python code which tests the exactness of generalized Gauss-Hermite quadrature rules.
  266. gen_laguerre_exactness, a Python code which tests the exactness of generalized Gauss-Laguerre quadrature rules.
  267. geometry, a Python code which performs geometric calculations in 2, 3 and M dimensional space, including the computation of angles, areas, containment, distances, intersections, lengths, and volumes.
  268. gl_fast_rule, a Python code which carries out the rapid computation of the Kth value and weight of an N point Gauss-Legendre quadrature rule for approximating the integral of a function over the interval [-1,+1], by Ignace Bogaert.
  269. glomin, a Python code which finds a global minimum of a scalar function of a scalar argument, without the use of derivative information, by Richard Brent.
  270. glycolysis_ode, a Python code which sets up a pair of ordinary differential equations (ODE) that model the biochemical process of glycolysis, for which a limit cycle exists.
  271. gmgsolve, a Python code which applies one step of the V-cycle of the geometric multigrid method, by Mike Sussman.
  272. gradient_descent, a Python code which uses gradient descent to solve a linear least squares (LLS) problem.
  273. gram_polynomial, a Python code which evaluates the Gram polynomials, also known as the discrete Chebyshev polyomials and associated functions.
  274. gram_schmidt, a Python code which implements the Gram-Schmidt process to orthogonalize and normalize a set of vectors.
  275. graph_adj, a Python code which carries out operations on abstract graphs, with undirected edges, represented by an adjacency matrix. Operations included breadth-first search, the computation of a minimum spanning tree, an Euler or Hamilton circuit, blocks, chromatic polynomial, or transitive closure.
  276. graph_class, a Python code which creates classes related to abstract graphs, and uses them to define various algorithms include breadth-first search, depth-first search, and shortest path.
  277. graphics_test, a Python code which demonstrates techniques for creating a graphic display of a variety of scientific data.
  278. graphviz_test, a Python code which calls graphiviz(), which displays representations of graphs.
  279. grazing_ode, a Python code which sets up ordinary differential equations (ODE) that model the populations of an edible plant, and the herbivore that grazes on it.
  280. grf_io, a Python code which reads or writes a GRF file which represents a mathematical graph;
  281. gurobi_solution_read, a Python code which reads a file created by the optimization package gurobi(), representing the solution of a polyomino tiling problem, and writes an ASCII file that can be read by load().
  282. gyroscope_ode, a Python code which sets up the ordinary differential equations (ODE) that simulate the angular attitude and rotational speed of a gyroscope.
  283. haar_transform, a Python code which computes the Haar transform of 1d or 2d data.
  284. halton, a Python code which computes elements of a Halton Quasi Monte Carlo (QMC) sequence, using a simple interface.
  285. hammersley, a Python code which computes elements of a Hammersley Quasi Monte Carlo (QMC) sequence, using a simple interface.
  286. hamming, a Python code which implements some simple versions of Hamming codes which can detect and correct errors in data.
  287. hankel_cholesky, a Python code which computes the upper Cholesky factor R of a symmetric positive definite (SPD) H matrix so that H = R' * R.
  288. hankel_cholesky, a Python code which computes the upper Cholesky factor R of a symmetric positive definite (SPD) Hankel matrix so that H = R' * R.
  289. hankel_spd, a Python code which computes a lower triangular matrix L which is the Cholesky factor of a symmetric positive definite (SPD) Hankel matrix H, that is, H = L * L'.
  290. hdf5_test, a Python code which demonstrates the use of the HDF5 library and file format.
  291. heartbeat_ode, a Python code which sets up and solves an ordinary differential equation (ODE) describing the beating of the heart, as suggested by Zeeman.
  292. hello, a Python code which prints "Hello, world!".
  293. hello_mpi, a Python code which prints "Hello, world!", carried out in parallel using MPI and MPI4PY.
  294. helmholtz_exact, a Python code which evaluates an exact formula for the solution of the Helmholtz equation, a sort of eigenvalue equation that can arise after separation of variables is a applied to the wave equation. This example considers a problem in which Z(x,y) represents the vertical deflection of the surface of a vibrating circular membrane such as a drumhead.
  295. henon_heiles_ode, a Python code which sets up the Henon-Heiles system of ordinary differential equations (ODE) which model the motion of a star around the galactic center.
  296. henon_orbit, a Python code which computes the orbit of the Henon map for various sets of initial data.
  297. hermite_exactness, a Python code which tests the exactness of Gauss-Hermite quadrature rules to estimate the integral of a function with density exp(-x^2) over the interval (-oo,+oo).
  298. hermite_polynomial, a Python code which evaluates the physicist's Hermite polynomial, the probabilist's Hermite polynomial, the Hermite function, and related functions.
  299. hermite_rule, a Python code which returns a Gauss-Hermite quadrature rule to estimate the integral of a function with density exp(-x^2) over the interval (-oo,+oo).
  300. hexagon_integrals, a Python code which returns the exact value of the integral of a monomial over the interior of a hexagon in 2D.
  301. hexagon_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of a hexagon in 2D;
  302. hexagon_stroud_rule, a Python code which computes one of four Stroud quadrature rules over the interior of the unit hexagon.
  303. hexahedron_jaskowiec_rule, a Python code which returns a symmetric Jaskowiec quadrature rule for the hexahedron, with exactness up to total degree 21.
  304. hexahedron_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for the hexahedron, with exactness up to total degree 11.
  305. high_card_simulation, a Python code which simulates a situation in which you see the cards in a deck one by one, and must select the one you think is the highest and stop.
  306. hilbert_curve, a Python code which computes the sequence of discrete Hilbert curves whose limit is a space-filling curve.
  307. hilbert_curve_3d, a Python code which converts 3D Hilbert curve data between spatial coordinates of a lattice point (x,y,z) and the linear coordinate H which describes the ordering of that point on the curve.
  308. hits, a Python code which uses the HITS algorithm to assign authority and hub indices to a set of nodes in a directed network.
  309. humps, a Python code which evaluates the humps function, its first and second derivatives and its antiderivative.
  310. humps_ode, a Python code which sets up an ordinary differential equation (ODE) whose solution is a double hump curve.
  311. hyper_2f1, a Python code which evaluates the hypergeometric functions 2F1(a,b,c;x) for real or complex argument x. For convenience, this function is simply a wrapper for the corresponding function in the scipy.special() library.
  312. hyperball_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from the interior of the unit hyperball in M dimensions.
  313. hyperball_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit hyperball in M dimensions.
  314. hyperball_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of the unit ball in M dimensions;
  315. hyperball_positive_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected from the interior of the unit positive hyperball in M dimensions.
  316. hypercube_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected in the M-dimensional unit hypercube.
  317. hypercube_grid, a Python code which computes a grid of points over the interior of a hypercube in M dimensions.
  318. hypercube_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit hypercube in M dimensions.
  319. hypercube_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of the unit hypercube in M dimensions.
  320. hypercube_surface_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit hypercube in D dimensions.
  321. hypersphere, a Python code which carries out various operations for a D dimensional hypersphere, including converting between Cartesian and spherical coordinates, stereographic projection, sampling the surface of the sphere, and computing the surface area and volume.
  322. hypersphere_angle, a Python code which considers the problem of describing the typical value of the angle between a pair of points randomly selected on the unit hypersphere in M dimensions. Since by symmetry, this will be zero, we instead look at the average of the absolute value of the dot product, and the corresponding angle. In dimension 1, we have average dot product of 1, and angle 0. As the dimension increases, the average dot product rapidly decreases to 0, while the average angle goes to 90 degrees.
  323. hypersphere_angle_distance, a Python code which considers the problem of describing the typical value of the angle between a pair of points randomly selected on the unit hypersphere in M dimensions. Since by symmetry, this will be zero, we instead look at the average of the absolute value of the dot product, and the corresponding angle. In dimension 1, we have average dot product of 1, and angle 0. As the dimension increases, the average dot product rapidly decreases to 0, while the average angle goes to 90 degrees.
  324. hypersphere_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from the surface of the unit hypersphere in M dimensions.
  325. hypersphere_integrals, a Python code which returns the exact value of the integral of any monomial over the surface of the unit hypersphere in M dimensions.
  326. hypersphere_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function on the surface of the unit sphere in M dimensions;
  327. hypersphere_positive_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from the surface of the unit positive hypersphere in M dimensions.
  328. i4lib, a Python code which contains many utility routines, using single precision integer (I4) arithmetic.
  329. ill_bvp, a Python code which defines an ill conditioned boundary value problem (BVP), and calls on scipy.integrate.solve_bvp() to solve it with various values of the conditioning parameter.
  330. image_boundary, a Python code which selects and displays the boundary edges in an image.
  331. image_edge, a Python code which detects edges in an image.
  332. image_rgb_to_gray, a Python code which makes a grayscale version of an RGB image.
  333. insurance_simulation, a Python code which simulates a highly simplified model of term life insurance, in which a customer agrees to pay an annual fee for a given number of years, so that if the customer dies within that term, the family receives a large payout.
  334. is_gaussian_prime, a Python code which is true if a given complex number c is a Gaussian prime.
  335. is_prime, a Python code which is true if a given integer n is prime.
  336. isbn, a Python code which determines the check digit for an International Standard Book Number (ISBN), or reports whether a given ISBN is valid.
  337. ising_2d_simulation, a Python code which simulates the evolution of a 2D array of positive and negative charges, each of which is likely to flip to be in agreement with neighbors.
  338. jaccard_distance, a Python code which computes the Jaccard distance between two sets.
  339. jacobi, a Python code which implements the Jacobi iteration for the iterative solution of linear systems.
  340. jacobi_eigenvalue, a Python code which implements the Jacobi iteration for the iterative determination of the eigenvalues and eigenvectors of a real symmetric matrix.
  341. jacobi_exactness, a Python code which tests the exactness of rules for integrals with a Jacobi weight function.
  342. jacobi_poisson_1d, a Python code which uses Jacobi iteration to solve the linear system for a discretized steady 1D Poisson equation.
  343. jacobi_rule, a Python code which computes a Gauss-Jacobi quadrature rule.
  344. jai_alai_simulation, a Python code which simulates a sequence matches of the game of jai alai.
  345. jordan_matrix, a Python code which returns a random matrix in Jordan canonical form.
  346. joukowsky_transform, a Python code which applies the Joukowsky transform to data, mapping between a circle in the complex plane and various airfoil shapes.
  347. julia_set, a Python code which computes and plots a Julia set, the set of points in the complex plane that remain bounded under a mapping of the form f(z) = z^2+c.
  348. kdv_exact, a Python code which evaluates an exact solution of the Korteweg-deVries (KdV) partial differential equation (PDE).
  349. kepler_ode, a Python code which sets up the ordinary differential equations (ODE) for a Kepler two-body gravitational system.
  350. knapsack_01_brute, a Python code which uses brute force to solve small versions of the 0/1 knapsack problem, in which a knapsack of limited weight capacity is to be packed as full as possible, selecting items from a set of varying weights;
  351. knapsack_brute, a Python code which uses brute force to solve small versions of the knapsack problem, in which N items are available, each with given value and weight. A thief's knapsack can carry no more than Wmax pounds. The thief seeks a selection of items to carry in the knapsack of maximum total value.
  352. knapsack_dynamic, a Python code which uses dynamic programming to solve a knapsack problem.
  353. knapsack_greedy, a Python code which uses a greedy algorithm to estimate a solution of the knapsack problem;
  354. knapsack_random, a Python code which randomly chooses a subset of N items, each with given value and weight. It then evaluates whether this is a feasible solution to a problem in which a thief's knapsack can carry no more than Wmax pounds, and it is desired to maximum the total value of the selected items.
  355. knapsack_rational, a Python code which solves the rational knapsack problem, in which a knapsack of limited weight capacity is filled with profitable items. This variation of the 0/1 knapsack problem allows a fractional part of an item to be included in the knapsack. The result is an upper bound on the maximum possible profit for the 0/1 knapsack problem.
  356. knapsack_values, a Python code which returns some simple examples of the knapsack problem, in which N items are available, each with given value V and weight W. A thief's knapsack can carry no more than K pounds. The thief seeks a selection S of items to carry in the knapsack of maximum total value.
  357. kronrod_rule, a Python code which computes a Gauss and Gauss-Kronrod pair of quadrature rules of arbitrary order, by Robert Piessens, Maria Branders.
  358. lagrange_approx_1d, a Python code which defines and evaluates the Lagrange polynomial p(x) of degree m which approximates a set of nd data points (x(i),y(i)).
  359. lagrange_basis_display, a Python code which displays the basis functions associated with a given set of nodes used with the Lagrange interpolation scheme.
  360. lagrange_interp_1d, a Python code which defines and evaluates the Lagrange polynomial p(x) which interpolates a set of data depending on a 1D argument, so that p(x(i)) = y(i).
  361. laguerre_exactness, a Python code which tests the exactness of Gauss-Laguerre quadrature rules for integrating functions with density exp(-x) over [0,+oo).
  362. laguerre_polynomial, a Python code which evaluates the Laguerre polynomial, the generalized Laguerre polynomials, and the Laguerre function.
  363. laguerre_rule, a Python code which returns a Gauss-Laguerre quadrature rule of given order.
  364. lambert_w, a Python code which evaluates Lambert's W function.
  365. langford_ode, a Python code which sets up and solves the Langford system of ordinary differential equations (ODE).
  366. laplacian, a Python code which evaluates a discretized approximation to the Laplacian operator on data on an evenly spaced grid, within a circle, an interval, or a torus. For the case of the interval, the data may be supplied on an unevenly spaced grid.
  367. latin_center, a Python code which computes N points in an M dimensional Latin Center square;
  368. latin_edge, a Python code which returns N points in an M dimensional Latin Edge square;
  369. latin_random, a Python code which computes Latin Random Squares of N points in M dimensions;
  370. leapfrog, a Python code which uses the leapfrog method to solve a second order ordinary differential equation (ODE) of the form y''=f(t,y).
  371. lebesgue, a Python code which is given a set of nodes in 1D, and plots the Lebesgue function, and estimates the Lebesgue constant, which measures the maximum magnitude of the potential error of Lagrange polynomial interpolation.
  372. legendre_exactness, a Python code which tests the exactness of quadrature rules for the Legendre problem of integrating a function with density 1 over the interval [-1,+1].
  373. legendre_polynomial, a Python code which evaluates the Legendre polynomial and associated functions.
  374. legendre_product_polynomial, a Python code which defines Legendre product polynomials, creating a multivariate polynomial as the product of univariate Legendre polynomials.
  375. legendre_rule, a Python code which returns a Gauss-Legendre quadrature rule of given order.
  376. legendre_shifted_polynomial, a Python code which evaluates the shifted Legendre polynomial, with the domain [0,1].
  377. levenshtein_distance, a Python code which returns the Levenshtein distance between two strings.
  378. levenshtein_matrix, a Python code which returns the Levenshtein distance matrix defined by two strings.
  379. lindberg_exact, a Python code which evaluates the exact solution of the Lindberg ordinary differential equations (ODE), a system that is extremely difficult to solve accurately.
  380. lindberg_ode, a Python code which sets up a system of 4 ordinary differential equations (ODE) which are very stiff.
  381. line_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit line segment.
  382. line_grid, a Python code which computes a grid of points over the interior of a line segment in 1D.
  383. line_integrals, a Python code which returns the exact value of the integral of any monomial over the length of the unit line in 1D.
  384. line_lines_packing, an Octave code which tries to randomly pack as many non-overlapping equal line segments as possible into a larger line segment, estimating Renyi's parking constant of 0.7475979202. This is an example of random sequential adsorption (RSA).
  385. line_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the length of the unit line in 1D.
  386. line_ncc_rule, a Python code which computes a Newton Cotes Closed (NCC) quadrature rule, using equally spaced points, over the interior of a line segment in 1D.
  387. linear_algebra, a Python code which carry out various linear algebra operations for matrices stored in a variety of formats.
  388. linpack_d, a Python code which factors and solves linear systems using real 64 bit arithmetic, by Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart. The matrix and vector data is assumed to be real.
  389. linplus_c8, a Python code which carries out some linear algebra operations on complex matrices.
  390. lissajous, a Python code which displays a Lissajous figure, of the form x = sin ( a1 t + b1 ), y = sin ( a2 t + b2 ).
  391. llsq, a Python code which solves the simple linear least squares (LLS) problem of finding the formula of a straight line y=a*x+b which minimizes the root mean square error to a set of N data points.
  392. loadtxt_test, a Python program which calls the numpy() function loadtxt() to extract numeric data from a text file.
  393. lobatto_polynomial, a Python code which evaluates Lobatto polynomials, which are similar to Legendre polynomials except that they are 0 at both endpoints.
  394. local_min, a Python code which finds a local minimum of a scalar function of a scalar variable, without the use of derivative information, by Richard Brent.
  395. local_min_rc, a Python code which finds a local minimum of a scalar function of a scalar variable, without the use of derivative information, using reverse communication (RC), by Richard Brent.
  396. locker_simulation, a Python code which simulates the locker problem, in which gym users have left their wallets in lockers; someone has scrambled all the lockers, and the gym users need a strategy that maximizes the chance that everyone will find their wallet by searching a limited number of lockers.
  397. log_norm, a Python code which computes the logarithmic norm of a matrix, for norms 1, 2 and oo.
  398. log_normal, a Python code which returns quantities related to the log normal Probability Distribution Function (PDF).
  399. log_normal_truncated_ab, a Python code which returns quantities related to the log normal Probability Distribution Function (PDF) truncated to the interval [A,B].
  400. logistic_bifurcation, a Python code which computes the bifurcation diagram for the logistic equation, by John Cook.
  401. logistic_exact, a Python code which evaluates an exact solution of the logistic equation, an ordinary differential equation (ODE) which models population growth in the face of a limited carrying capacity.
  402. logistic_ode, a Python code which sets up and solves an ordinary differential equation (ODE) which models population growth in the face of a limited carrying capacity.
  403. lorenz_ode, a Python code which sets up the Lorenz system of ordinary differential equations (ODE), creating graphics files using matplotlib().
  404. lorenz_ode_sensitivity_test, a Python code which demonstrates sensitivity to initial conditions in the Lorenz system of ordinary differential equations (ODE), using an approach suggested by John D Cook.
  405. lucas_lehmer, a Python code which determines whether a Mersenne number 2^n-1 is prime by applying the Lucas-Lehmer test.
  406. luhn, a Python code which computes the Luhn check digit for a string, or verifies a string, as used for error detection in credit card numbers.
  407. machar, a Python code which dynamically computes the values of various machine characteristic constants, by William Cody;
  408. machine, a Python code which returns tabulated values of the constants associated with computer arithmetic;
  409. magic_matrix, a Python code which computes a magic matrix, for any odd order n, such that all rows and columns have the same sum.
  410. mandelbrot, a Python code which generates an image of the Mandelbrot set;
  411. mandelbrot_orbit, a Python code which generates the Mandelbrot iterates arising from a single starting point;
  412. mario, a Python code which creates a sort of needlepoint image of Mario, as an array of colored squares.
  413. markov_text, a Python code which uses a Markov Chain Monte Carlo (MCMC) process to sample an existing text file and create a new text that is randomized, but retains some of the structure of the original one.
  414. matrix_chain_brute, a Python code which finds the cost of the most efficient ordering to use when multiplying a sequence of matrices, using brute force.
  415. matrix_chain_dynamic, a Python code which finds the cost of the most efficient ordering to use when multiplying a sequence of matrices, using dynamic programming..
  416. matrix_exponential, a Python code which demonstrates some simple approaches to the problem of computing the exponential of a matrix.
  417. mcnuggets, a Python code which counts M(N), the number of ways a given number N of Chicken McNuggets can be assembled, given that they are only available in packages of 6, 9, and 20.
  418. mcnuggets_diophantine, a Python code which uses Diophantine methods to find the ways a given number N of Chicken McNuggets can be assembled, given that they are only available in packages of 6, 9, and 20.
  419. md, a Python code which carries out a molecular dynamics (MD) simulation, intended as a starting point for implementing a parallel version.
  420. mesh_boundary, a Python code which is given a mesh of a 2D region, formed by polygonal elements, and determines a sequence of pairs of polygonal vertices that define the boundary of the region.
  421. mesh_etoe, a Python code which uses ETOV, the mesh element-to-vertex connectivity, to construct ETOE, the element-to-element connectivity.
  422. mgs, a Python code which is an obscure legacy code, which the student is encouraged to study, understand, and document. This example is due to Diane O'Leary.
  423. mhd_exact, a Python code which evaluates Hartmann's exact formula for a solution of the magnetohydrodynamic (MHD) fluid flow equations in 2D.
  424. middle_square, a Python code which implements the middle square algorithm for generating random integers. This is a very early method, attributed to von Neumann, which actually is deeply flawed, with short cycles.
  425. midpoint, a Python code which solves one or more ordinary differential equations (ODE) using the implicit midpoint method.
  426. midpoint_adaptive, a Python code which solves one or more ordinary differential equations (ODE) using the (implicit) midpoint method, with fsolve() solving the implicit equation, and an adaptive time step. Plots of the solution and timestep history are created.
  427. midpoint_explicit, a Python code which solves one or more ordinary differential equations (ODE) using the explicit midpoint method, also called the modified Euler method.
  428. midpoint_fixed, a Python code which solves one or more ordinary differential equations (ODE) using the implicit midpoint method, using a simple fixed-point iteration to solve the implicit equation.
  429. monomial, a Python code which enumerates, lists, ranks, unranks and randomizes multivariate monomials in a space of M dimensions, with total degree less than N, equal to N, or in a given range.
  430. monomial_value, a Python code which evaluates a monomial in M dimensions.
  431. monopoly_matrix, a Python code which computes the adjacency and transition matrices for the game of Monopoly.
  432. monty_hall_simulation, a Python code which simulates the "Let's Make a Deal" game in which Monty Hall has hidden a prize behind one of several doors, and the user wins the prize if the correct door is selected.
  433. mortality, a Python code which processes some sample mortality data.
  434. movie_test, a Python code which creates a movie file from a sequence of solutions to a partial differential equation, using matplotlib().
  435. mxm, a Python code which sets up a matrix multiplication problem A=B*C of arbitrary size, and compares the time required for IJK, IKJ, JIK, JKI, KIJ and KJI orderings of the loops.
  436. naca, a Python code which takes the parameters of certain NACA airfoils and returns the coordinates of a sequence of points that outline the wing shape.
  437. navier_stokes_2d_exact, a Python code which evaluates an exact solution to the incompressible time-dependent Navier-Stokes equations (NSE) over an arbitrary domain in 2D.
  438. navier_stokes_3d_exact, a Python code which evaluates an exact solution to the incompressible time-dependent Navier-Stokes equations (NSE) over an arbitrary domain in 3D.
  439. nearest_interp_1d, a Python code which interpolates a set of data using a piecewise constant interpolant defined by the nearest neighbor criterion, creating graphics files for processing by matplotlib().
  440. neighbor_states, a Python code which creates a plot of the US based only on information about pairs of US states which are neighbors.
  441. neural_network, a Python code which illustrates the use of neural networks for deep learning, using back propagation and stochastic gradient descent, by Catherine Higham and Desmond Higham.
  442. newton, a Python code which applies the Newton method to solve a single nonlinear equation f(x)=0.
  443. newton_interp_1d, a Python code which finds a polynomial interpolant to data using Newton divided differences.
  444. ngrams, a Python code which analyzes a string or text against the observed frequency of ngrams, that is, particular sequences of n letters, in English text.
  445. normal, a Python code which implements a random number generator (RNG) for normally distributed values;
  446. normal_dataset, a Python code which creates a multivariate normal random dataset and writes it to a file.
  447. normal_ode, a Python code which sets up an ordinary differential equation (ODE) defining the normal probability density function (PDF).
  448. normal01_multivariate_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from an isotropic standard normal distribution in M dimensions.
  449. numgrid, a Python code which defines and numbers a subset of the nodes in a regular nxn grid of the [-1,+1]x[-1,+1] unit square.
  450. ode_euler, a Python code which applies the Euler method to estimate the solution of an ordinary differential equation y'=f(x,y), over the interval [a,b], with initial condition y(a)=ya, using n steps.
  451. odefun_test, a Python code which uses odefun() from the multiple precision package mpmath() to solve some simple ordinary differential equations (ODE).
  452. oregonator_ode, a Python code which sets up the ordinary differential equations (ODE) for the Oregonator, a model of the Belousov-Zhabotinsky chemical reaction.
  453. ornstein_uhlenbeck, a Python code which approximates solutions of the Ornstein-Uhlenbeck stochastic differential equation (SDE) using the Euler method, the Euler-Maruyama method, and the Milstein method.
  454. oscillator_ode, a Python code which sets up the highly oscillatory ordinary differential equation (ODE).
  455. owen, a Python code which evaluates the Owen T function;
  456. ozone_ode, a Python code which sets up a stiff system of four ordinary differential equations (ODE) that simulate the daily variation in atmospheric ozone concentration.
  457. ozone2_ode, a Python code which sets up a stiff system of four ordinary differential equations (ODE) that simulate the daily variation in atmospheric ozone concentration. This version of the ozone ODE includes a nitrogen oxide source term.
  458. padua, a Python code which returns the coordinates of the 2D Padua points, as well as interpolation weights or quadrature weights, and images of the points graphics files.
  459. pagerank, a Python code which illustrates the eigenvalue (power method) and surfer (Markov Chain Monte Carlo MCMC) approaches to ranking web pages.
  460. pariomino, a Python code which considers pariominoes, which are polyominoes with a checkerboard parity.
  461. partition_brute, a Python code which uses a brute force algorithm to seek solutions of the partition problem, splitting a set of integers into two subsets with equal sum.
  462. partition_greedy, a Python code which uses a greedy algorithm to seek a solution of the partition problem, in which a given set of integers is to be split into two groups whose sums are as close as possible.
  463. patterson_rule, a Python code which returns the points and weights of a 1D Gauss-Patterson quadrature rule of order 1, 3, 7, 15, 31, 63, 127, 255 or 511.
  464. pbma_io, a Python code which reads or writes ASCII Portable Bit Map (PBM) 2D graphics files;
  465. pbmb_io, a Python code which reads or writes a binary Portable Bit Map (PBM) 2D graphics file;
  466. pdflib, a Python code which evaluates Probability Density Functions (PDF) and produces random samples from them, including beta, binomial, chi, exponential, gamma, inverse chi, inverse gamma, multinomial, normal, scaled inverse chi, and uniform.
  467. pendulum_double_ode, a Python code which sets up the double pendulum ordinary differential equation (ODE).
  468. pendulum_elastic_ode a Python code which sets up the ordinary differential equations (ODE) that represent the behavior of a nonlinear elastic pendulum, with gravitational force G, spring constant K, unstretched length L, and mass M.
  469. pendulum_nonlinear_ode, a Python code which sets up the ordinary differential equations (ODE) that represent a nonlinear model of the behavior of a pendulum of length L under a gravitational force of strength G.
  470. pendulum_ode, a Python code which sets up the ordinary differential equations (ODE) that represent a linear model of the behavior of a pendulum of length L under a gravitational force of strength G.
  471. pentominoes, a Python code which forms or plots any of the 12 members of the pentomino family, shapes formed from 5 adjacent squares.
  472. perceptron, a Python code which demonstrates the calculation of a classifier of linearly separable data using the perceptron algorithm.
  473. percolation_simulation, a Python code which simulates a percolation system. A rectangular region is decomposed into a grid of MxN squares. Each square may be porous or solid. We are interested in a path of porous squares connecting the top and bottom, or the left and right boundaries. The original code was written by Ian Cooper.
  474. permutation_distance, a Python code which estimates the expected value of the Ulam distance between a pair of randomly selected permutations of the same order.
  475. persistence, a Python code which demonstrates how to initialize, get, or set data stored within a function, using static/persistent/saved/local memory.
  476. pgma_io, a Python code which reads or writes ASCII Portable Gray Map (PGM) 2D graphics files;
  477. pgmb_io, a Python code which reads or writes a binary Portable Gray Map (PGM) 2D graphics file;
  478. pi_spigot, a Python code which produces any number of digits of the decimal expansion of pi.
  479. pink_noise, a Python code which computes a pink noise signal obeying a 1/f power law.
  480. pip3_test, tests the Python installation program.
  481. plasma_matrix, a Python code which sets up a matrix associated with a problem in plasma physics.
  482. poisson_1d, a Python code which applies the finite difference method (FDM) to solve a two point Poisson boundary value problem (BVP) in one spatial dimension.
  483. poisson_1d_multigrid, a Python code which applies the multigrid method to a discretized version of the 1D Poisson equation.
  484. poisson_2d, a Python code which solves the Poisson equation in a rectangle, using finite differences and Jacobi iteration.
  485. poisson_simulation, a Python code which simulates a Poisson process in which events randomly occur with an average waiting time of Lambda.
  486. polar_ode, a Python code which sets up an ordinary differential equation (ODE) whose variable is complex, and whose solution should be viewed in a polar coordinate plot.
  487. polpak, a Python code which evaluates a variety of mathematical functions, polynomials, and sequences, including Bell, Benford, Bernoulli, Bernstein, Cardan, Catalan, Charlier, Chebyshev, Collatz, Delannoy, Euler, Fibonacci, Gegenbauer, Gudermannian, Harmonic, Hermite, Hofstadter, Hypergeometric 2F1, Jacobi, Krawtchouk, Laguerre, Lambert, Legendre, Lerch, Meixner, Mertens, Moebius, Motzkin, Phi, Stirling Number, Tau, Tribonacci, Zernike.
  488. polygon, a Python code which computes properties of an arbitrary polygon in the plane, defined by a sequence of vertices, including interior angles, area, centroid, containment of a point, convexity, counter clockwise ordering, diameter, distance to a point, inradius, lattice area, nearest point in set, outradius, uniform sampling, and triangulation.
  489. polygon_average, a Python code which demonstrates a process of repeatedly averaging and normalizing the vertices of a polygon, illustrating a property of the power method.
  490. polygon_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected from the interior of a polygon in 2D.
  491. polygon_grid, a Python code which generates a grid of points over the interior of a polygon in 2D.
  492. polygon_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of a polygon in 2D.
  493. polygon_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of a polygon in 2D.
  494. polygon_triangulate, a Python code which triangulates a possibly nonconvex polygon in 2D, and which can use gnuplot() to display the external edges and internal diagonals of the triangulation.
  495. polynomial, a Python code which adds, multiplies, differentiates, evaluates and prints multivariate polynomials in a space of M dimensions.
  496. polynomial_conversion, a Python code which converts representations of a polynomial between monomial, Bernstein, Chebyshev, Gegenbauer, Hermite, Laguerre and Legendre forms.
  497. polynomial_multiply, a Python code which multiplies two polynomials p(x) and q(x).
  498. polynomial_resultant, a Python code which computes the resultant R of univariate polynomials P and Q.
  499. polynomial_resultant_symbolic, a Python code which uses the symbolic package sympy() to compute the resultant R of univariate polynomials P and Q.
  500. polynomial_root_bound, a Python code which computes the Cauchy bound on the magnitude of all roots of a polynomial with complex coefficients.
  501. polynomials, a Python code which defines multivariate polynomials over rectangular domains, for which certain information is to be determined, such as the maximum and minimum values.
  502. polyomino_parity, a Python code which uses parity considerations to determine whether a given set of polyominoes can tile a specified region.
  503. polyominoes, a Python code which manipulates polyominoes and tilings.
  504. porous_medium_exact, a Python code which returns an exact solution of the porous medium equation (PME), dudt=Del^2(u^m), a partial differential equation (PDE) related to the diffusion equation, based on the Barenblatt solution.
  505. power_method, a Python code which carries out the power method for finding a dominant eigenvalue and its eigenvector.
  506. ppma_io, a Python code which reads or writes an ASCII Portable Pixel Map (PPM) 2D graphics file;
  507. ppmb_io, a Python code which reads or writes a binary Portable Pixel Map (PPM) 2D graphics file;
  508. praxis, a Python code which minimizes a scalar function of several variables, without requiring derivative information, by Richard Brent.
  509. predator_prey_ode, a Python code which sets up the ordinary differential equations (ODE) for a Lotka-Volterra predator prey system, for which a limit cycle exists.
  510. predator_prey_ode_period, a Python code which sets up the ordinary differential equations (ODE) for a Lotka-Volterra predator prey system, in order to estimate the period of the limit cycle.
  511. prime, a Python code which counts the number of primes between 1 and N, intended as a starting point for a parallel version.
  512. prime_factors, a Python code which returns a list of the prime factors of an integer.
  513. prime_fermat, a Python code which applies Fermat's primality test to an integer n, which always correctly identifies primes, but sometimes also accepts nonprimes. Nonetheless, the test is useful for weeding out most nonprimes. The accuracy of the test can be improved by running it for several bases.
  514. prime_miller_rabin, a Python code which applies the Miller-Rabin primality test to an integer n, which always correctly identifies primes, but sometimes also accepts nonprimes.
  515. prime_pi, a Python code which evaluates Pi(n), the number of primes less than or equal to an integer n.
  516. prime_plot, a Python code which displays a box plot of the prime and composite numbers.
  517. prism_jaskowiec_rule, a Python code which returns symmetric quadrature rules, with exactness up to total degree 20, over the interior of a prism with triangular base, by Jan Jaskowiec, Natarajan Sukumar.
  518. prism_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for a prism with triangular base, with exactness up to total degree 10.
  519. prob, a Python code which evaluates, samples, inverts, and characterizes a number of Probability Density Functions (PDF) and Cumulative Density Functions (CDF), including anglit, arcsin, benford, birthday, bernoulli, beta_binomial, beta, binomial, bradford, burr, cardiod, cauchy, chi, chi squared, circular, cosine, deranged, dipole, dirichlet mixture, discrete, empirical, english sentence and word length, error, exponential, extreme values, f, fisk, folded normal, frechet, gamma, generalized logistic, geometric, gompertz, gumbel, half normal, hypergeometric, inverse gaussian, laplace, levy, logistic, log normal, log series, log uniform, lorentz, maxwell, multinomial, nakagami, negative binomial, normal, pareto, planck, poisson, power, quasigeometric, rayleigh, reciprocal, runs, sech, semicircular, student t, triangle, uniform, von mises, weibull, zipf.
  520. pwl_interp_1d, a Python code which interpolates a set of data using a piecewise linear function in 1D.
  521. pwl_interp_2d, a Python code which interpolates a set of data using a piecewise linear function in 2D.
  522. py_test, a Python code which illustrates various features of Python programming.
  523. pyramid_exactness, a Python code which tests the exactness of a quadrature rule over the interior of the unit pyramid in 3D.
  524. pyramid_felippa_rule, a Python code which returns a Felippa quadrature rule for approximating integrals over the interior of a pyramid in 3D.
  525. pyramid_grid, a Python code which computes a grid of points over the interior of the unit pyramid in 3D;
  526. pyramid_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit pyramid in 3D.
  527. pyramid_jaskowiec_rule, a Python code which returns quadrature rules, with exactness up to total degree 20, over the interior of a pyramid in 3D, by Jan Jaskowiec, Natarajan Sukumar.
  528. pyramid_monte_carlo, a Python code which applies a Monte Carlo (MC) method to estimate integrals of a function over the interior of the unit pyramid in 3D;
  529. pyramid_rule, a Python code which computes a conical product quadrature rule over the interior of the unit pyramid in 3D.
  530. pyramid_witherden_rule, a Python code which returns a Witherden quadrature rule, with exactness up to total degree 10, over the interior of a pyramid.
  531. python_combinatorics, a Python code which considers a variety of problems in combinatorics involving counting, combinations, permutations, and so on.
  532. python_distance, a Python code which estimates the typical distance between a pair of points randomly selected from the surface or interior of a geometric object such as a circle, disk, sphere, cube.
  533. python_exact, a Python code which evaluates exact solutions to a few selected examples of ordinary differential equations (ODE) and partial differential equations (PDE).
  534. python_grid, a Python code which generates a regular grid of points inside a variety of regions in one, two, three or many dimensions.
  535. python_import, a Python code which demonstrates how a Python function can use the import function to access functions from a library that is in a separate directory.
  536. python_integrals, a Python code which returns the exact value of the integral of any monomial over the surface or interior of some geometric object, including a line, quadrilateral, box, circle, disk, sphere, ball and others.
  537. python_intrinsics_test, a Python code which demonstrates some of the intrinsic functions in the Python language.
  538. python_mistake, a Python code which illustrates mistakes caused by Python, encouraged by Python, or made difficult to spot because of Python.
  539. python_monte_carlo, a Python code which uses Monte Carlo sampling to estimate areas and integrals.
  540. python_plots, a Python code which uses plotting to illustrate a mathematical structure, such as an iterative map, a fractal, a curve or surface.
  541. python_polynomial, a Python code which analyzes a variety of polynomial families, returning the polynomial values, coefficients, derivatives, integrals, roots, or other information.
  542. python_random_test, a Python code which demonstrates random number generation.
  543. python_rule, a Python code which computes a quadrature rule which estimates the integral of a function f(x), which might be defined over a one dimensional region (a line) or more complex shapes such as a circle, a triangle, a quadrilateral, a polygon, or a higher dimensional region, and which might include an associated weight function w(x).
  544. python_simulation, a Python code which uses simulation to study card games, contests, and other processes which have a random element. Usually, the purpose is to try to predict the average behavior of the system over many trials.
  545. pytorch_test, a Python code which illustrates certain features of the pytorch() programming library, which is used for applications in machine learning and deep learning.
  546. python_ode, a Python code which sets up various systems of ordinary differential equations (ODE).
  547. python_ode_solver, a Python code which solves one or more differential equations (ODE) using a method of a particular order, either explicit or implicit. Some methods require a nonlinear equation solver. Some methods used a fixed stepsize, while others adapt the stepsize based on an error estimate.
  548. quad_mpi, a Python code which approximates an integral using a quadrature rule, carried out in parallel using MPI and MPI4PY.
  549. quad_rule, a Python code which implements rules for approximate integration, or quadrature, in one dimension;
  550. quad_serial, a Python code which applies a quadrature rule to estimate an integral, intended as a starting point for parallelization exercises.
  551. quad2d, a Python code which estimates an integral over a 2D rectangle using quadrature, intended as the starting point for program optimization or parallelization.
  552. quadex_ode a Python code which sets up a stiff ordinary differential equation (ODE), whose exact solution is a parabola, but for which errors grow exponentially.
  553. quadrilateral, a Python code which carries out geometric calculations on quadrilaterals, including angles, area, distances, nearest point, point containment, perimeter, and random generation.
  554. quadrilateral_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for the quadrilateral, with exactness up to total degree 21.
  555. quasiperiodic_ode, a Python code which sets up a system of ordinary differential equations (ODE) for a problem with a quasiperiodic solution.
  556. quaternions, a Python code which carries out some simple arithmetic operations for quaternions.
  557. r83, a Python code which contains linear algebra routines for r83 matrices, in real, 64 bit, tridiagonal 3xN format.
  558. r83_np, a Python code which contains linear algebra routines for r83_np matrices (real, 64 bit, tridiagonal 3xN format, nonpivoting factorization).
  559. r83p, a Python code which contains linear algebra routines for r83p matrices (real, 64 bit, tridiagonal periodic format).
  560. r83s, a Python code which contains linear algebra routines for r83s matrices (real, 64 bit, tridiagonal scalar format).
  561. r83t, a Python code which contains linear algebra routines for r83t matrices (real, 64 bit, tridiagonal Mx3 format).
  562. r83v, a Python code which contains linear algebra routines for r83v matrices (real, 64 bit, tridiagonal three vector format).
  563. r85, a Python code which contains linear algebra routines for r85 matrices (real, 64 bit, pentadiagonal format).
  564. r8bb, a Python code which contains linear algebra routines for r8bb matrices (real, 64 bit, border banded format).
  565. r8blt, a Python code which contains linear algebra routines for r8blt matrices (real, 64 bit, band lower triangular format).
  566. r8bto, a Python code which contains linear algebra routines for r8bto matrices (real, 64 bit, block Toeplitz format).
  567. r8but, a Python code which contains linear algebra routines for r8but matrices (real, 64 bit, band upper triangular format).
  568. r8cb, a Python code which contains linear algebra routines for r8cb matrices (real, 64 bit, Compressed Band format).
  569. r8cbb, a Python code which contains linear algebra routines for r8cbb matrices (real, 64 bit, Compressed Border Banded format).
  570. r8ccs, a Python code which contains linear algebra routines for r8ccs matrices: real, 64 bit, Compressed Column Storage (CCS) format.
  571. r8ci, a Python code which contains linear algebra routines for r8ci matrices (real, 64 bit, circulant format).
  572. r8col, a Python code which contains linear algebra routines for r8col matrices, that is, a real MxN array, considered as N column vectors, each of length M. The data may be thought of as a matrix of multiple columns, and many operations will be carried out columnwise.
  573. r8crs, a Python code which contains linear algebra routines for r8crs matrices: real, 64 bit, Compressed Row Storage (CRS) format.
  574. r8gb, a Python code which contains linear algebra routines for r8gb matrices (real, 64 bit, General Banded format).
  575. r8gd, a Python code which contains linear algebra routines for r8gd matrices (real, 64 bit, general diagonal format).
  576. r8ge, a Python code which contains linear algebra routines for r8ge matrices in real, 64 bit, general format.
  577. r8lib, a Python code which contains many utility routines, using 64 bit precision real (R8) arithmetic.
  578. r8lt, a Python code which contains linear algebra routines for r8lt matrices, in real, 64 bit, Lower Triangular format.
  579. r8ltt, a Python code which contains linear algebra routines for r8ltt matrices (real, 64 bit, lower triangular Toeplitz format).
  580. r8ncf, a Python code which contains linear algebra routines for r8ncf matrices (real, 64 bit, nonsymmetric coordinate format).
  581. r8pbl, a Python code which contains linear algebra routines for r8pbl matrices (real, 64 bit, symmetric positive definite (SPD) band lower format).
  582. r8pbu, a Python code which contains linear algebra routines for r8pbu matrices (real, 64 bit, symmetric positive definite (SPD) band upper format).
  583. r8po, a Python code which contains linear algebra routines for r8po matrices (real, 64 bit, symmetric positive definite (SPD) format).
  584. r8poly, a Python code which operates on real polynomials, including evaluation, differentiation, integration, multiplication, synthetic division, shifting the base, computing a power, taking the norm. It also defines Chebyshev, Lagrange and Legendre polynomials.
  585. r8pp, a Python code which contains linear algebra routines for r8pp matrices (real, 64 bit, symmetric positive definite (SPD) packed format).
  586. r8ri, a Python code which contains linear algebra routines for r8ri matrices (real, 64 bit, row indexed format).
  587. r8row, a Python code which contains linear algebra routines for r8row matrices, that is, a real MxN array, considered as M row vectors, each of length N. The data may be thought of as a matrix of multiple rows, and many operations will be carried out rowwise.
  588. r8sd, a Python code which contains linear algebra routines for r8sd matrices (real, 64 bit, symmetric diagonal format).
  589. r8sm, a Python code which contains linear algebra routines for r8sm matrices (real, 64 bit, Sherman-Morrison A-u*v' format).
  590. r8sr, a Python code which carries out linear algebra operations for r8sr matrices (real, 64 bit, diagonal + compressed row offdiagonal format).
  591. r8ss, a Python code which carries out linear algebra operations for r8ss matrices (real, 64 bit, symmetric skyline format).
  592. r8st, a Python code which contains linear algebra routines for r8st matrices, in real, 64 bit, Sparse Triplet (ST) format.
  593. r8sto, a Python code which contains linear algebra routines for r8sto matrices (real, 64 bit, symmetric Toeplitz N format).
  594. r8to, a Python code which contains linear algebra routines for r8to matrices (real, 64 bit, Toeplitz 2*N-1 format).
  595. r8ut, a Python code which contains linear algebra routines for r8ut matrices, in real, 64 bit, Upper Triangular format.
  596. r8utp, a Python code which carries out linear algebra operations on r8utp matrices, real 64 bit, Upper Triangular Packed format.
  597. r8utt, a Python code which contains linear algebra routines for r8utt matrices (real, 64 bit, upper triangular Toeplitz format).
  598. r8vm, a Python code which contains linear algebra routines for r8vm matrices (real, 64 bit, vandermonde format).
  599. randlc, a Python code which implements a random number generator (RNG) used by the NAS Benchmark programs.
  600. random_data, a Python code which uses a random number generator (RNG) to sample points for various probability distributions, spatial dimensions, and geometries, including the M-dimensional cube, ellipsoid, simplex and sphere.
  601. random_matrix_eigenvalues, a Python code which demonstrates how, for certain probability density functions (PDF), a symmetric matrix with entries sampled from that PDF will have eigenvalues distributed according to the Wigner semicircle distribution.
  602. random_sorted, a Python code which generates vectors of random values which are already sorted.
  603. random_walk_1d_simulation, a Python code which simulates a random walk in a 1-dimensional region.
  604. random_walk_2d_simulation, a Python code which simulates a random walk in a 2-dimensional region.
  605. random_walk_2d_avoid_simulation, a Python code which simulates a self-avoiding random walk in a 2-dimensional region.
  606. random_walk_3d_simulation, a Python code which simulates a random walk in a 3-dimensional region.
  607. ranlib, a Python code which produces random samples from Probability Density Functions (PDF), including Beta, Chi-square Exponential, F, Gamma, Multivariate normal, Noncentral chi-square, Noncentral F, Univariate normal, random permutations, Real uniform, Binomial, Negative Binomial, Multinomial, Poisson and Integer uniform, by Barry Brown and James Lovato.
  608. rbf_interp_1d, a Python code which defines and evaluates radial basis function (RBF) interpolants to 1D data.
  609. rbf_interp_2d, a Python code which defines radial basis function (RBF) interpolants to 2D data.
  610. reaction_ode, a Python code which sets up the ordinary differential equations (ODE) which model a simple chemical reaction A+B --k--> C.
  611. reaction_twoway_ode, a Python code which sets up the ordinary differential equations (ODE) which model a two-way chemical reaction between species W1 and W2.
  612. reaction_twoway_odefun, a Python code which uses the multiple-precision arithmetic package mpmath() to approximate the solution of the ordinary differential equations (ODE) which model a two-way chemical reaction between species W1 and W2.
  613. reactor simulation, a Python code which is a simple Monte Carlo simulation of the shielding effect of a slab of a certain thickness in front of a neutron source. This program was provided as an example with the book "Numerical Methods and Software."
  614. rectangle_distance, a Python code which estimates the distribution and expected value of the distance between two points picked uniformly at random within a rectangle.
  615. rigid_body_ode, a Python code which sets up the ordinary differential equations (ODE) representing the Euler equations for a rigid body with three unequal moments of inertia, originally proposed by Fred Krogh.
  616. ripple_ode, a Python code which sets up an ordinary differential equation (ODE) whose family of solutions start as ripples and end as hyperbolas.
  617. risk_matrix, a Python code which returns the transition and adjacency matrix for the game of RISK.
  618. rk1, a Python code which solves one or more ordinary differential equations (ODE) using an explicit Runge-Kutta method of order 1, usually known as Euler's explicit method.
  619. rk1_implicit, a Python code which solves one or more ordinary differential equations (ODE) using the Runge-Kutta order 1 implicit method, with a version of fsolve() handling the associated nonlinear equation, and using a fixed time step. This method is often called the backward Euler method.
  620. rk12, a Python code which solves an ordinary differential equation (ODE) using a Runge-Kutta (RK) method of order 2, estimating the local error with a Runge-Kutta method of order 1.
  621. rk2, a Python code which solves one or more ordinary differential equations (ODE) using an explicit Runge-Kutta method of order 2, also known as Heun's method, the modified Euler method, or the explicit midpoint method.
  622. rk2_implicit, a Python code which solves one or more ordinary differential equations (ODE) using the Runge-Kutta order 2 implicit method, using fsolve() to solve the implicit equation, and using a fixed time step. rk2_implicit() is also known as the implicit midpoint method.
  623. rk23, a Python code which applies Runge-Kutta (RK) solvers of order 2 and 3 to a system of ordinary differential equations (ODE);
  624. rk34, a Python code which applies Runge-Kutta (RK) solvers of order 3 and 4 to a system of ordinary differential equations (ODE);
  625. rk4, a Python code which applies the fourth order Runge-Kutta (RK) algorithm to estimate the solution of an ordinary differential equation (ODE) at the next time step.
  626. rk45, a Python code which applies Runge-Kutta (RK) solvers of order 4 and 5 to a system of ordinary differential equations (ODE);
  627. rkf45, a Python code which implements the Runge-Kutta-Fehlberg (RKF) solver for the approximate solution of an ordinary differential equation (ODE) system.
  628. rng_cliff, a Python code which computes a sequence of values from the Cliff random number generator (RNG).
  629. rnglib, a Python code which implements a random number generator (RNG) with splitting facilities, allowing multiple independent streams to be computed, by L'Ecuyer and Cote.
  630. robertson_ode, a Python code which sets up a system of three nonlinear stiff ordinary differential equations (ODE) characterizing an autocatalytic chemical reaction.
  631. roessler_ode, a Python code which sets up the Roessler system of ordinary differential equations (ODE).
  632. root_rc, a Python code which seeks a solution of a scalar nonlinear equation f(x)=0, using reverse communication (RC), by Gaston Gonnet.
  633. roots_rc, a Python code which seeks solutions of a system of nonlinear equations, using reverse communication (RC), by Gaston Gonnet.
  634. rot13, a Python code which makes a copy of a file which has been encoded using the ROT13 coding and a ROT5 coding for digits.
  635. roulette_simulation, a Python code which simulates the spinning of a roulette wheel and the evaluation of certain common roulette bets.
  636. row_echelon_integer, a Python code which carries out the exact computation of the integer row echelon form (IREF) and integer reduced row echelon form (IRREF) of an integer matrix.
  637. rref2, a Python code which involves a user-written approach to compute the reduced row echelon form (RREF) of a matrix, which can be used to analyze matrices which are square or rectangular, singular or invertible.
  638. rubber_band_ode, a Python code which sets up a set of ordinary differential equations (ODE) describing a mass suspended by a spring and rubber band, which exhibit chaotic behavior.
  639. rucklidge_ode, a Python code which sets up and solves the Rucklidge ordinary differential equation (ODE), a model of double convection which embodies a transition to chaos.
  640. sammon_data, a Python code which generates six examples of M dimensional datasets for cluster analysis.
  641. satisfy_brute, a Python code which uses brute force to find all assignments of values to a set of logical variables which make a complicated logical statement true.
  642. sawtooth_ode, a Python code which sets up an ordinary differential equation (ODE) driven by a right hand side which is a sawtooth function, periodic, discontinuous, piecewise linear.
  643. search_mpi, a Python code which searches integers between A and B for a solution J such that F(J)=C, carried out in parallel using MPI and MPI4PY.
  644. search_serial, a Python code which searches integers between A and B for a solution J such that F(J)=C, intended as a starting point for parallelization exercises.
  645. sensitive_ode, a Python code which sets up a second order ordinary differential equation (ODE) which exhibits sensitive dependence on the initial condition.
  646. set_theory, a Python code which implements set theory operations such as union, intersection, complement, symmetric difference.
  647. sftpack, a Python code which implements the slow Fourier transform (SFT), intended as a teaching tool and comparison with the fast Fourier transform (FFT).
  648. shallow_water_1d, a Python code which simulates the evolution of a 1D fluid governed by the time-dependent shallow water equations.
  649. shepard_interp_1d, a Python code which defines and evaluates Shepard interpolants to 1D data, based on inverse distance weighting.
  650. sigmoid_derivative, a Python code which evaluates derivatives of any order for the sigmoid function s(x)=1/(1+exp(-x)).
  651. simplex_coordinates, a Python code which computes the Cartesian coordinates of the vertices of a regular simplex in M dimensions.
  652. simplex_gm_rule, a Python code which defines Grundmann-Moeller quadrature rules over the interior of a triangle in 2D, a tetrahedron in 3D, or over the interior of the simplex in M dimensions.
  653. simplex_grid, a Python code which generates a regular grid of points over the interior of an arbitrary simplex in M dimensions.
  654. simplex_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit simplex in M dimensions.
  655. simplex_monte_carlo, a Python code which uses the Monte Carlo method to estimate an integral over the interior of the unit simplex in M dimensions.
  656. sine_gordon_exact, a Python code which returns an exact solution of the Sine-Gordon equation, a partial differential equation (PDE) of the form uxy=sin(u).
  657. sine_transform, a Python code which demonstrates simple properties of the discrete sine transform (DST).
  658. sir_ode, a Python code which sets up the ordinary differential equations (ODE) which simulate the spread of a disease using the Susceptible/Infected/Recovered (SIR) model.
  659. sir_simulation, a Python code which simulates the spread of a disease through a hospital room of M by N beds, using the Susceptible/Infected/Recovered (SIR) model.
  660. sling_ode, an Octave code which sets up a system of ordinary differential equations (ODE) for which the exact circular solution can only be approximated for a short interval before it decays to zero.
  661. snakes_and_ladders, a Python code which provides some tools for studying the game of Snakes and Ladders.
  662. snakes_and_ladders_simulation, a Python code which simulates a one-player game of Snakes and Ladders, to produce histograms of the count, PDF and CDF estimates for the length of a one-player game.
  663. snakes_matrix, a Python code which returns the transition matrix for the game of Snakes and Ladders.
  664. sncndn, a Python code which evaluates the Jacobi elliptic functions sn(u,m), cn(u,m), and dn(u,m).
  665. sobol, a Python code which computes elements of a Sobol Quasi Monte Carlo (QMC) sequence.
  666. solve, a Python code which demonstrates how Gauss elimination can be used to solve a linear system A*x=b.
  667. solve_bvp_test, a Python code which calls scipy.integrate.solve_bvp(), which solves boundary value problems (BVP) in one spatial dimension.
  668. sort_rc, a Python code which sorts a list of any kind of objects, using reverse communication (RC).
  669. sortrows, a Python code which lexically sorts the rows of an array, in a similar fashion to the MATLAB sortrows() function.
  670. sparse_test, a Python code which tests the scipy.sparse() functions for creating sparse matrices and carrying out linear algebraic functions on them;
  671. sphere_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected from the surface of the unit sphere in 3D.
  672. sphere_fibonacci_grid, a Python code which uses a Fibonacci spiral to create a grid of points on the surface of the unit sphere in 3D.
  673. sphere_integrals, a Python code which returns the exact value of the integral of any monomial over the surface of the unit sphere in 3D.
  674. sphere_llq_grid, a Python code which uses longitudes and latitudes to create grids of points, lines, and quadrilaterals on the surface of the unit sphere in 3D.
  675. sphere_llt_grid, a Python code which uses longitudes and latitudes to create grids of points, lines, and triangles on the surface of the unit sphere in 3D.
  676. sphere_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function on the surface of the unit sphere in 3D.
  677. sphere_positive_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected on the surface of the unit positive sphere in 3D.
  678. spiral_exact, a Python code which computes a 2D velocity vector field that is an exact solution of the continuity equation.
  679. spiral_pde, a Python code which solves a pair of reaction-diffusion partial differential equations (PDE) over a rectangular domain with periodic boundary condition, whose solution is known to evolve into a pair of spirals.
  680. spring_ode, a Python code which sets up a system of ordinary differential equations (ODE) for the motion of a spring with mass m, damping b, and stiffness k.
  681. spring_double_ode, a Python code which sets up a system of ordinary differential equations (ODE) for a system in which a mass is connected by a spring to a mass connected by a spring to a fixed support.
  682. spring_sweep_ode, a Python code which computes a grid of solutions to a parameterized system of ordinary differential equations (ODE) that represent the motion of a spring with mass m, damping b, and stiffness k.
  683. square_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected inside the unit square.
  684. square_grid, a Python code which computes a grid of points over the interior of a square in 2D.
  685. square_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit square or symmetric unit square in 2D.
  686. square_minimal_rule, a Python code which returns "almost minimal" quadrature rules, with exactness up to total degree 55, over the interior of the symmetric square in 2D, by Mattia Festa and Alvise Sommariva.
  687. square_monte_carlo, a Python code which applies a Monte Carlo method to estimate the integral of a function over the interior of the unit square in 2D.
  688. square_surface_distance, a Python code which estimates the expected value of the distance between a pair of points randomly selected on the surface of the unit square.
  689. square_symq_rule, a Python code which returns symmetric quadrature rules, with exactness up to total degree 20, over the interior of the square in 2D, by Hong Xiao and Zydrunas Gimbutas.
  690. squircle_ode, a Python code which sets up a system of ordinary differential equations (ODE) for a pair of functions that generalize the sine and cosine, and whose phase portrait is a squircle, a sort of squared circle.
  691. st_io a Python code which reads and writes sparse linear systems stored in the Sparse Triplet (ST) format.
  692. st_to_ccs, a Python code which converts sparse matrix data from Sparse Triplet (ST) format to Compressed Column Storage (CCS) format;
  693. stetter_ode, a Python code which sets up an ordinary differential equation (ODE) for which a specific time step sequence causes the implicit trapezoidal method to be unstable, while the implicit midpoint method will be stable. Note that the right hand side function f(t,y) is periodic, discontinuous, and piecewise linear.
  694. stiff_ode, a Python code which sets up a stiff ordinary differential equation (ODE).
  695. stochastic_diffusion, a Python code which implements several versions of a stochastic diffusivity coefficient.
  696. stokes_2d_exact, a Python code which evaluates exact solutions to the incompressible steady Stokes equations over the unit square in 2D.
  697. subset, a Python code which enumerates, generates, randomizes, ranks and unranks combinatorial objects including combinations, compositions, Gray plt., index sets, partitions, permutations, polynomials, subsets, and Young tables. Backtracking routines are included to solve some combinatorial problems.
  698. subset_distance, a Python code which estimates the expected value of the Hamming distance between a pair of randomly selected subsets of an M set.
  699. subset_sum, a Python code which seeks solutions of the subset sum problem, in which it is desired to find a subset of integers which has a given sum.
  700. subset_sum_backtrack, a Python code which uses backtracking to find solutions of the subset sum problem, in which it is desired to find a subset of integers which has a given sum.
  701. subset_sum_brute, a Python code which uses brute force to find solutions of the subset sum problem, in which it is desired to find a subset of integers which has a given sum.
  702. subset_sum_swap, a Python code which uses swapping to try to improve an initial estimated solution of the subset sum problem, which seeks a subset of a set of integers which has a given sum. Even when an exact solution exists, this approach often only finds an approximate solution.
  703. svd_circle, a Python code which analyzes a linear map of the unit circle caused by an arbitrary 2x2 matrix A, using the singular value decomposition (SVD).
  704. svd_lls, a Python code which uses the singular value decomposition (SVD) to construct and plot the best affine and linear relationships in the sense of least square, between two vectors of data.
  705. svd_powers, a Python code which applies singular value decomposition (SVD) analysis to a set of powers A(i,j) = x(i)^j.
  706. svd_snowfall, a Python code which reads a file containing historical snowfall data and analyzes the data with the Singular Value Decomposition (SVD), displaying the results using gnuplot().
  707. svd_sphere, a Python code which analyzes a linear map of the unit sphere caused by an arbitrary 3x3 matrix A, using the singular value decomposition (SVD).
  708. svd_test, a Python code which demonstrates the calculation of the singular value decomposition (SVD) and some of its properties;
  709. svd_truncated_test, a Python code which calls the "economy" version of the Singular Value Decomposition (SVD) of an M by N rectangular matrix, in cases where M is less than N or N is less than M.
  710. sympy_test, a Python code which uses the sympy() library, which is a symbolic mathematics package which, given a symbolic formula, can evaluate it, differentiate it, integrate it, plot it, compute Taylor series approximations, and many other operations.
  711. table_io, a Python code which reads and writes files.
  712. task_division, a Python code which implements a simple procedure for smoothly dividing T tasks among P processors; such a method can be useful in MPI and other parallel environments, particularly when T is not an exact multiple of P, and when the processors can be indexed starting from 0 or from 1.
  713. tennis_matrix, a Python code which computes the transition matrix for a game of tennis, which has 17 distinct states.
  714. test_eigen, a Python code which implements test matrices for eigenvalue analysis.
  715. test_int, a Python code which implements test problems for approximate integration (quadrature) in one dimension.
  716. test_interp, a Python code which defines test problems for interpolation, provided as a set of (x,y(x)) data.
  717. test_interp_1d, a Python code which defines test problems for interpolation of data y(x), which depends on a 1D argument.
  718. test_interp_2d, a Python code which defines test problems for interpolation of data z(x,y), which depends on a 2D argument.
  719. test_lls, a Python code which implements linear least squares test problems of the form A*x=b.
  720. test_matrix, a Python code which defines test matrices for which the condition number, determinant, eigenvalues, eigenvectors, inverse, null vectors, P*L*U factorization or linear system solution are known. Examples include the Fibonacci, Hilbert, Redheffer, Vandermonde, Wathen and Wilkinson matrices.
  721. test_matrix_exponential, a Python code which defines a set of test cases for computing the matrix exponential.
  722. test_min, a Python code which implements test problems for minimization of a scalar function of a scalar variable.
  723. test_nonlin, a Python code which implements test problems for the solution of systems of nonlinear equations.
  724. test_optimization, a Python code which implements test problems for optimization of a scalar function of several variables, as described by Molga and Smutnicki.
  725. test_values, a Python code which supplies test values of various mathematical functions, including Abramowitz, AGM, Airy, Bell, Bernoulli, Bessel, Beta, Binomial, Bivariate Normal, Catalan, Cauchy, Chebyshev, Chi Square, Clausen, Clebsch Gordan, Collatz, Cosine integral, Dawson, Debye, Dedekind, dilogarithm, Dixon elliptic functions, Exponential integral, Elliptic, Error, Euler, Exponential integral, F probability, Fresnel, Frobenius, Gamma, Gegenbauer, Goodwin, Gudermannian, Harmonic, Hermite, Hypergeometric 1F1, Hypergeometric 2F1, inverse trigonometic, Jacobi Elliptic functions sn(), cn(), dn(), the Julian Ephemeris Date, Kelvin, Knapsack, Laguerre, Lambert W, Laplace, Legendre, Lerch, Lobachevsky, Lobatto, Logarithmic integral, Log normal, McNugget numbers, Mersenne primes, Mertens, Mittag-Leffler, Moebius, Multinomial, Negative binomial, Nine J, Normal, Omega, Owen, Partition, Phi, Pi, Poisson, Polylogarithm, Polynomial Resultant, Polyomino, Prime, Psi, Rayleigh, Hyperbolic Sine integral, Sigma, Sine Power integral, Sine integral, Six J, Sphere area, Sphere volume, Spherical harmonic, Stirling, Stromgen, Struve, Student, Subfactorial, Student probability, Three J, Transport, Trigamma, Truncated normal, van der Corput, von Mises, Weibull, Wright Omega, Zeta.
  726. test_zero, a Python code which defines some functions f(x) suitable for testing software that solves f(x)=0;
  727. tester, a BASH script which runs the test codes.
  728. tetrahedron, a Python code which carries out geometric calculations involving a general tetrahedron, including solid and facial angles, face areas, point containment, distances to a point, circumsphere and insphere, measures of shape quality, centroid, barycentric coordinates, edges and edge lengths, random sampling, and volumes.
  729. tetrahedron_arbq_rule, a Python code which returns quadrature rules, with exactness up to total degree 15, over the interior of a tetrahedron in 3D, by Hong Xiao and Zydrunas Gimbutas.
  730. tetrahedron_exactness, a Python code which tests the exactness of a quadrature rule over the interior of a tetrahedron in 3D.
  731. tetrahedron_felippa_rule, a Python code which returns a Felippa quadrature rule for approximating integrals over the interior of a tetrahedron in 3D.
  732. tetrahedron_grid, a Python code which computes a grid of points over the interior of a tetrahedron in 3D.
  733. tetrahedron_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit tetrahedron in 3D.
  734. tetrahedron_jaskowiec_rule, a Python code which returns quadrature rules, with exactness up to total degree 20, over the interior of a tetrahedron in 3D, by Jan Jaskowiec, Natarajan Sukumar.
  735. tetrahedron_monte_carlo, a Python code which uses the Monte Carlo method to estimate an integral over the interior of a tetrahedron in 3D.
  736. tetrahedron_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for the tetrahedron, with exactness up to total degree 10.
  737. tetrahedron01_monte_carlo, a Python code which uses the Monte Carlo method to estimate an integral over the interior of the unit tetrahedron in 3D.
  738. text_to_wordlist, a Python code which shows how to start with a text file, read its information into a single long string, and divide that string into individual words. This allows an investigator to analyze the text for patterns.
  739. theta_method, a Python code which solves one or more ordinary differential equations (ODE) using the theta method.
  740. three_body_ode, a Python code which sets up ordinary differential equations (ODE) that simulate the behavior of three planets, constrained to lie in a plane, and moving under the influence of gravity, by Walter Gander and Jiri Hrebicek.
  741. tictoc, a Python code which provides versions of the tic() and toc() functions for wallclock timing.
  742. timer_test, a Python code which tests various timers.
  743. timestamp, a Python code which prints the current YMDHMS date as a timestamp.
  744. toeplitz_cholesky, a Python code which computes the Cholesky factorization of a symmetric positive definite (SPD) Toeplitz matrix.
  745. toeplitz_inverse, a Python code which computes the inverse of a Toeplitz matrix.
  746. toms097, a Python code which computes the distance between all pairs of nodes in a directed graph with weighted edges, using the Floyd algorithm. This is a version of ACM TOMS algorithm 97.
  747. toms112, a Python code which determines whether a point is contained in a polygon, by Moshe Shimrat. This is a version of ACM TOMS algorithm 112.
  748. toms178, a Python code which seeks the minimizer of a function of several variables, using the Hooke-Jeeves direct search method, by Arthur Kaupe. This is a version of ACM TOMS algorithm 178.
  749. toms179, a Python code which calculates the incomplete Beta ratio, by Oliver Ludwig. This is a version of ACM TOMS algorithm 179.
  750. toms243, a Python code which evaluates the logarithm of a complex value, by David Collens. This is a version of ACM TOMS algorithm 243.
  751. toms443, a Python code which evaluates the Lambert W function, by Fritsch, Shafer and Crowley. This is a version of ACM TOMS algorithm 443.
  752. toms515, a Python code which selects subsets of size K from a set of size N. This is a version of ACM TOMS Algorithm 515, by Bill Buckles, Matthew Lybanon.
  753. toms577, a Python code which evaluates the Carlson elliptic integral functions RC, RD, RF and RJ. This is a version of ACM TOMS algorithm 577.
  754. toms655, a Python code which computes the weights for interpolatory quadrature rule; this library is commonly called IQPACK, by Sylvan Elhay and Jaroslav Kautsky. This is a version of ACM TOMS algorithm 655. Only a small portion of this library has been implemented in Python so far!
  755. toms743, a Python code which evaluates the Lambert W function. This is a version of ACM TOMS algorithm 743, by Barry, Barry and Culligan-Hensley.
  756. toms923, a Python code which evaluates the Pfaffian for a dense or banded skew symmetric matrix, by Michael Wimmer.
  757. tough_ode, a Python code which sets up a system of four ordinary differential equations (ODE) which is extremely difficult to solve accurately.
  758. traffic_simulation, a Python code which simulates the cars waiting to get through a traffic light.
  759. trapezoidal, a Python code which solves one or more ordinary differential equations (ODE) using the implicit trapezoidal method, and using fsolve() to handle the implicit system.
  760. trapezoidal_explicit, a Python code which solves one or more ordinary differential equations (ODE) using the (explicit) trapezoidal method.
  761. trapezoidal_fixed, a Python code which solves one or more ordinary differential equations (ODE) using the implicit trapezoidal method, and using a fixed point method to handle the implicit system.
  762. triangle, a Python code which computes properties, including angles, area, centroid, circumcircle, edge lengths, incircle, orientation, orthocenter, and quality, of a triangle in 2D.
  763. triangle_distance, a Python code which estimates the typical value of the distance between a pair of points randomly selected from the interior of a triangle in 2D.
  764. triangle_exactness, a Python code which tests the exactness of a quadrature rule over the interior of a triangle in 2D.
  765. triangle_grid, a Python code which computes a grid of points over the interior of a triangle in 2D.
  766. triangle_integrals, a Python code which returns the exact value of the integral of any polynomial over the interior of a general triangle in 2D.
  767. triangle_interpolate, a Python code which shows how vertex data can be interpolated at any point in the interior of a triangle.
  768. triangle_monte_carlo, a Python code which uses the Monte Carlo method to estimate an integral over the interior of a general triangle in 2D.
  769. triangle_symq_rule, a Python code which returns symmetric quadrature rules, with precision up to 50, over the interior of a triangle, by Hong Xiao and Zydrunas Gimbutas.
  770. triangle_twb_rule, a Python code which generates the points and weights of quadrature rules over the interior of a triangle in 2D, determined by Taylor, Wingate, and Bos.
  771. triangle_witherden_rule, a Python code which returns a symmetric Witherden quadrature rule for the triangle, with exactness up to total degree 20.
  772. triangle01_integrals, a Python code which returns the integral of any monomial over the interior of the unit triangle in 2D.
  773. triangle01_monte_carlo, a Python code which uses the Monte Carlo method to estimate the integral of any function over the interior of the unit triangle in 2D.
  774. tridiagonal_solver a Python code which solves a tridiagonal linear system.
  775. truel_simulation, a Python code which simulates N repetitions of a duel between three players, each of whom has a known firing accuracy.
  776. truncated_normal, a Python code which works with the truncated normal distribution over [A,B], or [A,+oo) or (-oo,B], returning the probability density function (PDF), the cumulative density function (CDF), the inverse CDF, the mean, the variance, and sample values.
  777. truncated_normal_rule, a Python code which computes a quadrature rule for a normal probability density function (PDF), sometimes called a Gaussian distribution, that has been truncated to [A,+oo), (-oo,B] or [A,B].
  778. tsp_brute, a Python code which is given a table of city-to-city distances and solves a small traveling salesperson problem (TSP), using brute force.
  779. tsp_descent, a Python code which is given a table of city-to-city distances, chooses an initial tour at random, and then tries some simple variations to quickly find a tour of lower length, to solve the traveling salesperson problem (TSP).
  780. tsp_greedy, a Python code which is given a table of city-to-city distances, and solves a small traveling salesperson problem (TSP) using the greedy algorithm. It picks a starting city at random, and then successively visits the nearest unvisited city.
  781. tsp_moler, a Python code which tries to optimize the traveling salesperson problem (TSP), written by Cleve Moler.
  782. tsp_random, a Python code which seeks a solution of the Traveling Salesperson Problem (TSP), by accepting a table of city-to-city distances, and randomly generating round trips that visit every city, returning the tour of shortest length.
  783. two_body_ode, a Python code which sets up ordinary differential equations (ODE) which simulate the behavior of two bodies, constrained to lie in a plane, moving under the influence of gravity, with one body much more massive than the other.
  784. ubvec, a Python code which demonstrates how nonnegative integers can be stored as unsigned binary vectors, and arithmetic can be performed on them.
  785. ulam_spiral, a Python code which displays the integers as a spiral of grid cells, with the primes highlighted, so show that they tend to fall along diagonals, as discovered by Stanislaw Ulam.
  786. umlaut_remover, a Python code which replaces certain special characters in German text by English equivalents, based on work by John Berroa.
  787. unicycle, a Python code which considers permutations containing a single cycle, sometimes called cyclic permutations.
  788. uniform, a Python code which contains uniform random number generators (RNG) for several arithmetic types.
  789. unstable_ode, a Python code which sets up an unstable ordinary differential equation (ODE) which the backward Euler method incorrectly drives to zero.
  790. upc, a Python code which computes the check digit associated with a uniform product code (UPC), or reports whether a 12-digit UPC is actually valid.
  791. urn_simulation, a Python code which simulates the experiment of sampling K balls from an urn containing N balls of various colors.
  792. usa_box_plot, a Python code which creates simplified maps of the USA in which each state appears as a box, and the placement of the boxes only roughly corresponds to the relative locations of states on an accurate map.
  793. usa_matrix, a Python code which defines the adjacency matrix for US states, using a variety of matrix formats.
  794. van_der_corput, a Python code which computes elements of the van der Corput 1-dimensional Quasi Monte Carlo (QMC) sequence, using a simple interface.
  795. vandermonde_approx_1d, a Python code which finds a polynomial approximant to data y(x) of a 1D argument by setting up and solving an overdetermined linear system for the polynomial coefficients involving the Vandermonde matrix.
  796. vandermonde_interp_1d, a Python code which finds a polynomial interpolant to data y(x) of a 1D argument by setting up and solving a linear system for the polynomial coefficients involving the Vandermonde matrix, creating graphics with matplotlib().
  797. vanderpol_ode, a Python code which sets up the ordinary differential equations (ODE) for the van der Pol oscillator, for which a limit cycle exists.
  798. vanderpol_ode_period, a Python code which sets up the ordinary differential equations (ODE) for the van der Pol oscillator in order to estimate the period of the limit cycle.
  799. vector, a Python code which considers a problem involving vectors, which can be considered to belong to equivalence classes, for which an arbitrary collection of coefficients must be gathered, averaged, and then scattered again.
  800. velocity_verlet, a Python code which uses a version of the velocity Verlet method to solve a second order ordinary differential equation (ODE) of the form y''=f(t,y).
  801. vin, a Python code which computes the check digit for a Vehicle Identification Number (VIN), or verifies that a given VIN is legitimate.
  802. voronoi_plot, a Python code which estimates the Voronoi neighborhoods of points using sampling, and with a distance based on the L1, L2, LInfinity or arbitrary LP norms;
  803. voronoi_test, a Python code which demonstrates the use of the scipy.spatial function Voronoi(), to compute a Voronoi diagram, and voronoi_plot_2d(), to display it.
  804. walker_sample, a Python code which efficiently samples a discrete probability density function (PDF) represented by a vector, using Walker sampling.
  805. walsh_transform, a Python code which implements the Walsh data transform.
  806. wathen_matrix, a Python code which compares storage schemes: full, banded, sparse triplet, sparse, and solution strategies: A\x, Linpack, conjugate gradient, for linear systems involving the Wathen matrix, which can arise when solving a problem using the finite element method (FEM).
  807. web_matrix, a Python code which stores sample matrices describing a web page network. These matrices are typically very sparse, and the examples here are stored using the sparse triplet (ST) format. They can be used to demonstrate pagerank and other graph algorithms.
  808. wedge_exactness, a Python code which tests the exactness of a quadrature rule over the interior of the unit wedge in 3D.
  809. wedge_felippa_rule, a Python code which returns a Felippa quadrature rule for approximating integrals over the interior of the unit wedge in 3D.
  810. wedge_grid, a Python code which computes a grid of points over the interior of the unit wedge in 3D.
  811. wedge_integrals, a Python code which returns the exact value of the integral of any monomial over the interior of the unit wedge in 3D.
  812. wedge_monte_carlo, a Python code which uses the Monte Carlo method to estimate an integral over the interior of the unit wedge in 3D.
  813. weekday, a Python code which determines the day of the week corresponding to a given date, such as 14 October 1066, Julian calendar, ... which was a Saturday.
  814. weekday_zeller, a Python code which uses the Zeller congruence to determine the day of the week corresponding to a given date, such as 13 July 1989, Gregorian calendar, ... which was a Thursday.
  815. will_you_be_alive, a Python code which carries out the probability simulations described in "Will You Be Alive 10 Years From Now?" by Paul Nahin;
  816. wishart_matrix, a Python code which produces sample matrices from the Wishart or Bartlett distributions, useful for sampling random covariance matrices.
  817. wtime, a Python code which shows how to return a reading of the wall clock time.
  818. xml_to_fem, a Python code which reads an XML file created by dolfin() or fenics(), describing a mesh in 1D, 2D, or 3D, and extracts two sets of information, namely, the coordinates of nodes, and the indices of nodes that form each element, which constitute a finite element method (FEM) mesh of the geometry.
  819. xyz_display, a Python code which displays a 3D plot from a file of (X,Y,Z) point coordinates.
  820. zero_brent, a Python code which seeks a solution of a scalar nonlinear equation f(x)=0, by Richard Brent.
  821. zero_chandrupatla, a Python code which finds a zero of a scalar function of a scalar variable, starting from a change of sign interval, using the Chandrupatla method, which can converge faster than bisection, regula falsi, or Brent's method, by Tirupathi Chandrapatla.
  822. zero_itp, a Python code which finds a zero of a scalar function of a scalar variable, starting from a change of sign interval, using the Interpolate/Truncate/Project (ITP) method, which has faster convergence than the bisection method.
  823. zero_laguerre, a Python code which uses Laguerre's method to find the zero of a function. The method needs first and second derivative information. The method almost always works when the function is a polynomial.
  824. zero_muller, a Python code which seeks a root of a nonlinear equation using the Muller method, with complex arithmetic.
  825. zero_rc, a Python code which seeks a solution of a scalar nonlinear equation f(x)=0, using reverse communication (RC), by Richard Brent.
  826. zombie_ode, a Python code which sets up a system of ordinary differential equations (ODE) for a generalized Susceptible-Infected-Recovered (SIR) disease model to simulate a zombie attack, developed by Philip Munz.


Last revised on 18 November 2024.