<\body> with CAS> <\expand|make-title> > <\abstract> Some famous computer algebra systems (CAS) will be integrated into the Linux-based platform as CAI tools for the higher Mathematical courses. The mini memo will cover some \ topics as follows: <\expand|enumerate-numeric> Maxima: This software is famous for its "Symbolic calculation", including finding limit of functions, differentiation, integration of functions, series expansion etc; Octave: This software has full features about "Numerical calculation" and \ simple syntax to be programmed.\ Gnuplot: The powerful plotting package, it almost has no problem to deal with the scientific or data plotting especially for 2D plots. : Certainly, you have known if you can see this article. Word processing and "GUI" of CAS. It is the simplest way for you to make mathematical document from input to output, I think. All the packages will be integrated into bootable Linux CDROM. In other words, you can continue your paper work in any place with this platform ( and disk for storing data) even in net-coffee store. Now, let us explore the journey and hope you enjoy it! In this chapter, the individual basic introductions about , core of this book, and the tools about computer algebra systems, CAS, and graph will be given. > This is not only introduction for the people who want to learn how to use , but a note for newbie with some experiences. We try to follow the rules to describe how to making documents. From now on, [] means the option, , in the menu bar. While you execute the from X-terminal, you will see the window. If you are first use this application, the document is also opened in the worksheet windows. Press the button in the menu bar, [File] > [New], to open a new buffer for writing document directly or just as doing something "presume document setting": <\expand|enumerate-numeric> [Document] > [style] > [format that you want to write], almost styles generally used in , for example: article, letter etc., can be found in this menu.\ [Text] > [Title] \ > [Make title] \ > [Abstract], author, date and address can also be added.\ [Text] > [Section] and so on. The content part of article can be manipulated just as any work processing programs do. \ Generally, part 1 and 2 \ can be omitted if your do not hear about or simply type a document. For ers, the document uses "letter" style. If you do not care about how to make content with any mathematical symbols, now stop reading. If text input can not satisfy you, just go continuously. The philosophy for to manipulate the contents is similar to does ( but not equal to). Content inputs are divided into three types: modes.\ <\expand|enumerate-numeric> Type text as any WYSIWYG editors do. Math content, i.e. mathematical symbols together with text content in one line. Then:\ <\expand|enumerate-alpha> Press the menu bar []>, or [Text] > [Mathematics] > [Formula] or press , to change the mode from text mode into math mode. The third line of menu bar changes for suitable mathematical choice icons. But the usages are still functional mostly.\ Press [>] or back to the text mode after inputting mathematical content. The symbols are just like these of usages in . For example: backslash> produces >. Display Math content, i.e. independent line or lines for Mathematical symbols.\ <\expand|enumerate-alpha> Choose []> > [Equation], for one-line mathematical input, corresponding command is double US dollar sign; choose []> > [Equations], multi-line mathematical input, corresponding command is environment. Use [>] to change next cell and [Enter] to change new line. The exact cell position is shown at the right-down corner.\ How do I know at which is in "text" mode or in "math" mode? The same environment is enclosed by a> rectangle. Yor can move by the mouse or the "right arrow", [>>], and "left arrow", [>>], keys to change the mode. Now, let us show some examples: <\example> (Riemann Integral) \ \ \ \ [Text][Environment] >> [Example], just like , it is auto-numbered. Press [Enter] to input the following: \; Let > be defined on the closed interval >, and let >> be a partition of > given that <\expand|equation*> a=x\x\x\\\x\x=b > where x>> is the width of the >th subinterval. If >> is any point in the >th subinterval, then the sum <\expand|equation*> <\with|paragraph mode|left> <\with|right margin|> f(c)\x, \ \ \ \ > \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \c\x> is called the >> of > for the partition of >>. \; The parts in blue color are in math mode (press and then [>>] back to the text mode again) and the parts in red are in display Math mode ( press []> > [Equation] and move cursor by mouse into next line back to the text mode). The messages shown at the bottom line of may help you at which mode you are and what you have done. <\example> As above, if the limit <\equation> \\<\|\|\> \0>f(c)\x> exists where \\<\|\|\>=i\n>\|x-x\|>>> then > is integrable on > and the limit is denoted by <\equation> \\<\|\|\> \0>f(c)\x=f(x) d x.> The limit is call the . The number of equation is produced by [Mathematics] >[Number equation] in display Math mode. \; In these two examples, just type as you do in environment, for example >>> means upper script input and >> means lower script input, but not all same. <\example> (Gauss Law) In Math or display Math mode, we can adjust the script by: <\expand|itemize-dot> Press [Mathematics] > [Script] >[Script below] or [Script above], to add new line below or above the math symbol. This is as like the effect of limit>> command after normal mathematical command.\ Input symbols under or above other symbols in display math mode, as above adding script space ahead, <\expand|equation*> <\with|mode|text> <\equation> |S>\\\ \ \ \ d S =4\q After working, choose [File] >[Save] and give a filename, for example \ . This will create a file named as in your home directory. If you work on Knoppix Linux, everything will be disappeared after turning off the power since it works on RAM. You had better to use the following command to backup worksheet: <\code> \ mcopy filename.tm a: Now you can turn off the system. Then you can fire up your and enjoy! Not only the powerful ability of publishing text and math documents, CAS applications can be executed within session of , solving problems and making graphs. The computation ability of CAS will be introduced later and how-to making graphs will be introduced first. Some \ CAS sessions allow to produce in-line postscript graph in worksheets, i.e. Gnuplot, Octave, but some are not, for example Maxima. For the latter case, users have to embed the result graphs into the worksheet. \ <\example> How can do with CAS? The answer is very simple: , including , for example Maxima and Yacas,, for example Octave, and . <\note> Remember, Before quit out from the CAS session, remember to close session by pressing the third icon in the third line of menu bars. Here, we will give a brief introduction for CAS working within . <\definition> is called a function of , subset of real numbers, if there is only unique \> for each point, in . <\example> Maxima session: [Text] >[Session] > [Maxima] <\session|maxima|default> <\output> GCL (GNU Common Lisp) \ Version(2.5.0) g \ 2 \ 7 19:50:19 CST 2003 Licensed under GNU Library General Public License Contains Enhancements by W. Schelter Maxima 5.9.0rc3 http://maxima.sourceforge.net Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. \; <\input|<\with|color|red> (C1) > f(x):=x^3+sin(x) <\output> <\with|mode|math> >fx:=x+sin x> \; <\input|<\with|color|red> (C2) > f(%pi) <\output> <\with|mode|math> >\> \; <\input|<\with|color|red> (C3) > h(x):=block([u:x,w], if (u\0) then w:sin(x) else w:-sin(x), u+w) <\output> <\with|mode|math> >hx:=u:x,w,u\0w:sin xw:-sin x,u+w> \; <\input|<\with|color|red> (C4) > h(1) <\output> <\with|mode|math> >sin 1+1> \; <\input|<\with|color|red> (C5) > h(-2.0) <\output> <\with|mode|math> >-1.090702573174318> \; <\input|<\with|color|red> (C6) > integrate(x*((x-1)/(x+1))**(1/2),x); <\output> <\with|mode|math> >4*>+1|8>->-1|8>+>->|-x-1|x+1>+x-1|x+1>+4>> \; <\input|<\with|color|red> (C7) > diff(d6,x) <\output> <\with|mode|math> >4*--+x-1|x+1>-x-1|x+1>*3*>->|-x-1|x+1>+x-1|x+1>+4>+-x+1>|16*>*>+1>--x+1>|16*>*>-1>+>*-x+1>|2>--x+1>|2*>>|-x-1|x+1>+x-1|x+1>+4>> \; <\input|<\with|color|red> (C8) > plot2d(x+sin(x),[x,0,%pi]); <\output> <\with|mode|math> >0> \; <\input|<\with|color|red> (C9) > \; Here, you can directly define functions or use > structure to define complicate function as (C3). Here, is defined as if 0> and as if 0>. Plotting graph is the best way to understand function. Maxima also applies plot functions, . The graph is produced in another X-terminal but not in the worksheet. Use another KDE applications to produce the graph and embed the graph into the worksheet by:\ <\expand|enumerate-alpha> Press [KDE] > [graph] >[ksnapshot] to catch the graph and save it, Press [Insert] > [Image] > [Insert Image] to embed the picture file and scale the sizes of height and width if necessary. <\example> (3D Brownian Motion Particle's Trajectory) Although the graphs of produced by Octave can be embedded into worksheet in general, but it does not always work. example, the following Octave code is is used to simulated Brownian motion within 1 second with time interval, sec. Then output the 3D trajectory of particle in encapsulated postscript format: <\expand|enumerate-roman> Prepare the image file in the one of following formats: PS, EPS, pdf, fig, png, tif, xpm, fig etc. Or, Make graph from CAS and save the screen-shot or store it directly into storage. For\ <\expand|enumerate-alpha> Open [Text] >[Session] >[shell], execute the following octave code to make graph: <\session|octave|default> <\output> GNU Octave, version 2.1.45 (i686-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 John W. Eaton. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. \; Report bugs to \bug-octave@bevo.che.wisc.edu\. \; <\input|octave\ > t_total=1; <\input|octave\ > t_step=500; <\input|octave\ > dim=3; <\input|octave\ > init_po=[0,0,0]; <\input|octave\ > increment=sqrt(t_total/t_step)*randn(t_step,dim); <\input|octave\ > po=[init_po;increment]; b(1,:)=zeros(1,dim); <\input|octave\ > gset parametric;\ <\input|octave\ > gset xrange [-2:2];\ <\input|octave\ > gset yrange [-2:2]; <\input|octave\ > gset zrange [-2:2]; <\input|octave\ > for i=2:t_step b(i,:)=po(i,:)+b(i-1,:); endfor <\input|octave\ > gset set term postscript enhanced color eps; <\input|octave\ > gset xtics 1;gset ytics 1; gset ztics 1; <\input|octave\ > gset output '/home/cchuang/texmacs/brownian.eps'; <\input|octave\ > gsplot b title "3D Brownian Motion"; <\input|octave\ > \; After executing the code, brownian.eps is created. Terminate the \ session and back to the environment. Now choose [Insert] >[Image] > [Insert image] to embed the result graph as follows:\ |eps>||||||> Octave can use the gnuplot syntax to generate graph, but cannot interpreter the resulted PostScript code. Theirfore output the graph and embed it back.\ If the effect is not good-looking enough, you can consider another application session, Gnuplot. Gnuplot is more flexible since it applies many utility functions to manipulate graph, including the off-line modification. For example, press [Text] >[Sessions] >[Gnuplot] enters the session. Some simple examples as follows: <\session|gnuplot|default> <\output> \; <\input|GNUplot] > plot [-pi/2:pi/2][-2:2] x+sin(x) <\output> |ps>||||||> \; <\input|GNUplot] > set noclip ~set yrange[-30:10] ~plot x*(abs((x-4)/(x+4)))**(1./2.)\ <\output> |ps>||||||> \; <\input|GNUplot] > \; \; <\input|GNUplot] > set key left ~set xlabel 'x:[cm]' ~ plot [-pi/2:pi/2] x+sin(x) <\output> |ps>||||||> \; <\input|GNUplot] > set xlabel 'x:[cm]' ~ plot sin(x) <\output> |ps>||||||> \; <\input|GNUplot] > set pm3d hidden 100 ~set style line 100 lt 3 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set nosurface ~set size 0.7,1 ~set view 80,180,1,1 \ ~set noborder \ \ \ \ \ \ \ \ \ \ \ \ ~set noxtics ~set noytics ~set noztics ~set parametric ~set samples 36 \ \ \ \ \ \ \ ~set isosamples 20,36 ~set ticslevel 0 \ \ ~set nocolorbox \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set urange [0:pi] ~set vrange [0:2*pi] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot sin(u)*cos(v),sin(u)*sin(v),cos(u) <\output> |ps>||||||> \; <\input|GNUplot] > set xrange[-5:5] ~set yrange[-2:2] ~f(x)=x\0?-1:1 ~plot f(x) <\output> |ps>||||||> \; <\input|GNUplot] > \; Due to the auto-scaling effect, not all the range of domain of is shown in the first graph. After given the range of variable of , we can observe the graph more explicitly. But how about "" in single line with other plotting command lines? Due to bug interpretation of the interface of gnuplot, tm_gnuplot, gnuplot cannot handle this code with ghostscript. Instead of inputting and in different lines, input ">>" \ to add the set option in normal plotting command. Try directly \ execute the above code to see what about the differences between two statements. Almost CAS's have their plotting philosophy. For example, Octave, the other famous one, not only has its built-in command, >>>>, but also fully supports the Gnuplot functions, only by adding a pre "" before the relative plotting commands.\ <\session|octave|default> <\output> GNU Octave, version 2.1.45 (i686-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 John W. Eaton. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. \; Report bugs to \bug-octave@bevo.che.wisc.edu\. \; <\input|octave\ > x=linspace(-10,10,1000); <\input|octave\ > y=x+sin(x); <\input|octave\ > plot(x,y,";Function y=x+sin(x);"); <\output> \; \; |ps>||||||> \; <\input|octave\ > gset term postscript enhanced eps color; <\input|octave\ > gset output "demo.eps" <\input|octave\ > plot(x,y,";Function y=x+sin(x);") <\output> \; \; |ps>||||||> \; \; <\input|octave\ > \; In the octave generic terminal, the graph will not appear instead of demo.eps being created. By the way, note that its syntax is similar to Matlab but not similar to Maple.\ \; Maxima applies many functions for mathematical calculation, for example, it can be also used to solve the algebra equations: <\session|maxima|default> <\output> GCL (GNU Common Lisp) \ Version(2.5.0) g \ 2 \ 7 19:50:19 CST 2003 Licensed under GNU Library General Public License Contains Enhancements by W. Schelter Maxima 5.9.0rc3 http://maxima.sourceforge.net Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. \; <\input|<\with|color|red> (C1) > linsolve([a*x+b*y=m,c*x+d*y=n],[x,y]); <\output> <\with|mode|math> >x=-,y=> \; <\input|<\with|color|red> (C8) > solve(x^3-x=0,x); <\output> <\with|mode|math> >x=-1,x=1,x=0> \; <\input|<\with|color|red> (C9) > diff((x^2+a)^(1/2),x); <\output> <\with|mode|math> >+a>>> \; <\input|<\with|color|red> (C10) > integrate((x^2+a)^(1/2),x); <\input|<\with|color|red> a> > positive <\output> <\with|mode|math> >>|2>++a>|2>> \; <\input|<\with|color|red> (C11) > integrate((x^2+a)^(1/2),x,0,1); <\input|<\with|color|red> a> > negative <\output> <\with|mode|math> >2*+2+|2>-2**a|2>> \; <\input|<\with|color|red> (C12) > limit((x^2+a)^(1/2),x,0); <\output> <\with|mode|math> >> \; <\input|<\with|color|red> (C13) > \; The symbolic calculation of Maxima has shown above, including solving equations, evaluating limit, differentiation and integration. In the examples of integration, maxima will ask the user more conditions if necessarily. Now let us introduce Yacas (yes, another CAS). The following is mini demo: <\session|yacas|default> <\input|yacas] > Solve(x^3+b+1==0,x); <\output> <\with|mode|math> <\input|yacas] > D(x) (x^2+a)^(1/2); <\output> <\with|mode|math> x+a>2x|2> <\input|yacas] > Limit(x,0) (1-Cos(x))/x^2; <\output> <\with|mode|math> <\input|yacas] > Integrate(x,0,pi) x+Sin(x); <\output> <\with|mode|math> |2>-cos \+1 <\input|yacas] > f(x):= x+sin(x); <\output> <\with|mode|math> <\input|yacas] > GnuPlot(-Pi/2,Pi/2,80,f(x)); <\output> <\with|mode|math> -|2>,|2>,80,fx <\input|yacas] > \; The last command of plotting will not have any correspondence here. <\exercise> Plot the graphs of the following functions: a) +3x-2> \ \ b) +1|x+x+1>> \ c) +1>> \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ d) x/2)-1|1-x>> \ e) +>> \ \ f) > <\exercise> Plot the graph of the function: <\expand|equation*> f(x)= \ \ if x\-1, >>|>>>> <\exercise> Solve for . <\exercise> Differentiate the functions in >. Which application with plotting ability is excellent? This answer will be different for different persons. From my view, Maxima or Gnuplot is better one if the solutions of functions are in explicit form. But if the solution are in implicit form, consider the tools with numerical utility, for example Octave.\ <\example> (Butterfly Effect) Remember what the crazy physician said about this in movie "Jurassic Park". This is one phenomenon about atmosphere and named by its solution curve. This effect depends on the differential equations: <\expand|eqnarray*> (t)|d t>>||(t)-x(t))>>|(t)|d t>>||(t)-x(t)-x(t)x(t)>>|(t)|d t>>|| \ x(t)x(t)-x(t) >>|||(0)=2, x(0)=5, x(0)=10>>>> Solve this initial value problem by Octave: <\session|octave|default> <\output> GNU Octave, version 2.1.45 (i686-pc-linux-gnu). Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 John W. Eaton. This is free software; see the source code for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. \; Report bugs to \bug-octave@bevo.che.wisc.edu\. \; <\input|octave\ > x0=[2;5;10]; <\input|octave\ > t = linspace (0,10,800); <\input|octave\ > function dx = butter (x ,t) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dx(1) = -10.0*(x(1)-x(2)); \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dx(2) = 28.0*x(1)-x(2)-x(1)*x(3); \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ dx(3) = 8.0/3.0*( x(1)*x(2) -x(3) ); \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ end; <\input|octave\ > y=lsode("butter",x0,t); <\input|octave\ > gset parametric; <\input|octave\ > plot(y(:,1),y(:,3)) <\output> \; \; |ps>||||||> \; <\input|octave\ > plot(y(:,2),y(:,3)) <\output> \; \; |ps>||||||> \; <\input|octave\ > plot(y(:,1),y(:,2)) <\output> \; \; |ps>||||||> \; <\input|octave\ > gset set term postscript enhanced color eps; <\input|octave\ > gset out "/home/cchuang/texmacs/butterfly.eps"; <\input|octave\ > gset xtics 10;gset ytics 10; gset ztics 10; <\input|octave\ > gsplot y title "Butterfly Effect" <\input|octave\ > \; At the last part of Octave code, we want to save the 3D trajectory as butterfly.eps. Then we can embed this EPS file: |eps>||||||> Certainly, we can also save the data of and plot with Gnuplot. \ Before the end of this topic, don't forget to save the result, >[Saved as]>. then all the data will be stored in XML-like format. If you want to output the data, press "" or export as postscript file since the postscript format is full supported in any Linux systems and this format is the default output format in Linux box.\ Just as mentioned before, gnuplot is a very professional software for maintaining scientific data. Here, we collect some interesting plots: <\session|gnuplot|default> <\output> This is a TeXmacs interface for GNUplot. \; <\input|GNUplot] > f(x,y)=x**6+3*y**2*x**4+(3*y**4-4*y**2)*x**2+y**6 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set pm3d hidden 100 ~set style line 100 lt 6 ~set nokey \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set xrange[-1:1] ~set yrange[-1:1] ~set isosamples 30,30 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set hidden3d ~set contour ~set cntrparam levels discrete 0.05,0,-0.05,-0.5 \ \ \ ~set size 0.7,1 ~splot -f(x,y) w dots lt 2 <\output> |ps>||||||> \; <\input|GNUplot] > set pm3d at s ~set palette rgb 3,3,3 ~set nocolorbox \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set parametric ~set nokey ~set noztics \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set urange[-5:5] ~set vrange[0:10] ~set yrange[0:10] ~set zrange[0:1] \ \ \ \ \ \ \ ~set isosamples 100,100 ~set view 0,0,1.5,1 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set multiplot ~set size 1,1 ~set origin 0,0 ~set nosurface \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot u, v, (v\ u**2)? 1:0.8 ~set size 1,1 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set origin ~set surface \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot u, u**2, 1 with lines lt 1 lw 3 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~unset multiplot <\output> |ps>||||||> \; <\input|GNUplot] > set pm3d ~set palette rgbform 9,8,9 ~set parametric ~set \ hidden3d \ \ \ ~set urange [0:2*pi] ~set vrange [-pi:pi] ~set isosamples 24,16 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set size 0.8,1 ~set view 60,20,1,1 ~set ticslevel 0 ~x1(u,v)=cos(u)+.5*cos(u)*cos(v) ~y1(u,v)=sin(u)+.5*sin(u)*cos(v) ~z1(u,v)=.5*sin(v) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~x2(u,v)=1+cos(u)+.5*cos(u)*cos(v) ~y2(u,v)=.5*sin(v) ~z2(u,v)=sin(u)+.5*sin(u)*cos(v) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot x1(u,v), y1(u,v), z1(u,v) lt 3, x2(u,v), y2(u,v), z2(u,v) lt 5 \ \ \ \ \ \ \ \ \ \ \ <\output> |ps>||||||> \; <\input|GNUplot] > ~set pm3d at s solid ~set palette rgb -7,-15,-6 ~set nocolorbox \ \ \ \ \ ~set ticslevel 0 ~set nosurface ~set noztics ~set hidden3d \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set isosamples 70,70 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~complex(x,y)=x*{1,0}+y*{0,1} \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~mandel(x,y,z,n) = (abs(z)\2.0 \|\| n\1000)?log(n):mandel(x,y,z*z+complex(x,y),n+1) ~a=-0.37 ~b=-0.612 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set multiplot \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set origin 0,0 ~set size 0.5,0.7 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot [-0.5:0.5][-0.5:0.5] mandel(a,b,complex(x,y),0) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set origin 0.35,-0.15 ~set size 0.7,1.05 ~set view 0,0,,, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot [-0.5:0.5][-0.5:0.5] mandel(a,b,complex(x,y),0) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set nomultiplot <\output> |ps>||||||> \; <\input|GNUplot] > set pm3d \ ~set pal rgb 15,7,5 ~set nocolorbox \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set noxtics ~set noytics~ set noztics ~Order=13 ~Range=2**Order \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~br=0.4616 ~bi=0.4616 ~cr=0.6200 ~ci=-0.197~ \ ~set parametric \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~Fx(x,y,n,c)= c\0? n%2==0 ? Fx(br*x+bi*y, bi*x-br*y, n/2, c-1): Fx(cr*x-ci*y-cr+1, ci*x+cr*y-ci,n/2,c-1) : x \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~Fy(x,y,n,c)= c\0? n%2==0 ? Fy(br*x+bi*y, bi*x-br*y, n/2, c-1): Fy(cr*x-ci*y-cr+1, ci*x+cr*y-ci,n/2,c-1) : y \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set samples 2 ~set isosamples Range,2 ~set urange[1:Range] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set border 0 ~set view 0,0,1.8, \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set label "b=0.4616+0.4616i, c=0.62-0.197i" at 0.1,-0.02 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot Fx(0,0,int(u),Order), Fy(0,0,int(u),Order), int(u)%64 notitle w dots lt pal \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <\input|GNUplot] > \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ |ps>||||||> \; <\output> |ps>||||||> \; <\input|GNUplot] > ~set pm3d at s; ~set pal rgb 9,9,3 ~set nocolorbox \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set parametric ~set hidden3d ~set ticslevel 0 ~set noxtics ~set noytics \ \ \ \ \ \ ~set noztics ~set border 0 ~set nokey ~set isosamples 48,18 ~set size 0.6,1 \ \ ~set view 70,190,1.4,1 ~set urange[0:2*pi] ~set vrange[0:2*pi] \ \ \ \ ~f(u)=1/(1+exp(u-pi)**10) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~r(u)=f(u)*sin(u/2)**4*exp(-2*u)*u**3+0.01 ~x(u,v)=r(u)*cos(v)+0.003*sin(u/2)**4*exp(-2*(pi-u))*(pi-u)**3 ~y(u,v)=r(u)*sin(v) ~z(u)=sin(u) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot x(u,v),y(u,v),z(u) lt 6 <\output> |ps>||||||> \; \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ <\output> |ps>||||||> \; <\input|GNUplot] > ~set pm3d at s solid ~set palette rgb 7,0,0 ~set nocolorbox \ \ \ \ \ \ \ \ \ ~set parametric ~set border 0 ~set hidden3d ~set nokey ~set noxtics \ \ \ \ \ \ \ \ \ \ ~set noytics ~set noztics ~set isosamples 30,18 ~set view ,,1.2,1 \ \ \ \ \ \ \ \ \ \ \ \ ~set ticslevel 0 ~set urange[0:pi] ~set vrange[-pi:pi] \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot sin(u)*cos(v),sin(u)*sin(v),cos(u)+sin(u) lt 6 <\output> |ps>||||||> \; <\input|GNUplot] > ~set pm3d at s solid ~set palette rgb 7,8,3 ~set nocolorbox \ \ \ \ \ \ \ \ \ ~set parametric ~set border 0 ~set hidden3d; set nokey ~set noxtics \ \ \ \ \ \ \ \ \ \ ~set noytics ~set noztics ~set ticslevel 0 ~set isosamples 48,48 \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~set view 70,330,1.5,1 ~set urange[0:pi] ~set vrange[-pi:pi] \ \ \ \ \ \ \ \ \ \ \ \ \ ~r(u,v,a) = abs(sin(u*2)*cos(v*2))**a \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~x(u,v,a) = r(u,v,a)*sin(u)*cos(v) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~y(u,v,a) = r(u,v,a)*sin(u)*sin(v) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~z(u,v,a) = r(u,v,a)*cos(u) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~a=0.7; \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ~splot x(u,v,a),y(u,v,a),z(u,v,a) w lines 6 <\output> |ps>||||||> \; <\input|GNUplot] > \; From user's view, plenty of packages can be used is a good news. But in practical, users are not necessary to learn all the syntaxes of different tools. Just focus on how to solve the problems. For example, there are maxima, octave and Scilab etc. many CAS softwares famous for their facilities to solve mathematical problems. Maxima and Yacas are known due to symbolic computing ability but only supports few basic function, and others are famous for their portable syntaxes (like propriety software, Matlab or Maple) and many, many functions but without symbolic ability. \ With the help of , we can solve right problems by using suitable tools. We will introduce other softwares in the latter chapters. \; Among the tools packages in Linux we introduce in environment here, some experiences have to be kept in mind: <\expand|enumerate-roman> Maxima and Yacas are the powerful softwares for symbolic calculation; Gnuplot and other CAS's can used to plot the graphs in 2D, 3D and scientific data plots. But the Gnuplot is the best recommended software since the graph that it generates can be directly embedded into the worksheet in . Also there are many powerful softwares with numerical abilities in Linux world, for example: Octave, Lab, Scilab and R (check your "session options" or the _INSTALL/lib exec). But Scilab owns its "terminal session" which is not easily embedded into the , Octave is the best choice due to its full accessibility. Output format: Postscript format is the best choice as above mentioned. For the Windows user and not heard about this format, HTML format may be the suitable one. But for mathematical document, it is may be a bad news that directly output the HTML from is generally non-satisfied. If you want to generate HTML files, 2html maybe have some help. Consider to export format from and use the following latex2html command to translate file into HTML and picture files: <\code> \ latex2html -nonavigation -split 0 filename.tex if you want only one HTML file with picture files without navigation icons. Suppose that there are plenty of pictures generated by CAS's in your file, some modifications have to be made by your hand. The reason is that no PS Tricks implement yet in latex2html and this is just the package used by to make in-line Postscript graphs. First capture the pictures by picture capture program, e.g. ksnapshot or GIMP, by CAS's in another xterm and save it as eps format. Then edit the file, removing all lines including "cat code >" in presume part and adding the eps graphs as follows : \ <\verbatim> >document[12pt]{article} >package[dvips]{graphics} \ \ \ > % remove all the line beginning with "catcode" \ \ \ >\ >begin{document} \ \ \ > >begin{center} \ \ >resizebox{150mm}{!}{>includegraphics{picture.eps}} >end{center} \ \ \ > >end{document} Mainly, add the graphics package and use >include graphics{} to put the graph. And use above latex2html commands to translate the contents. The directory named by its filename will be created with HTML file, and png files. Hope this mini introduction help everybody. Any question or comment email: <\strong> Resources: <\expand|enumerate-numeric> : There is a excellent on-line document in . Maxima: After installing maxima, with text-based interface and Maxima with graphical user interface will be installed. And the full documents and demo's will be put in the directory, /usr/local/share/maxima/. Gnuplot: No document has been installed after installing this package. Reference the official web-site: for more relative topics and also visit the graph gallary: Octave: download site at 2html: download site at <\note> \ Solutions for the exercises: <\session|gnuplot|default> <\output> This is a TeXmacs interface for GNUplot. \; <\input|GNUplot] > plot x**2+3*x-2 <\output> |ps>||||||> \; <\input|GNUplot] > plot (x**2+1)/(x**4+x**2+1) <\output> |ps>||||||> \; <\input|GNUplot] > plot sqrt(x**2+1) <\output> |ps>||||||> \; <\input|GNUplot] > set xrange[-5:5] ~set yrange[-5:5] ~set grid ~set xtics 1 ~set ytics 1 ~plot (sin(x*pi/2)-1)/(x**2-1) <\output> |ps>||||||> \; <\input|GNUplot] > set xrange[-5:5] \ ~set yrange[-100:100] ~set noclip ~plot x**3+3/x**2 <\output> |ps>||||||> \; <\input|GNUplot] > \ plot (x+1)**(1./3.) <\output> |ps>||||||> \; <\input|GNUplot] > \; Note that gnuplot is sensible for the type of number, integer or real number. If the square is written as , quotient of integers, instead of the original , quotient of real numbers, an error will occur due to the rational power. Turn to the Maxima session: <\session|maxima|default> <\output> GCL (GNU Common Lisp) \ Version(2.4.4) g@ \ 2 17 15:25:31 CST 2003 Licensed under GNU Library General Public License Contains Enhancements by W. Schelter Maxima 5.9.0 http://maxima.sourceforge.net Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. This is a development version of Maxima. The function bug_report() provides bug reporting information. \; <\input|<\with|color|red> (C1) > plot2d((1+x)^(1/3),[x,-5,4]); <\output> <\with|mode|math> >0> \; <\input|<\with|color|red> (C2) > \; The result is: DK.X{ݰ%vrgN/ckC_ҖaݩN\\*KRfT,bX*oo BP,\\+ _};vl'9ɝ_ 3.lOg\<ڂ17}caqcx{H\\5^+\n aUC_ҖT*T*ߥxϞRT*G?0Z^*GDR,V˅kbF[6?߻/MΝ=v'~x{ؽ{hpwnV}T-E,?DDx=tsgc\|{wo_ɱsgW\>~xoaݑ=C\>๳jMfEDeO;}dupy0XrR\0xtϞ=+73gXXYa698W5.\n,UcOD}+bthD߷~aXl\|~F6jN\|i::󳫅B1vE}#\<}8vşfv^\\,Ews݃\>WG&NWnލϝO\>OűmM녉oE#1\>qp\ԟ+/E.rR#~s^Cͭ춴\|COL?\|p\\f+_zjD4\<זϞ]}0 EľĻ\\nS?_8{\<"\>B9##y驏;3 ׊O}p}^&lG]vCb)\\JMK#dy\\?Xof,mz+s}\\Rs9".\nܸ\>#xkMurZt6{ѾzsG?zǦM\<:9TD\up}/ǟ:6Ŋ{rxD/4^}቙Ǧ\noʙ3MzxݸrH R\<@\>w{rc]qB÷\>t̽YD[ky*߉GDRܵ`chuhFx?0q`3czwH7yUM2P]fZ^NrժF\\Z\\fla\|_Kب8NX~x=77W^L?4'_]pg7\\ٓ;_.ݹRerq ׋~;cv./U7KQ^Ba vWgO\|V?p\<_Y\\s \n TzKӥo}gd,"µByT""s/ǎ,]:iy28W\n\|DL?\kS~ڪooYΔJ7z7?s&"Jn`G;b)"C\\a}\| \n7gbrC#dSCXxKfqq47\nڧ4׍&n/D~fPt,}hK#bczwxڬeswn jVrDJ&,oDā.b JKܮyvuP\< EDfyX~da:IAKˣ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0IENDB`>|png>|*5/8|*5/8||||> <\session|gnuplot|default> <\output> This is a TeXmacs interface for GNUplot. \; <\input|GNUplot] > set key left ~set xrange[-5:5] ~f(x)=x\-1?(x+1)**2:x+1 ~plot f(x) <\output> |ps>||||||> \; <\input|GNUplot] > \; <\initial> <\collection> <\references> <\collection> > > > > > > > > > > > > <\auxiliary> <\collection> <\associate|toc> |math font series||font size||Preliminary> |math font series||1Ahead navigation with T|E>||||0.5fn|>|0fn|-0.1fn>>XACS||||0.5fn|>|0fn|-0.1fn>>> 1.1Presume setup 1.2Content Cooking |math font series||2CAS's and Graph softwares> |math font series||3Functions> |math font series||4Graph Gallery> |math font series||5 Conclusions>