Group Abstract Group Abstract

Message Boards Message Boards

1
|
3.9K Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Sum a series until a certain condition is met?

Anonymous User
Anonymous User
Posted 6 years ago

I'm trying to sum up a Taylor series of a transcendental function, but for each $n$, I need to tweak the number of terms to be summed up manually, on a trial and error basis.

I know that the result is always 0 or 1, so I want Mathematica to stop when the sum gets, say, lesser than $10^{-5}$ or close enough to 1. How do I do that?

Here's the formula I'm working with. This sum yields 1 if $k$ divides $n$, and 0 otherwise. If $n$ is small, summing up 55 terms is good enough, but if $n$ grows large, we may need many more terms. I don't know how many beforehand, so I'd like Mathematica to stop summing up when a certain precision is attained.

Is it possible to easily incorporate that into the below?

M = 55; k = 2; n = 4; 
  N[Sum[(-1)^i*(2*Pi*n)^(2*i)*Sum[BernoulliB[2*j]/(k^(2*j)*((2*j)!*(2*i - 2*j + 1)!)), {j, 0, i}], {i, 0, M}], 10]
POSTED BY: Anonymous User

Perhaps not the most efficient solution, but have you looked at the function While?

POSTED BY: Ian Williams
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard