Power Series From Function Calculator
Choose a function, how many series terms to use, and a value of x, to see each term, the partial sum, the true value and the error.
A power series is one of the most beautiful ideas in mathematics: smooth functions like e^x, sin x and ln(1+x) can be rebuilt entirely out of simple powers of x, added term after term. This power series from function calculator makes that idea concrete and numerical. Choose a function, choose how many terms to include, and give a value of x. It lists every term, adds them into a partial sum, compares it with the function's true value, and reports the absolute error, so you can watch the approximation close in on the truth.
That error figure is the heart of the page. Anyone can recite a series; understanding how fast it converges, and how the value of x changes everything, is what makes the tool useful for study, for checking hand calculations, and for seeing why computers can evaluate these functions at all. A companion post in this series approaches series from the building direction; this one emphasises evaluating at a chosen x and measuring the error, with fully worked examples below.
What This Calculator Does
For each of the five functions it knows the Maclaurin series, the power series centred at zero. For e^x the terms are x^k / k!. For sin x they are the odd powers with alternating signs, (-1)^i x^(2i+1) / (2i+1)!. For cos x they are the even powers, (-1)^i x^(2i) / (2i)!. For 1/(1-x) the terms are simply x^k, and for ln(1+x) they are (-1)^(k+1) x^k / k. You choose how many terms count: for sin and cos that means that many non-zero terms, for the others the first terms of the sequence.
The calculator then evaluates each term at your x, prints the terms in a list so the pattern and the shrinking sizes are visible, sums them into the partial sum, computes the true value with full precision, and subtracts to give the absolute error. It also guards the domains honestly: the series for 1/(1-x) only converges when x lies between -1 and 1, and the ln(1+x) series needs x above -1 and at most 1, so out-of-range entries produce a clear explanation instead of a meaningless number.
How to Use This Calculator
Pick the function first, then set the number of terms. Start small, with 3 to 5 terms, so you can follow every number, then raise the count and watch the error fall. Enter x last, keeping its size modest at first: values near zero converge startlingly fast, while values near the edge of a function's range crawl. For 1/(1-x) and ln(1+x), respect the ranges the error messages describe; outside them the partial sums do not settle toward the function at all, however many terms you add.
Read the results in order: the term list shows the machinery, the partial sum is the approximation, and the error tells you whether to trust it. A useful habit is to predict before calculating: for e^x at x = 1 with 5 terms, decide whether you expect the sum to sit above or below the true value, and by roughly how much. Checking your intuition against the printed error turns a calculator into a teacher surprisingly quickly.
The Series and Why They Converge
Each series is a polynomial that refuses to end: 1 + x + x^2/2! + x^3/3! + ... for e^x, and similar patterns for the rest. The factorials in the denominators of the e^x, sin x and cos x series grow ferociously, faster than any fixed power of x, which is why those three series converge for every x, though they converge slowly when x is large. The 1/(1-x) series has no factorial to save it, so it converges only when each term is smaller than the last in the long run, which needs |x| below 1. The ln(1+x) series has only k in the denominator, so it converges for -1 below x up to 1, and slowly at the x = 1 end.
The partial sum after N terms is the series stopped early, and the absolute error, |true value - partial sum|, measures what the missing infinite tail was worth. Two levers control it: more terms nearly always help within the convergence range, and smaller |x| helps dramatically, because every term carries a power of x. Halving x does far more than doubling the terms in most cases, a fact the worked examples make plain.
Worked Example: e^x at x = 1 With 5 Terms
Choose e^x, 5 terms, x = 1. The terms are x^k / k!: 1^0/0! = 1.000000, 1^1/1! = 1.000000, 1^2/2! = 0.500000, 1^3/3! = 0.166667, and 1^4/4! = 0.041667. Partial sum = 1 + 1 + 0.5 + 0.166667 + 0.041667 = 2.708333. The true value of e^1 is 2.718282. Absolute error = |2.718282 - 2.708333| = 0.009948. Those are exactly the figures the calculator prints, close enough for three decimal places of trust with just five terms.
Notice the terms already shrinking: the fifth term contributes only about 0.04, and the tail beyond it is worth less than 0.01 in total. That is the factorial at work. Add a sixth term, 1/120 = 0.008333, and the sum rises to 2.716667 with the error down to about 0.0016. Predicting each improvement before you press Calculate is the fastest way to develop a feel for convergence that no amount of formula memorising gives you.
A Second Example: 1/(1-x) at x = 0.5 With 5 Terms
Choose 1/(1-x), 5 terms, x = 0.5. The terms are x^k: 1, 0.5, 0.25, 0.125 and 0.0625. Partial sum = 1 + 0.5 + 0.25 + 0.125 + 0.0625 = 1.937500. The true value is 1 / (1 - 0.5) = 2.000000. Absolute error = |2.000000 - 1.937500| = 0.062500. The calculator prints exactly these numbers. The error is bigger than in the e^x example despite equally tidy terms, because there is no factorial shrinking them; each term is only half the previous one, so the missing tail is worth a full 0.0625.
Push x closer to the boundary and the contrast sharpens: at x = 0.9 the terms decay by only a tenth each step and five terms leave a large error, while at x = 0.1 the series is practically exact within a few terms. Same function, same term count, wildly different accuracy, decided entirely by x. That is why this calculator insists on showing the error rather than just the sum: a partial sum without its error is a claim without evidence.
A Third Example: cos x at x = 1 With 4 Terms
Choose cos x, 4 terms, x = 1. The terms are the even powers with alternating signs: 1, then -1^2/2! = -0.500000, then +1^4/4! = +0.041667, then -1^6/6! = -0.001389. Partial sum = 1 - 0.5 + 0.041667 - 0.001389 = 0.540278. The true value of cos(1) is 0.540302. Absolute error = 0.000025. Four terms, five decimal places of accuracy: the factorials in the cos x series make short work of x = 1, and the alternating signs mean successive partial sums bracket the truth from above and below.
That bracketing is a gift when you estimate by hand: with alternating series whose terms shrink steadily, the true value lies between any two consecutive partial sums, so the last term's size bounds the error. None of the other series here bracket so neatly, but all of them share the deeper lesson of these three examples: the approximation is a process with a measurable remainder, not a spell that either works or does not.
How to Read Your Results
Judge a partial sum by its error, never alone. An error of 0.000025, as in the cos example, means the sum is trustworthy to about four decimal places. An error of 0.0625 means two decimal places at best. If you need more accuracy, add terms first; if the error barely moves, your x is probably near the edge of the convergence range and adding terms will always be slow work. Also watch the term list itself: terms that stop shrinking are the visual signature of a series struggling or diverging.
For study purposes, compare functions at the same x and term count. You will find e^x, sin x and cos x racing ahead thanks to their factorials, while 1/(1-x) and ln(1+x) depend entirely on a small |x|. That comparison, run a few times with different inputs, teaches more about why series matter, and where each one can be trusted, than any single calculation.
Where Power Series Are Used
Computers and calculators evaluate functions like e^x and sin x using polynomial approximations descended from these very series, refined and optimised, because hardware is brilliant at multiplying and adding and has no other way to conjure a transcendental value. Physicists use series to simplify equations near a point of interest, replacing a complicated function with its first few terms when x is small. Engineers do the same when modelling vibrations, circuits and heat, because a polynomial is easy to differentiate, integrate and reason about.
Series also explain facts that otherwise look like coincidences, such as why sin x behaves almost exactly like x for tiny angles, which is the first term of its series doing all the visible work, or why 1/(1-x) explodes as x approaches 1, which its terms announce long before the sum is attempted. Learning to read a function's series is learning to see the function's local character written out in powers.
Common Mistakes With Power Series
The most common mistake is using a series outside its convergence range and trusting the partial sum anyway; the calculator refuses those inputs for 1/(1-x) and ln(1+x) for exactly this reason. A second is stopping after a fixed number of terms without checking the error, when the whole point is that accuracy varies with x. A third is miscounting terms, especially for sin x and cos x, where the zero terms are skipped in the count here, a convention the term list makes visible.
A fourth mistake is expecting the partial sum to overshoot and undershoot randomly; for positive x in the e^x and 1/(1-x) series every term is positive, so the sum always approaches from below and the error is simply the missing tail. Finally, rounding terms early corrupts the sum; keep full precision through the addition, as this calculator does, and round only the final figures you report.
Frequently Asked Questions
1. What is a power series?
A power series is a function written as an endless sum of terms in powers of x, such as 1 + x + x^2/2! + x^3/3! + ... for e^x. Stopping the sum after a chosen number of terms gives a polynomial approximation called a partial sum, and this calculator shows those terms, their sum, and the error against the true value.
2. What is a Maclaurin series?
A Maclaurin series is a power series centred at zero, which is what all five functions in this calculator use. The more general Taylor series centres the powers on (x - a) around some other point a. Centreing at zero keeps the terms in plain powers of x, which is why the expansions here look clean and are easy to evaluate.
3. How many terms do I need for a good answer?
It depends on the function and on x. For cos x at x = 1, four terms already give an error of about 0.000025. For 1/(1-x) at x = 0.5, five terms leave an error of 0.0625. The practical method is to add terms until the error shown falls below the accuracy you need; the calculator makes that experiment take seconds.
4. Why does the error shrink faster for small x?
Because every term contains a power of x. When |x| is small, each successive power collapses quickly, so the tail beyond your chosen terms is tiny. When |x| is large or near a convergence boundary, the powers shrink slowly and the missing tail stays valuable for many terms. Halving x usually beats doubling the term count.
5. For which x does the 1/(1-x) series work?
Only for x strictly between -1 and 1. Inside that range the terms x^k shrink toward zero and the partial sums approach 1/(1-x). At x = 1 the terms never shrink and the sum runs away; below -1 they grow in size while alternating. The calculator refuses out-of-range values and explains why, rather than printing a meaningless sum.
6. For which x does the ln(1+x) series work?
For x above -1 and up to and including 1. At x = 1 it converges, but slowly, to ln 2; at x = -1 the function itself is undefined. Inside the range the terms (-1)^(k+1) x^k / k shrink like powers divided by k, which is slower than any factorial series, so expect to need more terms for the same accuracy.
7. What does absolute error mean here?
It is the size of the gap between the true value and the partial sum, ignoring sign: |true value - partial sum|. An absolute error of 0.009948, as in the e^x example with five terms at x = 1, means the approximation is accurate to roughly two to three decimal places. It tells you exactly how many digits of the sum deserve your trust.
8. Why do sin x and cos x only use odd or even powers?
Because of their symmetry. Sin is an odd function, so its series contains only odd powers, x, x^3, x^5, with alternating signs. Cos is an even function, so it uses even powers, 1, x^2, x^4, also alternating. In this calculator the term count for sin and cos counts those non-zero terms, and the printed term list shows the pattern directly.
9. Do the partial sums approach from above or below?
For positive x, the e^x and 1/(1-x) partial sums always approach from below, because every term is positive and the sum only ever grows toward the truth. The alternating series, sin x, cos x and ln(1+x), typically bracket the truth, with consecutive partial sums landing on opposite sides, which usefully bounds the error by the size of the last term added.
10. What is the radius of convergence?
It is the distance from the centre within which a power series converges. The e^x, sin x and cos x series have an infinite radius thanks to their factorials; they converge for every x. The 1/(1-x) and ln(1+x) series have radius 1 around zero. Outside the radius, adding terms makes partial sums wander or explode instead of settling.
11. How do real calculators compute sin and e^x?
With polynomial approximations descended from these series, carefully optimised: the input is first reduced to a small range where a modest number of terms gives full precision, then a tuned polynomial is evaluated. The principle is exactly the one this page demonstrates, which is why watching the error fall as terms are added is a genuine glimpse inside the machine.
12. Can I use this for ln x directly?
Not directly, because this series expands ln(1+x), which equals ln of values between 0 and 2 as x runs from -1 to 1. To approximate ln of a number v in that range, set x = v - 1. For larger values, real software first rescales the input into range using known logarithms, then applies the series.
13. Why does the calculator ask for a term count instead of an accuracy?
Because the term count is the honest control: you decide how much of the series to include, and the calculator reports the accuracy that results. Asking for a target accuracy and silently choosing terms would hide the relationship this page exists to teach, namely how term count, function and x together determine the error.
14. What happens if I enter a very large x for e^x?
The series for e^x still converges, because the factorials eventually outgrow any power of x, but it converges slowly and the result may be astronomically large. With the 30-term limit here, a large x can leave a big error or overflow. For big inputs, real software uses the identity e^x = (e^(x/2))^2 repeatedly to shrink x before applying the series.
15. Are power series and Taylor series the same thing?
A Taylor series is the general form, expanded around any centre point a using the function's derivatives there; a power series is the resulting expression in powers of (x - a). When a is zero it is called a Maclaurin series. All the expansions in this calculator are Maclaurin series, the standard first examples taught in calculus courses.
Final Thoughts
A power series turns a mysterious function into patient arithmetic: terms you can list, a sum you can build, and an error you can measure. Choose a function, add terms, and watch the approximation earn your trust decimal place by decimal place. Once you have seen e^x assembled from nothing but powers and factorials, you will never look at a calculator's answer the same way again.