Javascript for Chemistry

The following JavaScript snippets and applications are taken from my upcoming book JavaScript for Chemistry by F. Senese. The scripts exploit new JavaScript 1.1 features and won't work properly with pre-3.0 versions of Netscape Navigator. Have fun with them- but please ask for my permission if you want to publish them or use them in commercial ways.

Popup Periodic Table

This simple periodic table was designed to be used as a very quick popup reference on cgi-based chemistry tests, not as a comprehensive element database. Most of the excellent (but cyclopean) periodic tables now on the Web require a client-server dialog every time the user requests an atomic weight. Being JavaScript, this table executes entirely on your browser. That takes a load off your server when you are testing very large classes- and a client-side table works even when you're off line. The table is sized to fit a default browser window comfortably.

The script shows how a rather complex panel of equally sized buttons is built with HTML tables. (Padding the button labels with blanks doesn't work). The buttons are rendered to the desired width and then their values are reset with JavaScript.

Real and Ideal Gas Law Calculator

This script solves the ideal gas, van der Waals, and Dieterici equations of state for pressure, volume, temperature, or moles in a variety of convenient units. Semiempirical parameters are computed from critical point data- a database of common gases is included in the script, but you can input your own critical point data if you wish. The Boyle temperature and the critical compressibility factor are computed for the semiempirical equations, as well.

This script illustrates basic spreadsheet-style forms and event-driven calculations with JavaScript. It contains functions that use fixed point, Newton's method, and bisection to iteratively solve the nonlinear semiempirical equations.

Le Chatelier's Principle
Titration Curve Simulator
Particle in a Box
C-13 NMR Simulator
Simplex Optimization
[an error occurred while processing this directive]