next up previous contents
Next: Variables Up: Operators and Functions Previous: Exercise 1 (Numbers and

Example: Functions

>> log(sqrt(854))         % natural logarithm
ans = 3.375
>> 0.5*log(854)
ans = 3.375
>> float(sin(pi/2))       % argument in radian
ans = 1
>> gammaln(1234)          % log( gamma( x ) )
ans = 7547
>> primes(1000000000000000001)      
ans = [ 101  9901  999999000001 ]
>> factorial(35)
ans = 1.0333E40
>> factorial(rat(35))     % to make it exact.
ans = 10333147966386144929666651337523200000000
0



Helmut Dersch
2009-03-15