Solutions

In[1]:=

(*1*)DataA = {{1., 4.}, {3., 2.8}, {4, 2.5}, {5., 3.2}, {6., 3.9}, {10., 5.}}

Out[1]=

{{1., 4.}, {3., 2.8}, {4, 2.5}, {5., 3.2}, {6., 3.9}, {10., 5.}}

In[2]:=

(*2*)DataB = Table[{x, x^2 + 10x + 1}, {x, 0, 5, 1}]

General :: spell1 : Possible spelling error: new symbol name \"DataB\" is similar to existing symbol \"DataA\".  More…

Out[2]=

{{0, 1}, {1, 12}, {2, 25}, {3, 40}, {4, 57}, {5, 76}}

In[5]:=

(*3*)DataC = ReadList["c://documents and settings//yliopisto//desktop//data.txt", {Number, Number}]

Out[5]=

{{1, 2}, {2, 4}, {3, 7}, {4, 7}, {5, 9}, {6, 10}, {7, 9}, {8, 11}, {9, 10}, {10, 12}}

Note that ListPlot doesn't support the plotting of multiple sets of data points at once. Plotting one data set is done simply by ListPlot[data]. One way to plot them in one picture is to use the DisplayFunction option, which when given the value Identity suppresses the display of the resulting graphics object. The default value is $DisplayFunction, which has to be given as an option to the function Show to later display the graphics objects. Of course, plotting three data sets at once requires to distinguish them from oneanother, by color for example. (* added 100407: Another way to do it is by using the function MultipleListPlot from the add-on package Graphics`MultipleListPlot`.

In[6]:=

(*4*)ListPlot[DataA, PlotStyle {PointSize[0.01], Hue[0.]}, DisplayFunction&# ... splayFunctionIdentity] Show[%, %%, %%%, DisplayFunction$DisplayFunction]

Out[6]=

⁃Graphics⁃

Out[7]=

⁃Graphics⁃

Out[8]=

⁃Graphics⁃

[Graphics:../HTMLFiles/ex03_solutions_20.gif]

Out[9]=

⁃Graphics⁃

In[10]:=

(*5*)DataA = Prepend[DataA, {0., 6.}]

Out[10]=

{{0., 6.}, {1., 4.}, {3., 2.8}, {4, 2.5}, {5., 3.2}, {6., 3.9}, {10., 5.}}

In[11]:=

(*6*)DataB = Append[DataB, {6., 0.}]

Out[11]=

{{0, 1}, {1, 12}, {2, 25}, {3, 40}, {4, 57}, {5, 76}, {6., 0.}}

The function Insert[data,element,i] inserts element to be the ith element of the new list.

In[12]:=

DataA = Insert[DataA, {2., 3.4}, 3]

Out[12]=

{{0., 6.}, {1., 4.}, {2., 3.4}, {3., 2.8}, {4, 2.5}, {5., 3.2}, {6., 3.9}, {10., 5.}}


Created by Mathematica  (April 10, 2007) Valid XHTML 1.1!