Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

CSCI 1303 Mathematics for Computing I : Semester 1, 2023/2024

Assignment – Programming
Total Marks : 30

Instruction
1. This is a group assignment of MAXIMUM 3 students
2. The registration of group can be done through iTa’leem
3. Only ONE submission is required for each group
4. Submission is done through iTa’leem

Assignment Objectives
1. To demonstrate knowledge of discrete mathematics
2. To enhance programming skills
3. To improve collaboration skills through teamwork
Question (30 marks)

Write a user-friendly well-documented Java program, which solves a recurrence relation and
outputs the properties of the sequence. First, consider the linear recurrence relation of
degree 1: 𝑎𝑛 = 𝑐𝑎𝑛−1, where 𝑛 ≥ 1 and 𝑐, 𝑎0 ∈ ℝ. The initial value 𝑎0 and coefficient 𝑐 are
given by the user input. For each run, the program writes the sequence into a file, so that the
user can plot it and check if the output is valid. Then, apply your program to the recurrence
relation of degree 2: 𝑎𝑛 = 𝑐1 𝑎𝑛−1 + 𝑐2 𝑎𝑛−2 for 𝑛 ≥ 2. What kind of properties are involved
in the degree 1 and degree 2 recurrence relations? Explore it through programming, describe
the process of how you examined, and show typical test cases with plotting.

Examples of Test Cases

Input Output Plot

Enter a0: 0.5 Increasing: yes


5000
Enter c: 1.2 Decreasing: no
Constant: no 4000

Up-down: no 3000

Diverging: yes 2000


Converging: no 1000

0
0 10 20 30 40 50

Enter a0: 0.6 Increasing: yes


6000
Enter c: -1.2 Decreasing: no
4000
Constant: no
2000
Up-down: yes
0
Diverging: yes
-2000
Converging: no
-4000

-6000
0 10 20 30 40 50

You might also like