Introduction

This notebook, and its companion notebook EDemoII, are provided as a demonstration of calcE, a collection of Mathematica packages. 
    The first section, About calcE, explains what the product is about and what it hopes to accomplish.
    The demonstration, beginning in the section MathE and continuing throughout this notebooks and EDemoII, is provided by way of evaluated input cells with no commentary. In each example there are things that Mathematica does not do "out-of-the-box", or does only with considerably more effort than calcE requires.
    I suggest you just skim through the first time; then later go through the examples more carefully, paying attention to the simple syntax and the resulting output. Do not re-execute the input cells, as they will not work without the calcE package! calcE ships with extensive documentation, from which these examples are taken.
    Each notebook contains a lot of graphics cells, intended for use with version 2.1 or higher of Mathematica. In computers with limited memory, this may cause problems if you scroll through an entire notebook at once. If you see your memory is running low, just close the notebook, reopen it, and continue from where you left off.

Note: Some graphics cells contain the Greek letter pi, which only displays properly on Macintoshes. This is an oversight of mine which I have repaired on the notebooks for version 2.1 and higher, but which is inconvenient for me to repair in these notebooks for version 2.0. If the commands were executed on computers other than a Macintosh, the string "pi" would appear in the graphic instead.

About calcE

What is calcE?

calcE is a collection of Mathematica packages and supporting documentation. The goal is to improve the power and ease of use of Mathematica through extensive use of Mathematica's internal programming language, with emphasis on graphics.

The calcE Story

calcE grew out of my frustration with the standard Plot command in Mathematica. In December 1990 I began tinkering with the Plot command to see if I could improve it. I found that I could capture the results of Plot, disassemble them, and put them back together the way I wanted. I also found that could capture the contents of the command before execution, and have Mathematica itself translate them into its own language. It then became possible to use easy English words in place of obscure and lengthy options, and to have each item recognized as what it was (function, label, style, geometric object, etc.) and used accordingly.
    I also began applying the same techniques to other commands. Since I am involved in developing and administering a teaching laboratory, I wanted to make using Mathematica as easy as possible for students, who are nearly always new to Mathematica but need to begin using it immediately. As a result calcE concentrates on the basic everyday activities of Mathematica, such as defining functions, producing graphics, making tables of values, performing algebraic manipulations, and solving equations.

The calcE Philosophy

I believe that Steven Wolfram and the programmers at Wolfram Research have done an outstanding job designing and implementing the Mathematica kernel. They have made a great number of excellent design decisions that make Mathematica an extremely powerful and flexible tool.
    But many of those design decisions have also made Mathematica more difficult to use. I think it is neither desirable nor necessary for non-expert users, or even expert users who are just trying to get something done, to have to face the consequences of every design decision. It is possible for Mathematica to be both powerful and easy-to-use. Here are some of the principles I have tried to follow in the development of calcE:

-- Syntax should be as simple and flexible as possible.

-- All commonly used commands and functions should be accepted in lower case 
    form.

-- Whenever possible, there should be no restriction on the order in which items 
    appear inside a command.

-- Commonly used options should be replaced by easy-to-remember "keywords", 
    single words appearing as items.

-- A single comprehensive command is better than a lot of specialized 
    one-gimmick commands that are difficult or impossible to use in combination.

-- When defining enhanced commands, the standard Mathematica syntax should 
    still work, giving the same result. The original command should still be 
    accessible to the user.

Files Included

Packages

calcE.m
    contains everything in the five packages below in one convenient package for 
    easy loading. Uses 900K of kernel memory in Macintosh version 2.2.
InitE.m
    contains many utility routines used by the other packages, lower case 
    substitutions for standard Mathematica words, and the EOn/EOff and 
    lcOn/lcOff routines that control conversion to enhanced commands and 
    conversion of lower case words, respectively. Uses 92K of kernel memory in 
    Macintosh version 2.2. Required by all other packages.
MathE.m
    contains routines for everyday use concerning basic numerical calculations and 
    algebra. These include the enhanced commands DefinE, ExpandE, FactorE, 
    MaxE, MinE, NestE, NestListE, NSolvE, RoundE, SolvE, and TablE; also 
    facilities for defining and using Piece functions, and several other minor 
    improvements. Uses 75K of kernel memory in Macintosh version 2.2. 
    Automatically loads InitE.m if needed.
