PK ePBH mimetypetext/x-wxmathmlPK eP$h
format.txt
This file contains a wxMaxima session.
.wxmx files are .xml-based files contained in a .zip container like .odt
or .docx files. After changing their name to end in .zip the .xml and
other files inside them can can be extracted using any .zip file viewer.
The reason why part of a .wxmx file still might seem to make sense in a
ordinary text viewer is that the text portion of .wxmx by default
isn't compressed: This way if only one line of the text changes this won't
(with a high probability) change the value of half of the bytes of the
.zip archive making the .wxmx file more version-control-friendly.
wxMaxima can be downloaded from https://github.com/andrejv/wxmaxima.
PK eP
Hm+ + content.xml
Tutorial: Two-Dimensional Plotting with wxplot2dwxMaxima generates in-line graphs in two dimensions and in three dimensions. This tutorial shows how to draw two-dimensional graphs using wxMaxima. It also shows some ways to make graphs more informative that those produced by wxMaxima's default settings. The tutorial begins with the graph of x*sin(x), with x ranging from -5 to 5, wxMaxima's default values.Plotting a Single VariableThe plot below is generated by selecting Plot/Plot 2d from the menu or by clicking on the Plot2D button at the bottom of the screen. Alternatively, the command can be entered directlyinto the cell. To execute any command below, use "Ctrl-Enter" or "Shift-Enter".wxplot2d([x*sin(x)], [x,-5,5])$Note: At any time, a graph may be saved to a file. Click on the image to be saved.Then select the menu item Edit/Selection to image and save the graph. We now add labels to the horizontal and vertical axes. Notice wxMaxima's use oflists. Each new set of instructions consists of a list of items. wxplot2d([x*sin(x)], [x,-5,5], [xlabel, "x(m)"], [ylabel, "Displacement (m)"])$Controlling Proportions and Showing Two FunctionsFor some purposes, one might want to control the y axis as well as the x axis.Consider the following function, which draws a circle using two explicit functions.The figure below raises two issues regarding the presentation of the functions, the questionof scale and the definition of a legend to identify individual functions.wxplot2d([sqrt(4-x^2),-sqrt(4-x^2)], [x,-2.5,2.5],[y,-2.5,2.5])$ (Graphics);Two aspects of this graph warrant concern. Most obviously, the "circle" looksdecidedly non-spherical. Second, a legend has appeared, one that we mightwant to make more informative. A legend appears automatically whenever more than one function is being plotted. The first problem relates to the fact that Maxima does not assume that x and yaxis have the same units, and it stretches the figure so that the a centimeter alongthe vertical axis accounts for more units that a centimeter does along the horizontal axis.To avoid this distortion, instruct wxplot2d to produce a square graph by insertingthe "same_xy" option. To add content to the legend, add a legend option.wxplot2d( [sqrt(4-x^2),-sqrt(4-x^2)], [x,-2.5,2.5],[y,-2.5,2.5],[legend, "UpperSemiCircle", "LowerSemiCircle"], same_xy)$Suppose we want a cleaner display. We could suppress the legend, as below. Also, we see later in the tutorial that it would be possible to make both halves of the circle the same color. Furthermore,we can remove the box around the circle and the information about units, as well as the axis labels. wxplot2d([sqrt(4-x^2),-sqrt(4-x^2)], [x,-2.5,2.5],[y,-2.5,2.5],[legend, false], [box,false], [xlabel, ""], [ylabel, ""],same_xy)$Further Issues in Presenting FunctionsReturn to the example with which this tutorial began, and add one more function. At the same time, make one more change by defining the functions before specifyingthe wxplot2d command. Now, enter the functions' names into the list of functions (which had previously contained a single entry, the function now designated as f(x).A warning: If you use this approach, save this session as a batch (wxm) file, and executeit later, you must execute the input below before executing any other commands thatrefer to f(x) or g(x).f(x) := x*sin(x)$g(x) := cos(x)$wxplot2d([f(x),g(x)], [x,-5,5], [xlabel, "x(m)"], [ylabel, "Displacement (m)"] )$Next, change the label entries to "Plot 1" and "Plot 2" and change the line styles.Leave Plot 1 (x*sin(x)) as it was, narrow and blue. Plot 2 (cos(x)) becomes wider (width = 3) and the color changes to orange (color code = 4). The Maxima Manual provides the codes.wxplot2d([f(x),g(x)], [x,-5,5], [xlabel, "x(m)"], [ylabel, "Displacement (m) "], [legend, "Plot 1", "Plot 2"], [style,[lines,1,1],[lines,3,4]]);One final set of changes adds some useful details to this graph. Adding these details involves inserting a "gnuplot_preamble" which is a list of options notavailable directly in the wxplot2d command. The following options are used: The key (legend) moves to the bottom center. It could be set at bottom left, bottom right, left center, right center, and so forth. A title is added to the figure.Note the syntax. All options are part of a list, with gnuplot_preamble as the first item in the list. All options are between double quotation marks. Eachitem ends with a semicolon. Text entries are within single quotation marks.wxplot2d([f(x),g(x)], [x,-5,5], [xlabel, "x(m)"], [ylabel, "Displacement (m)"], [legend, "Plot 1", "Plot 2"], [style,[lines,1,1],[lines,3,4]],[gnuplot_preamble, " set grid; set key bottom center; set title 'Two Series, An Example'; "] );A final use of the preamble is to set the y axis to logarithmic scale. Considera simple growth function: y(t) = exp(g*t), were t is a time unit. The two graphsbelow show two functions, fast growth, with g = 5% per year, and slow growth,with g = 2% per year.wxplot2d([exp(0.05*t),exp(0.025*t)], [t,0,150],[ylabel, "Population"],[xlabel, "Year t"], [legend, "Fast growth", "Slow growth"], [gnuplot_preamble, " set grid; set key top left; set title 'Two Growth Paths'; "] )$Converting the vertical axis to the logarithmic scale accomplishes two tasks."Slow growth" is not dwarfed by "Fast growth" and the constancy of the rates of growth is emphasized.The conversion to logs requires adding set logscale y; to the gnuplot_preamble. wxplot2d([exp(0.05*t),exp(0.025*t)], [t,0,150],[ylabel, "Population"],[xlabel, "Year t"], [legend, "Fast growth", "Slow growth"], [gnuplot_preamble, " set grid; set key top left; set title 'Growth Paths, Logarithmic Scale'; set logscale y; "] )$PK eP
L;= ;=
image1.pngPNG
IHDR X W bKGD IDATxy\
\5Jq\qť\pKbf?iV
B
rI4Q89;ϙB;|<|g晱Q@DD$EHDD"$""CcXDDdh,B""24!EHDDf"mҤsŊLQC+Wvxe˖͝;W:!099GCupppwwEDD`gI#F3ZH4""RUb"LKK߿nt$𭸇o=|+wCa^^^7o~l7nܽ{pqH/>ͥ[w9SHRJ=J$𭸇o=|+wC̡v\裏&O|mWI=[qߊ{VO2S~aۂPmߊ{V÷~|7̧vkNkO^: .^ӸppqA*xG W \ %K|yT2|HL&lقGt423pu=T4k?? 77BVX!BFFñavkx%8wh ]b@)#T?WQz:,0x0ڵ/" ė_btk P? A@ l@SST3?yЦM/[xM88X&"ٿ([ûK0q"bch2AX>Azs$5BFs(RAAس11BR"OBBtkDp0t; <J{4GNNebf,]j
ĊĈP6.&F!,z-cGW_dɂk{XuXcTע#h1*uP/,%+cX4h w''lڄo{ڸt ;cLx{@,]$&
I]ͩ>ӭ+!!X;vH.7j+#w6ڴA7|Y~Fjל~={7^|Q8Νx'l
kۻvEÆfIjל~t놆
9 ϱg#l4#*
IGΝCEQԧsq$&LѪV"Rԇc.Z@
<#GSAP55zpjĒ%2B}P61#'&O`H,(y9Us<٧qtvkNkd