Re: [Q] Programming & "Not Floating Point Number" Error
- To: mathgroup at smc.vnet.net
- Subject: [mg3152] Re: [mg3133] [Q] Programming & "Not Floating Point Number" Error
- From: Phil Moore <moorep at MARSHALL.EDU>
- Date: Fri, 9 Feb 1996 03:00:31 -0500
- Sender: owner-wri-mathgroup at wolfram.com
On Tue, 6 Feb 1996, Noel T. Doromal wrote: > Hello out there! This is my first time on this group, so I apologize for > breaking any netiquette rules. > > I have a Mma question that I hope someone out there can help me with. I > recently started using Mma for a class and have had a hard time > "programming" with it. Here is the script/program that i wrote: > > -- > epsilon = .01 > gamma = 7 > dt = .125 > stim = 0 > > y0 = -.5 > w0 = 0.0 > > For[i=0, i<50, i++, > f = y0 * (1 - y0 *y0); > v = y0 + (f - w0) * dt; > w = w0 +(epsilon*(gamma*y0 - w0)) * dt; > vee[i] = v; > doubleu[i] = w; > y0 = v; > w0 = w; > ] > > ListPlot[{vee,doubleu}] > --- I think you need to transpose the first and second layers. I've never done this before, but I believe that ListPlot[Transpose{vee,doubleu}] will work. > > First question: Are there examples of Mma programs out there that are > longer than a line or two? (Or was mathematica not really made for > programming?) I bought the book and can't find any in there. (It > describes the control structures: do, if, for... but then gives one line > examples only) > > Second: In the script above I'm essentially calculating a bunch of points > that I want to plot (V vs. W - I had to use "vee" and "doubleu" to get it > to work). The only way I could figure to do it was to store the numbers > in a list and then use ListPlot[] but I can't get it right. I keep > getting: > > -- > Graphics::gptn: > Coordinate vee in {1, vee} is not a floating-point number. > Graphics::gptn: > Coordinate doubleu in {2, doubleu} is not a floating-point number. > -- > > What am I doing wrong? > > Thanks for the help, > > Noel > > ==== [MESSAGE SEPARATOR] ====