Team 9

Sequence & Series Calculator

Build an app that generates and analyzes arithmetic progressions (AP), geometric progressions (GP), calculates nth term, partial sums, and checks convergence of geometric series.

๐ŸŽฏ Learning Goals

  • โ–น Master Arithmetic & Geometric Progression formulas
  • โ–น Understand Convergence conditions for infinite series
  • โ–น Implement Loop structures in MIT App Inventor
  • โ–น Work with dynamic text joining and power functions

๐ŸŒŽ Why This Matters

Sequences and series are used in finance (calculating interest), computer science (algorithms), and physics (wave harmonics). Understanding how they grow helps predict future trends and sum infinite processes.

๐Ÿ“–Understanding Sequences & Series

Theory Masterclass
"

A sequence is an ordered list of numbers following a pattern. A series is the sum of the terms of a sequence. Arithmetic Progression (AP): Each term differs from the previous by a constant called the "common difference" (d). Example: 2, 5, 8, 11, 14... (d = 3) nth term: aโ‚™ = aโ‚ + (n-1)d Sum of n terms: Sโ‚™ = n/2 ร— (2aโ‚ + (n-1)d) = n/2 ร— (first + last) Geometric Progression (GP): Each term is multiplied by a constant called the "common ratio" (r). Example: 3, 6, 12, 24, 48... (r = 2) nth term: aโ‚™ = aโ‚ ร— r^(n-1) Sum of n terms: Sโ‚™ = aโ‚(rโฟ - 1)/(r - 1) when r โ‰  1 Convergence (Infinite GP): If |r| < 1, the infinite GP converges: Sโˆž = aโ‚ / (1 - r) If |r| โ‰ฅ 1, the series diverges (sum goes to infinity). Example: 1 + 1/2 + 1/4 + 1/8 + ... = 2 (aโ‚=1, r=0.5, Sโˆž = 1/(1-0.5) = 2)

Mathematical Foundation

fxAP nth term: aโ‚™ = aโ‚ + (n-1)d
fxAP Sum: Sโ‚™ = n/2 ร— (2aโ‚ + (n-1)d)
fxGP nth term: aโ‚™ = aโ‚ ร— r^(n-1)
fxGP Sum: Sโ‚™ = aโ‚(rโฟ-1)/(r-1)
fxInfinite GP: Sโˆž = aโ‚/(1-r), only if |r| < 1

๐ŸŽจPart A โ€” Designer View (UI Design)

Open MIT App Inventor โ†’ Switch to Designer view. Follow each step below to build the interface.

1

Set up with tabs

Title: "Sequence & Series Calculator" Add HorizontalArrangement with 2 tab buttons: "Arithmetic (AP)" and "Geometric (GP)"

2

Create AP panel

VerticalArrangement named APPanel: - TextBox: "First term (aโ‚)" - TextBox: "Common difference (d)" - TextBox: "Number of terms (n)" - Buttons: "Generate Sequence", "Find nth Term", "Find Sum" - ResultLabel for output

3

Create GP panel

VerticalArrangement named GPPanel (Visible = false): - TextBox: "First term (aโ‚)" - TextBox: "Common ratio (r)" - TextBox: "Number of terms (n)" - Buttons: "Generate Sequence", "Find nth Term", "Find Sum", "Check Convergence", "Infinite Sum" - ResultLabel for output

4

Add sequence display area

A large Label named SequenceLabel for displaying the generated terms. Set font to monospace for clean alignment.

๐ŸงฉPart B โ€” Blocks View (Logic & Calculation)

Switch to Blocks view. Now add the logic that makes your app actually work.

1

Tab switching

When APTab.Click โ†’ Show APPanel, Hide GPPanel, highlight AP tab When GPTab.Click โ†’ Show GPPanel, Hide APPanel, highlight GP tab

2

Generate AP sequence

When APGenerateButton.Click: 1. Read a1, d, n from TextBoxes 2. Initialize: term = a1, sequence = "" 3. Loop from 1 to n: sequence = sequence + term + ", " term = term + d 4. Display sequence in SequenceLabel

3

Find AP nth term

When APNthTermButton.Click: nthTerm = a1 + (n - 1) ร— d Display: "a" + n + " = " + nthTerm

4

Calculate AP Sum

When APSumButton.Click: sum = (n / 2) ร— (2 ร— a1 + (n - 1) ร— d) Display: "S" + n + " = " + sum Alternative formula: sum = (n/2) ร— (a1 + lastTerm) where lastTerm = a1 + (n-1)d

5

Generate GP sequence

When GPGenerateButton.Click: 1. Read a1, r, n 2. Initialize: term = a1, sequence = "" 3. Loop from 1 to n: sequence = sequence + term + ", " term = term ร— r 4. Display sequence

6

Find GP nth term

When GPNthTermButton.Click: nthTerm = a1 ร— power(r, n - 1) Use the "power" block from Math: base = r, exponent = n-1 Display: "a" + n + " = " + nthTerm

7

Calculate GP Sum

When GPSumButton.Click: if r = 1: sum = a1 ร— n else: sum = a1 ร— (power(r, n) - 1) / (r - 1) Display: "S" + n + " = " + sum

8

Check convergence & infinite sum

When ConvergenceButton.Click: if abs(r) < 1: Display: "Series CONVERGES (|r| = " + abs(r) + " < 1)" infiniteSum = a1 / (1 - r) Display: "Sโˆž = " + infiniteSum else: Display: "Series DIVERGES (|r| = " + abs(r) + " โ‰ฅ 1)" Display: "Infinite sum does not exist"

๐ŸงชTesting Your App

  • โœ“AP: aโ‚=2, d=3, n=5 โ†’ Sequence: 2, 5, 8, 11, 14. Sum = 40
  • โœ“GP: aโ‚=3, r=2, n=4 โ†’ Sequence: 3, 6, 12, 24. Sum = 45
  • โœ“GP: aโ‚=1, r=0.5 โ†’ Converges. Sโˆž = 2
  • โœ“GP: aโ‚=1, r=2 โ†’ Diverges. No infinite sum
  • โœ“AP: aโ‚=10, d=-2, n=6 โ†’ 10, 8, 6, 4, 2, 0

๐Ÿš€Bonus Challenges

Extra credit โ€” impress your instructor

  • โ˜…Add Harmonic Series: 1 + 1/2 + 1/3 + ... + 1/n
  • โ˜…Visualize the sequence on a Canvas as a bar chart
  • โ˜…Add 'Find d/r given two terms' reverse calculator
  • โ˜…Support entering a sequence and identifying if it's AP or GP