PlotE.m
    contains the enhanced command PlotE. Uses 392K of kernel memory in 
    Macintosh version 2.2. Automatically loads InitE.m and MathE.m if needed.
TeachE.m
    contains routines for use in a teaching laboratory and for general use in 
    calculus. The enhanced commands DiffE, IntegrateE, and NIntegratE 
    are included, along with the following routines: CSpline, Difference, 
    PartialSum, DRule, Euler, FindInverse, ImplicitD, Improper, 
    Subst, IBP, InterP, RandomFunction, TrigSolve, Newton, Riemann, 
    Trapezoidal, Simpson, Cobweb, SlopeMovie, DerivMovie, ParaMovie, 
    DrawArea, AreaGraph, and DrawAreaGraph. Uses 328K of kernel memory 
    in Macintosh version 2.2. Automatically loads InitE.m, MathE.m, and PlotE.m if 
    needed.
Plot3DE.m
    contains the enhanced command Plot3DE. Uses 38K of kernel memory in 
    Macintosh version 2.2. Automatically loads InitE.m and MathE.m if needed.

Notebooks

InitE.ma
MathE.ma
PlotE.ma
TeachE.ma
Plot3DE.ma
    all contain the code for their respective packages in notebook form for 
    convenient browsing. These can also be directly loaded if desired just like 
    packages.

Documentation

CalcEDoc.ma  (This file) 
   contains general information about calcE and documentation for the 
    user features of InitE.

The remaining documentation files are loaded with examples showing how calcE can be used.

MathEDoc.ma
    contains documentation and examples for the package MathE.m.
PlotEDocI.ma
    contains documentation and examples for the package PlotE.m, except for 
    geometric objects.
PlotEDocII.ma
    contains documentation and examples for geometric objects in the package 
    PlotE.m.
TeachEDoc.ma
    contains documentation and examples for the packages TeachE.m and 
    Plot3DE.m.

Installing and Using calcE

The simplest thing to do is to copy all packages (or if you prefer, all notebook versions of the packages, or both) into your Mathematica "Packages" folder or directory. You may need assistance from your system adminstrator if installing on a Unix system.
    You can then load calcE by executing the command line

<<calcE.m

or similarly to load the smaller packages. You may wish to have calcE loaded automatically when Mathematica starts up. You can do this by placing this command line in the package init.m, a package used by Mathematica specifically for such purposes.
    In any case it is best to load calcE.m at the beginning of a work session. If you do some other calculations first, or attempt to use commands or keywords from calcE before loading the package, you may fall victim to the "shadow trap", where commands or other words defined in a package are hidden because they were previously used in the Global context (where new words ordinarily go). If you see a number of "shdw" warning messages when loading calcE, it is simplest to quit Mathematica and restart it. Even for experts this is often the quickest way to get a fresh start.
    Not sure what to do first? Open up one of the documentation notebooks, and evaluate the example input cells as you go along. If you have plenty of memory, you can just select "Evaluate Notebook" from the Action menu.

Space, Time, and Reality

calcE shares some of the problems of Mathematica itself.
    calcE will add to the usual problems of RAM shortage. The full calcE package takes up about 900K of kernel memory in the Macintosh 2.2 version, even more for earlier versions, although the package itself is just a little over 200K. It also takes 1-2 minutes to load. You can cut down on these problems somewhat by removing the usage messages, which take up about 25% of the code. The main disadvantage of doing so is that the Function Browser (notebook versions 2.2 and higher only) then does not contain information on calcE.
    PlotE runs about 3 times slower than Plot. This is hard to complain about since Plot by itself does so little, but it is an important issue for teaching laboratories using slower computers. You can help somewhat by changing the option Asymptotes->True to Asymptotes->False, which tells PlotE not to attempt to locate and draw asymptotes.
    Finally, does calcE gum up your ordinary uses of Mathematica? No, it is 99.4% compatible with standard Mathematica syntax. The single major exception is that SolvE by default does not give solutions in Rule form. To fix this, you can change the option Rules->False to Rules->True. Another step to ensure compatibility is to execute EOff (see InitE documentation below), which turns off conversion of standard functions to enhanced functions. Then you have direct access to the old Plot, the old Solve, etc.

About This Version

Version 2.0 is the first version released to the public. I am not starting with version 2.0 in the way that some people start numbering their checks at 2000; this is a legitimate version number. In the last two years I have been through versions 1.0, 1.1, 1.2, etc., each with many subversions.

