Solver Arithmetic Progression (AP) Solver
Algebra
->
Sequences-and-series
-> Solver Arithmetic Progression (AP) Solver
Log On
Algebra: Sequences of numbers, series and how to sum them
Section
Solvers
Solvers
Lessons
Lessons
Answers archive
Answers
Source code of 'Arithmetic Progression (AP) Solver'
This Solver (Arithmetic Progression (AP) Solver)
was created by by
mouk(232)
:
View Source
,
Show
,
Put on YOUR site
About mouk
:
==section input This solver will display the first few terms of an Arithmetic Progression, and the sum of the first n terms. Assuming standard notation so that the terms in the Arithmetic Progression are: a, a+d, a+2d, a+3d , ... Enter the first term a *[input a=1] Enter the common difference d *[input d=1] Enter the number of terms to sum n *[input n=10] ==section solution The first few terms of this AP are: a=*[assign term1=$a]$term1, a+d=*[assign term2=($a)+($d)]$term2, a+2d=*[assign term3=($a)+2($d)]$term3, a+3d=*[assign term4=($a)+3($d)]$term4, ... or, just: $term1, $term2, $term3, $term4, ... The Sum of the first n terms is given by: {{{ S[n]= (n/2)(2a+(n-1)d) }}} So substituting a=$a, d=$d and n=$n gives: {{{ S[$n]= ($n/2)(2($a)+($n-1)$d) = *[assign sum=(($n)/2)(2($a) + (($n)-1)($d))]$sum }}} ==section output term1 term2 term3 term4 sum ==section check a=8 d=-4 n=15 term1=8 term2=4 term3=0 term4=-4 sum=-300