Minor formatting

This commit is contained in:
jos 2015-08-11 22:28:42 +02:00
parent 4f00a69386
commit 1235ed485a
3 changed files with 21 additions and 27 deletions

View File

@ -80,6 +80,7 @@ var correct2 = math.unit('8.314 (m^3 Pa) / (mol K)'); // Unit 8.314 (m^3 P
var correct3 = math.unit('8.314 (m^3 * Pa) / (mol * K)'); // Unit 8.314 (m^3 Pa) / (mol K)
```
But this expression, which omits the second `/` between `mol` and `K`, results in the wrong value:
```js
// Missing the second '/' between 'mol' and 'K'
var incorrect = math.unit('8.314 m^3 Pa / mol K'); // Unit 8.314 (m^3 Pa K) / mol

View File

@ -8,24 +8,22 @@ var math = require('../index');
console.log('create units');
var a = math.unit(45, 'cm');
var b = math.unit('0.1m');
print(a); // 450 mm
print(b); // 100 mm
print(a); // 450 mm
print(b); // 100 mm
console.log();
// units can be added, subtracted, and multiplied or divided by numbers and by other units
console.log('perform operations');
print(math.add(a, b)); // 0.55 m
print(math.multiply(b, 2)); // 200 mm
print(math.divide(math.unit('1 m'), math.unit('1 s')));
// 1 m / s
print(math.pow(math.unit('12 in'), 3));
// 1728 in^3
print(math.add(a, b)); // 0.55 m
print(math.multiply(b, 2)); // 200 mm
print(math.divide(math.unit('1 m'), math.unit('1 s'))); // 1 m / s
print(math.pow(math.unit('12 in'), 3)); // 1728 in^3
console.log();
// units can be converted to a specific type, or to a number
console.log('convert to another type or to a number');
print(b.to('cm')); // 10 cm Alternatively: math.to(b, 'cm')
print(math.to(b, 'inch')); // 3.937 inch
print(math.to(b, 'inch')); // 3.9370... inch
print(b.toNumber('cm')); // 10
print(math.number(b, 'cm')); // 10
console.log();
@ -33,8 +31,8 @@ console.log();
// the expression parser supports units too
console.log('parse expressions');
print(math.eval('2 inch to cm')); // 5.08 cm
print(math.eval('cos(45 deg)')); // 0.70711
print(math.eval('90 km/h to m/s')); // 25 m / s
print(math.eval('cos(45 deg)')); // 0.70711...
print(math.eval('90 km/h to m/s')); // 25 m / s
console.log();
// convert a unit to a number
@ -44,7 +42,7 @@ console.log();
// simplify units
console.log('simplify units');
print(math.eval('100000 N / m^2')); // 100 kPa
print(math.eval('100000 N / m^2')); // 100 kPa
print(math.eval('9.81 m/s^2 * 100 kg * 40 m')); // 39.24 kJ
console.log();
@ -57,7 +55,7 @@ var v = math.divide(math.multiply(Rg, T), P);
console.log('gas constant (Rg) = ', format(Rg));
console.log('P = ' + format(P));
console.log('T = ' + format(T));
console.log('v = Rg * T / P = ' + format(math.to(v, 'L/mol')));
console.log('v = Rg * T / P = ' + format(math.to(v, 'L/mol'))); // 23.910... L / mol
console.log();
console.log('compute speed of fluid flowing out of hole in a container');
@ -66,17 +64,17 @@ var h = math.unit('1 m');
var v = math.pow(math.multiply(2, math.multiply(g, h)), 0.5);
console.log('g = ' + format(g));
console.log('h = ' + format(h));
console.log('v = (2 g h) ^ 0.5 = ' + format(v));
console.log('v = (2 g h) ^ 0.5 = ' + format(v)); // 4.429... m / s
console.log();
console.log('electrical power consumption:');
var expr = '460 V * 20 A * 30 days to kWh';
console.log(expr + ' = ' + math.eval(expr)); // 6624 kWh
console.log(expr + ' = ' + math.eval(expr)); // 6624 kWh
console.log();
console.log('circuit design:');
var expr = '24 V / (6 mA)';
console.log(expr + ' = ' + math.eval(expr)); // 4 kohm
console.log(expr + ' = ' + math.eval(expr)); // 4 kohm
console.log();
console.log('operations on arrays:');
@ -84,10 +82,10 @@ var B = math.eval('[1, 0, 0] T');
var v = math.eval('[0, 1, 0] m/s');
var q = math.eval('1 C');
var F = math.multiply(q, math.cross(v, B));
console.log('B (magnetic field strength) = ' + format(B));
console.log('v (particle velocity) = ' + format(v));
console.log('q (particle charge) = ' + format(q));
console.log('F (force) = q (v cross B) = ' + format(F));
console.log('B (magnetic field strength) = ' + format(B)); // [1 T, 0 T, 0 T]
console.log('v (particle velocity) = ' + format(v)); // [0 m / s, 1 m / s, 0 m / s]
console.log('q (particle charge) = ' + format(q)); // 1 C
console.log('F (force) = q (v cross B) = ' + format(F)); // [0 N, 0 N, -1 N]
/**
* Helper function to output a value in the console. Value will be formatted.

View File

@ -95,14 +95,9 @@ The website is located in the `gh-pages` branch of the project.
Follow the readme in the `gh-pages` branch on how to update the website.
## Update version number
## Back to develop
Switch to the develop branch, and update the version numbers in package.json and
bower.json to a new snapshot version, like
1.2.5-SNAPSHOT
commit and push the changes.
Switch to the develop branch
## Done