Mathjax

jsxgraph

Thursday, June 13, 2013

Factorial - Spreadsheets

Spreadsheet Factorials

Spreadsheets can be used for programming computations.  Without scripts or macros a spreadsheet does not have a loop capability.  But, it can perform computations referencing cells to provide a sequence of cells with factorials.  Cells are much like variables in other programming languages, they store values.

Tuesday, June 11, 2013

Factorial - scripts - sh, csh, dc, bc

Sunday, June 9, 2013

More Factorial Fun, Python and Lisp

More Factorial Fun, Python and Lisp


This continues the factorial study started in the prior post.  The factorial increases rapidly and can be programmed as a simple loop.  The factorial, indicated with an exclamation point after a positive integer number is the product of all integers from 1 up to and including the integer.

Wednesday, June 5, 2013

Factorial Programs (Fortran and C Family)

Factorial Fun

 There are many computer programming languages and many more being developed all the time.  Usually the first program when learning a new language is "Hello World!", which outputs the text "Hello World!" to the screen.
For engineers, scientist and mathematicians the next program should be the factorial.  The factorial is symbolized with an exclamation point, !, after a positive integer.  It occurs often in probability and series.  The factorial is the product of all integers from one up to and including the number.
  • 1! = 1
  • 2! = 1*2 = 2
  • 3! = 1*2*3 = 6
  • 4! = 1*2*3*4 = 24
  • 5! = 1*2*3*4*5 = 120
 The factorial increases rapidly showing computer artifacts due to limited precision.

The following example programs in various computer languages take a number from the user, without checking if it is valid, to keep the code simple, and returns its factorial.  Each example includes an introduction and detailed description.

Monday, April 15, 2013

PDE1D - A code for comptational methods for 1 dimensional PDEs


 I have been working on a program for teaching and research on One Dimensional Partial Differential Equation Numerical Solution Methods.  I hope to add many more methods and PDE equations.  The current Wave and Burger's Equation solvers with symmetric boundary conditions can be fun to play with various parameters.  The figure below shows solutions using three different solvers at a CFL of 0.9.  CFL is a time step constraint where at a CFL of 1 the wave would travel one point each step.  The methods shown are 1st order upwind Euler explicit which is dissipative so the amplitude decreases.  The FEM, Finite Element Method, uses the very stable trapezoidal time integration with linear elements.  This FEM method has no dissipation but some phase error resulting in a shift in the peak values.  Finally the RK4 - Fourth order Runge Kutta method using FEM linear elements is the most accurate but requires more computation and is stable only to CFL  = 1.


PDE1D screen shot.