I was *window shopping* at Community Contribution of Arch Linux Fourms for totally free new application, tried to see if I can find new toy. I saw this HC, after I read and saw some examples the author posted, I decided to give it a try.

### 1 Happy Valentines Day!

Too early? or too late?

r(t)=2-2sin(t)+sin(t)*sqrt(abs(cos(t)))/(sin(t)+1.4) graphpeq(r(t)*cos(t),r(t)*sin(t),0,2pi,-3,3,-4,1)

### 2 No recursion? You cant stop me!

If you try to define a recursion function, you will get:

fib(n)=if(n>=0, if(n==0,0, if(n==1,1, fib(n-1)+fib(n-2) ) ) ) Error : recursive definition.

Lets trick HC!

fibr(n)=fib(n) fib(n)=if(n>=0, if(n==0,0, if(n==1,1, fibr(n-1)+fibr(n-2) ) ) )

Some outputs:

> fib(10)==fibo(10) 1 > fib(70) Error : too much recursion/nestedness. If you know what you are doing, you can bypass this with: \bpn. Argument Error : if() : at least two arguments are needed (condition, true_branch, false_branch) > \bpn By pass is now on. > fib(70)

You will have to wait until only God knows how long it takes

Note

Now, HC is allowed to define recursion function:

fib(n) = if(n<2,n,fib(n-1)+fib(n-2))

, read more. (2010-08-24)

### 3 FFT! The FFT!?

Yes, the Fast Fourier transform!

fft(x)=for(k=0,k<length(x),k+=1, xk=0; for(j=0,j<length(x),j+=1, a=x[j]; b=exp(-2pi*k*j*0i1/length(x)); xk+=a*b; ); print(xk); )

Example:

> x = [1,0,3i-3,4i5,5] > fft(x) 13i2 -7.8203160070896799i3.7250338450183462 6.7264861191111235i2.6059037339171068 -8.4904181416113337i-1.3698357564173172 1.5842480295898901i-6.9611018225181358

Confirmed by result from SciPy:

>>> import scipy >>> scipy.fft([1,0,3-3j,4+5j,5]) array([ 13.00000000+2.j , -7.82031601+3.72503385j, 6.72648612+2.60590373j, -8.49041814-1.36983576j, 1.58424803-6.96110182j])</pre>

Note: the representations of complex number are different.

Note

Here is a shorter version:

fft(x)=for(k=0,k<length(x),k+=1, for(j=0,j<length(x),j+=1, a=x[j]; b=exp(-2pi*k*j*0i1/length(x)); xk=if(j==0,a*b,xk+a*b); ); y=if(k==0,[xk],join(y,[xk])); )

(2010-08-24)

The result can be retrieved by `y`.

### 4 Conclusion

This is a great CLI program, I am going to replace SpeedCrunch. You can do some simple programming, though I found its still limited. (What do you expect? Signal processing using a *calculator*?) When I installed SpeedCrunch because I wanted one can allow me to easy input, bc is not so friendly, even I prefer CLI over GUI. Now, HC can do things I need and its a CLI and its resource-friendly. Definitely the top choice for me!

It has vector but its not much you can do with it at this moment, but if you just use it for 1+1, it can do much more than that. If you dont like CLI, dont worry, it provides GUI as well. But I didnt try it, so no comments on that.

## 0 comments:

## Post a Comment