Mathematica function writing for data analysis at Gould Academy

*To*: mathgroup at smc.vnet.net*Subject*: [mg35693] Mathematica function writing for data analysis at Gould Academy*From*: dresserc at gouldacademy.org (Charles H. Dresser)*Date*: Fri, 26 Jul 2002 04:16:37 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hello, I work at Gould Academy and have recently taught myself some of the Mathematica scripting language. It has been my job to write functions which will make analyzing data in Mathematica simpler for the students. I have written a number of scripts which find different regressions of data within a file easily. But, a couple of the functions that I have written are not doing exactly what I want them to do. One of them takes the input from a file with multiple columns and what number columns the user wants to be included in the data as ordered pairs and is suppose to output the ordered pairs which was selected. What it does is it doesn't output anything but does set list equal to the data which it should output. This is the code I have written (Sorry If It Is Ugly): f is a filename x is the column which is wanted to be the x value in the order pairs y is the y value which is wanted to be the ordered pairs. MultCol[f_, x_, y_] := Do[For[i = 1; list = {}; length = Length[Import[f, "Table"]], i <= length, i++, list = Append[list, {Part[Part[Import[f, "Table"], i], x], Part[Part[Import[f, "Table"], i], y]}]] MultColCleanUp[], {1}] MultColCleanUp[] := If[DigitQ[StringTake[ToString[First[list]], {2}]], list = list, list = Rest[list]] What MultColCleanUp does is if there is a title in the first part of the data it removes it from the list. I would like the students to be able to simply type MultCol["filename", 1, 3] and have the data in columns 1 and 3 in "filename" be put together and outputted to the screen in the form of a matrix. Also, I have another script I wrote which does relatively the same thing. What this script is a function which will take a part of data from a file. It will take data between in the form of ordered pairs in between the first x value entered and the second value entered. The Code is: FilePart[f_, n_, z_] := For[i = 1; list = {}; length = Length[Import[f, "Table"]], i <= length, i++, If[z >= First[Part[Import[f, "Table"], i]] >= n, list = Append[list, Part[Import[f, "Table"], i]];, If[i >= length, list = list]] ] I would like for the students to be able to simply type FilePart["filename", 3, 5] and get {{3,78}, {4,56}, {5,90}} as output. the Y values are just for example purposes. In both scripts it assigns the value of the data wanted to list, but does not display list to the screen as an output. Thank You Very Much! I have been stuck on these two scripts for quite some time now.

**ToExpression**

**Re: Removing the Context**

**RE: ToExpression**

**Re: Mathematica function writing for data analysis at Gould Academy**