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 MasterclassA 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
๐จPart A โ Designer View (UI Design)
Open MIT App Inventor โ Switch to Designer view. Follow each step below to build the interface.
Set up with tabs
Title: "Sequence & Series Calculator" Add HorizontalArrangement with 2 tab buttons: "Arithmetic (AP)" and "Geometric (GP)"
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
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
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.
Tab switching
When APTab.Click โ Show APPanel, Hide GPPanel, highlight AP tab When GPTab.Click โ Show GPPanel, Hide APPanel, highlight GP tab
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
Find AP nth term
When APNthTermButton.Click: nthTerm = a1 + (n - 1) ร d Display: "a" + n + " = " + nthTerm
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
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
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
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
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