| 1 |
#!/bin/sh |
| 2 |
# This shell script runs Mathomatic with the GNU m4 macro pre-processor so that |
| 3 |
# standard math functions such as sqrt(x), sin(x), etc. may be easily entered. |
| 4 |
# Hyperbolic trig has "h" appended, like sinh(x) for hyperbolic sine. |
| 5 |
# Only works with GNU software. |
| 6 |
# See file "functions.m4" for the complete list of supported functions, |
| 7 |
# or type "man rmath" at the shell prompt. |
| 8 |
# |
| 9 |
# Usage: matho [ input_files ] |
| 10 |
|
| 11 |
MATHOMATIC="${0}matic" |
| 12 |
MFUNCTIONS="${0%/matho}/functions.m4" |
| 13 |
MOPTIONS="-ru -s-1" |
| 14 |
|
| 15 |
if ! m4 --version >/dev/null |
| 16 |
then |
| 17 |
echo The \"m4\" package is not installed. GNU m4 is required to run m4 Mathomatic. |
| 18 |
exit 1 |
| 19 |
fi |
| 20 |
|
| 21 |
if [ -x "$MATHOMATIC" ] |
| 22 |
then |
| 23 |
echo Running "$MATHOMATIC" |
| 24 |
m4 -eP -- "$MFUNCTIONS" "$@" - | "$MATHOMATIC" $MOPTIONS |
| 25 |
elif [ -x ../mathomatic ] |
| 26 |
then |
| 27 |
echo Running ../mathomatic |
| 28 |
m4 -eP -- "$MFUNCTIONS" "$@" - | ../mathomatic $MOPTIONS |
| 29 |
else |
| 30 |
echo Running mathomatic |
| 31 |
m4 -eP -- "$MFUNCTIONS" "$@" - | mathomatic $MOPTIONS |
| 32 |
fi |