Re: Storing Data into Excel - Pls Help ...
- To: mathgroup at smc.vnet.net
- Subject: [mg31447] Re: Storing Data into Excel - Pls Help ...
- From: Erk Jensen <Erk.Jensen at cern.ch>
- Date: Wed, 7 Nov 2001 05:29:06 -0500 (EST)
- References: <9s5jvq$76g$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Steve wrote:
>
> Hi there,
>
> I am looking for a way to automate Mathematica to extract & store all
> the Real numbers (Imaginary nos. can be ignored) solved from a simple
> simultaneous equations such as the one below.
>
> Where I can use Excel & easily plot all the data later. There will be
> an iteration using the For loop where step will be increase by 1 on
> each iteration.
>
> So the Excel data should contain the step & the real answers assigned
> to it & repeated for each new step no.
>
> -------------
> step=3;
> Solve[{x==3*x^3 + 6*x + step, y==8*y^2 + 3*x}, {x,y}]
>
> -------------
> Mathematica Format:
>
> step=3;
>
> \!\(Solve[{x == 3 x\^3 + 6 x + step, \ y == 8 y\^2 + 3 x}, {x,
> y}]\)
>
> ---------------
>
> Does anyone knows how to do it?
> Many Thanks in advance....
>
> Cheers ....
> Steve
Dunno whether this is the format you want, but for the idea ...
solutions = Re[{x, y} /. Solve[simultaneousequations, {x, y}] // N]
datafile = "test.txt"
OpenWrite[datafile]
WriteString[datafile, step]; WriteString[datafile, "\n"];
For[i = 1, i <= Length[solutions],
For[j = 1, j < 3,
WriteString[datafile,solutions[[i]][[j]], " "]; j++];
WriteString[datafile, "\n"]; i++]
Close[datafile]
This is ASCII - should be easy to import to Excel ...
Ciao
-erk-