Michael Somos on Tue, 24 Sep 2002 09:44:11 -0400 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: How to plot in a dumb terminal ? |
Thomas Baruchel asked about the following : > plot a function, say f(x) with > x ONLY AN INTEGER from 0 to 100 > (because f(x) returns incoherent values if x isn't an integer; > please, don't answer something like plot(x=0,100,f(round(x))) > because f is quite long to compute, and I really don't want > f(6) to be computed twice) > the graphic should be in text/mode Perhaps the following code can be modified to do what is wanted : { ploti(ia,ib,jmin,jmax,twid,f)= local(fi); for(i=ia,ib,fi=eval(Str(f"("i")")); fi=max(jmin,min(jmax,fi)); fi=(twid-1)*(fi-jmin)\(jmax-jmin); for(j=1,fi,print1(" "));print("+"); ); } ? ploti(1,20,0,5,75,"sqrt") + + + + + + + + + + + + + + + + + + + + Shalom, Michael