Help and Support

The packages MathE and PlotE are fully documented, and the documentation for TeachE and Plot3DE is adequate or better, in the documentation notebooks listed above. InitE is not properly documented at this time. All commands, functions, options, and keywords have usage messages defined, so you can use the Function Browser as online help (available on some platforms in version 2.2 or higher).

Mathematica is a very complex program, and so (in its own little way) is the calcE package. As one way of measuring the complexity, there are 339 usage messages defined in the calcE code, each one representing a new command, function, option, or keyword. Most of you will think of ways of combining of the hundreds of features in this package that I have never thought of, and therefore have not tested. Trust me, there will sometimes be problems or bugs! But chances are, they will occur when you are attempting to do something you wouldn't have dreamed of attempting without calcE!

If you have problems with calcE, you can get support by electronic mail at rmercer@desire.wright.edu, by fax at 513-429-2179, or by post at
SoftE Solutions
P.O. Box 340388
Dayton, OH 45434.
    I would like to hear not only about what doesn't work, but what doesn't work the way you think it should, and what is not in the package that should be. Help make the next version a better product by sending in your suggestions!

calcE License Information

Current Price List (valid through June 30, 1994):

Individual license	       $40.00 US each
Group license	            $20.00 US each (minimum purchase: 5 licenses)
Student license	          $15.00 US each (verification of student status required)
Department license	$1000.00 US
Site license	                 10% of first-year cost of Mathematica site license

Ohio residents must pay applicable sales tax.
Individual and Group licenses include free updates to the next major release. Department and Site licenses include free updates to all major releases within two years of purchase date.
Licenses may be ÒupgradedÓ to a Group, Department, or Site license provided the same account (person or institution) that made the original purchase pays the difference.

Individual License

An Individual license gives you the right to
(a)	install calcE on one computer for use on that computer only, or
(b)	install calcE on up to three computers, provided the license holder is the sole user of Mathematica on each computer.

Group License

A Group license gives you the right to
(a)	install calcE on one computer for use on that computer only, or
(b)	install calcE for use in conjunction with a Mathematica network license, provided that that the number of group licenses purchased for this purpose equals the maximum number of users allowed by the Mathematica network license.

Student License

A Student license gives you the right to
	install calcE on one computer for use on that computer only.

Department License

A Department license gives you the right to
install calcE on any combination of computers  or network license servers, provided that that no more than one hundred users at any one time are allowed by the combined Mathematica machine and network licenses installed on those computers or servers.

Site License

A Site license gives you the right to
install calcE on all computers or network license servers owned by the purchasing institution which are included in a single Mathematica site license.

Mathematica  is a registered trademark of Wolfram Research, Inc.

About the Author

Dr. Richard Mercer is an Associate Professor of Mathematics at Wright State University, where he has been employed since receiving his Ph. D. in Mathematics from the University of Washington in 1980.

MathE

Table[k+m,{k,{2,5,a,b}},{m,2,4}]

data = {{3.41,8.03,7.65},{4.24,9.91,0.25},{1.78,2.64,5.53}};
Table[data,"A","B","C"];

Table[t,Sin[t],Cos[t],Tan[t],{t,{0,Pi/6,Pi/4,Pi/3,Pi/2}},
	Show,Exact];

Table[h,Sin[h]/h,{h,{0.1,0.01,0.001,0.0001,0.00001}},
"h","sin(h)/h",Show,12 Places];

Define[g[x,y] = a Cos[x^2 + y^2],h[t] = 2t/(1-t)];
g[x,y]
h[t]

Solve[x^2 - 3x + 2 = 0]

Solve[x^2 - 3x + 2 = 0,Rules]

Solve[{2a + 3b - 2c = 7,
				a -  b + 4c = -1,
			-3a + 2b +  c = 3}]

Solve[{x^2 - y^2 = 4,x^2 + y^2 = 9}]

Solve[x^2 - 3x + 2 = 0]

Solve[x^2 - 3x + 2 = 0,Rules]

Solve[{x^2 - y^2 = 4,x^2 + y^2 = 9}]

Round[Pi^E,8 Places]

Round[E^Pi,6 Digits]

MaxE[{20,E^Pi,Sqrt[167],fred}]
MinE[{20,E^Pi,Sqrt[167],fred}]

