You are on page 1of 1

Introduction to Computer for Engineer – Homework

Script, Private Function, Anonymous Function

Given the explicit formula of Fibonacci sequence is given as follows


n
n −1
φ −( )
φ
F ( n )=
√5
Where

1+ √5
φ=
2

Question 1 - Create a script to compute the value of Fibonacci function for n=1,2,3,4,5

Question 2 – Create a private function, name “FibonacciFunc” and create a second script to
compute the value of private function for n=1,2,3,4,5.

Question 3 – Create a third script to compute the value of Fibonacci function for n=1,2,3,4,5
using anonymous function.

Question 4 – Create a fourth script to compute the value of Fibonacci function for n=0,1,2..,100
(Student can equivalently use anonymous or private function).

You might also like