       Re: problems with memory usage

• To: mathgroup at smc.vnet.net
• Subject: [mg63314] Re: problems with memory usage
• Date: Fri, 23 Dec 2005 05:08:37 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```On 12/20/05 at 11:35 PM, marcellesantos at yahoo.com (Marcelle Santos)
wrote:

>I have to fit a model to a long set of data from previous
>calculations. These data are in a file called "ptab.m", which has
>this structure:

>{k1,{{x1,y1},{x2,y2},{x3,y3},...}}
>{k2,{{x1,y1},{x2,y2},{x3,y3},...}}

The primary tool for fitting models to data is FindFit which handles both linear and non-linear models. FindFit wants to see the data list in the form of an nXm matrix. So, I assume what you need to do is transform the data structure into something FindFit accepts, i.e.,

In:=
data = {{k1,{{x1, y1}, {x2, y2}, {x3, y3}}},
{k2, {{x1, y1}, {x2, y2}, {x3, y3}}}};

In:=
Join @@ Transpose /@
(Join[{Table[First[#1], {Length[Last[#1]]}]},
Transpose[Last[#1]]]&)/@ data
Out=
{{k1, x1, y1}, {k1, x2, y2},
{k1, x3, y3}, {k2, x1, y1},
{k2, x2, y2}, {k2, x3, y3}}
--
To reply via email subtract one hundred and four

```

• Prev by Date: Re: problems with memory usage
• Next by Date: Extracting information from lists
• Previous by thread: Re: Re: problems with memory usage
• Next by thread: Convincing Mathematica that Sqrt[a+b]Sqrt[a-b]==Sqrt[a^2+b^2]