NestList[4x-4x^2,0.6,10]

Sub[x^3 - 4x^2 + 12,x = 2]
x

Sub[x^3 - 4x^2 + 12,{x->2,x=3,x==4}]

Sum[Range[1,100]]

Product[Table[Prime[k],{k,10}]]

PlotE

Plot[Table[Sin[k*x],{k,8}],{0,Pi/2}];

Plot[Table[Sin[k*x],{k,6}],{0,Pi/2},Mono];

Plot[{x==Cos[t],y==Sin[t]},{t,0,2Pi},Rainbow];

Plot[{-1,1},Square,
	{x==Cos[2t],y==Sin[3t],{t,0,2Pi}},
	Table[{Random[],Random[]},{10}],
	1/(1+n^2),x^2,x^2+y^2==1
];

Plot[x^4 - x^2,{-2,2},Direction];
Plot[x^4 - x^2,{-2,2},Concavity];

Plot[x^2,{0,3},
	Point[2,1,Red,Large,"P",Coords,Right],
	Point[2,"Q",Left,Above,XCoord],
	Point[{1,4},Green,Small,"R",Left,YCoord,Right,Below]
];

Plot[2x - x^2,{0,2},
	Line[0.5,1.75,Red,Dotted,"Line1",Dots,Coords,Above],
	Line[0.45,Horizontal,Green,Thick,"Line2",Below],
	Line[{1.2,0.7},Slope[-1/2],Gray,Thin,"Line3",Right]
];

Plot[{0,1},Square,Frame,
	Lines->{
	{Table[{{0,0},{Cos[k Pi/2],Sin[k Pi/2]}},{k,0,1,0.1}],
	Red},
	{Table[{{1,1},{Cos[k Pi/2],Sin[k Pi/2]}},{k,0,1,0.1}],
	Cyan}}
];

Plot[Sin[x],{0,2Pi},{-1.5,1.5},Gray,
	Tangents->{{1.0,2.0,3.0,4.0,5.0,6.0},Length[1],Dots}
];

Plot[{x,-1,1},Square,Frame,
	Region[0,2Pi,{0.5 Cos[t],0.8 Sin[t]},{Cos[t],Sin[t]},
	Cyan,Edges,Gray]
];

Plot[{0,13},{0,8},Same,
	{Triangle[{2,2},1.4],Hexagon[{11,2},0.8],Red},
	{Square[{5,2},1.2],Decagon[{11,5}],Magenta},
	{Pentagon[{8,2}],Octagon[{5,5}],Green},
	{Heptagon[{2,5}],Nonagon[{8,5}],Cyan}
];

myDisk = Disk[{1,1},{0.5,0.3},Red];
PlotE[{-3,3},Square,
	myDisk,Rotate[Pi/3,myDisk],
	Rotate[Pi/4,Square[3,Edges,Green,Dots,Blue]]
];

TeachE

InterP

data = {{0,0.819},{0.01,-1.563},{0.02,-1.258},{0.03,1.},
{0.04,0.425},{0.05,0.256},{0.06,1.101}};

Define[q[t] = InterP[data,2,t]];
q[t]
PlotE[q[t],data,{0,0.06}];

LimitPict

Define[a[n] = (Sqrt[3n^2+2n])/(4n + Cos[n])];
PlotE[a[n],{1,100},{0.4,0.5},Dots,
	LimitPict[Sqrt[3]/4,0.01]
];

RandomFunction

RandomFunction[x]

TrigSolve

TrigSolve[4 Sec[x] + 2 == 7,{-10,10},Rules]

Newton

Newton[Cos[x] - x,1,{0.6,1.2}];

Newton[Cos[x] - x,1,5 Steps,16 Digits];

Riemann

Riemann[Sin[x],{0,Pi},Show]

Riemann[Sin[x],{0,Pi},20,Left,Show]

Riemann[{Sin[x],Cos[x]},{0,Pi/4},10,Upper,Show]

Riemann[{y^2,4 - y^2},{-2,2},10,Upper,Show,10 Places,
Interval->{-Sqrt[2],Sqrt[2]},{0,4},Frame]

Trapezoidal & Simpson

Trapezoidal[Sin[x],{0,Pi},4,Show]

Simpson[Sin[x],{0,Pi},4,Show,10 Digits]

Cobweb

Cobweb[4x-4x^2,{0,1},0.6,10,Square]