I needed a list of coordinates urgently, and I needed it in a text file (I am using LaTeX a lot lately). Gnuplot does the job properly, if told to do so:
$ gnuplot
gnuplot> set terminal table
gnuplot> set output "hyperbola"
gnuplot> set parametric
gnuplot> plot [t=-1.5:1.5] cosh(t),sinh(t)
gnuplot> quit
$ cat hiberbola |awk '/[0-9]/{print "(",$1,",",$2,")"}' > hyperbola.txt
The above saves in “hyperbola” a list of coordinates: each line contains a pair x y i (x coordinate, y coordinate, type of coordinate). The awk line turns it into a list of parenthesized coordinate pairs.
The lines above saved me a lot of troubles yesterday.
using python:
javi@qualos:~$ python -c 'from math import cosh,sinh; print "\n".join([str((sinh(x/10.0),cosh(x/10.0))) for x in range(-15,15)])'
(-2.1292794550948173, 2.3524096152432472)
(-1.9043015014515339, 2.1508984653931402)
(-1.698382437292616, 1.9709142303266285)
(-1.5094613554121725, 1.8106555673243747)
(-1.3356474701241769, 1.6685185538222564)
(-1.1752011936438014, 1.5430806348152437)
(-1.0265167257081753, 1.4330863854487743)
(-0.88810598218762304, 1.3374349463048447)
(-0.7585837018395335, 1.255169005630943)
(-0.63665358214824119, 1.1854652182422676)
(-0.52109530549374738, 1.1276259652063807)
(-0.41075232580281551, 1.0810723718384547)
(-0.3045202934471426, 1.0453385141288605)
(-0.20133600254109399, 1.0200667556190759)
(-0.10016675001984403, 1.0050041680558035)
(0.0, 1.0)
(0.10016675001984403, 1.0050041680558035)
(0.20133600254109399, 1.0200667556190759)
(0.3045202934471426, 1.0453385141288605)
(0.41075232580281551, 1.0810723718384547)
(0.52109530549374738, 1.1276259652063807)
(0.63665358214824119, 1.1854652182422676)
(0.7585837018395335, 1.255169005630943)
(0.88810598218762304, 1.3374349463048447)
(1.0265167257081753, 1.4330863854487743)
(1.1752011936438014, 1.5430806348152437)
(1.3356474701241769, 1.6685185538222564)
(1.5094613554121725, 1.8106555673243747)
(1.698382437292616, 1.9709142303266285)
(1.9043015014515339, 2.1508984653931402)
Right, thanks.
However, the post was intended to show gnuplot in action for getting textual output (I should have said so…).
Pedro.