Efficient Conversion of Sums to Integrals: Tips and Tricks for Mathematicians

In summary: Ok, here is the notebook. In the notebook, I have the function f and the constant j. I also include the h value for each term. I also include the derivative of f at j. I then do the summation.After I have done the summation, I take the derivative of the summation with respect to h. I then take the limit as h goes from 0 to H. I get:Sum over h:[f(h+0.5dh)]^(-1) - [f(h-0.5dh)]^(-1)where h goes from 0 to H.
  • #1
natski
267
2
Hi guys,

I'm working on a project at the moment where I want to convert a sum to an integral but I am out of ideas. Basically I have something like:

Sum over h: [f(h+0.5dh)]^(-1) - [f(h-0.5dh)]^(-1)

where h goes from 0 to H.

Any tips would be appreciated!
 
Physics news on Phys.org
  • #2
You can't sum that?

;0
 
  • #3
I can sum it, yes. But I want the expression as an integral.
 
  • #4
Ok yes, I tried to change it a bit to make it easier to post it. I have attached the mathematica notebook of the expression since I don't get on with latex. In the expression, I know the function f, which is only a function of one thing. Everything in the expression is a constant except j, which is the integer I am adding over.
 

Attachments

  • expression.nb
    2.9 KB · Views: 472
  • #5
This sounds like an assignment of some kind, why would you want to express the sum as an integral?

The only thing I can think of is working backwards to a contour integral starting from the idea that this is a sum of the residues of some function.
 
  • #6
The motivation for expressing it as an integral is that by using the sum, even by increasing the numbers of terms to say 1E6, the accuracy is still obviously not perfect. But an integration would give perfect precision. As I increase the number of terms in my sum, I am taking thinner and thinner slices and so the limit should be when the slices have thickness dh.

I can do the problem with the sum but it takes a lot of time to do 1E6 operations (around 4 minutes) and I think the integration will be nearly instantaneous.
 
  • #7
Last edited by a moderator:
  • #8
Let's get this into LaTeX.

natski said:
Sum over h: [f(h+0.5dh)]^(-1) - [f(h-0.5dh)]^(-1)

where h goes from 0 to H.

Is this it?

[tex]\sum_{h=0}^H\left(\frac{1}{f(h+0.5dh)}-\frac{1}{f(h-0.5dh)}\right)[/tex]

I want to make sure that the "-1" exponents don't actually refer to inverse functions.
 
Last edited:
  • #9
In the Mathematica notebook this is what he included:

[tex]\sum _{j=1}^N \sin ^{-1}\left(\frac{20
\eta }{\left(\frac{H j}{N}+10\right)
\left(f\left(\frac{H
j}{N}\right)+f\left(\frac{H
(j+1)}{N}\right)\right)}\right)-\sin
^{-1}\left(\frac{20 \eta
}{\left(\frac{H j}{N}+10\right)
\left(f\left(\frac{H
(j-1)}{N}\right)+f\left(\frac{H
j}{N}\right)\right)}\right)
[/tex]

Which is nothing like what has appeared in the forum! By the way natski, look up the function TeXForm in Mathematica.

Natski, four minutes is really slow for doing the sum. Why don't you post for me the notebook where you calculate the sum? I will speed it up to be practical and efficient.
 

1. What is the difference between a sum and an integral?

A sum is the result of adding up a finite number of terms, while an integral is the result of finding the area under a curve. In other words, a sum represents a discrete quantity, while an integral represents a continuous quantity.

2. When do you need to use integrals instead of sums?

Integrals are typically used when dealing with continuous quantities, such as distance, velocity, or acceleration. Sums are used for discrete quantities, such as counting objects or adding a finite number of values.

3. How do you convert a sum to an integral?

To convert a sum to an integral, you can use the limit definition of an integral: as the number of terms in the sum approaches infinity, the sum becomes an integral. You can also use a Riemann sum, which approximates the integral by dividing the area under the curve into smaller rectangles and adding them up.

4. Can all sums be converted to integrals?

No, not all sums can be converted to integrals. Only sums that represent a continuous quantity can be converted to integrals. For example, a sum that counts the number of objects cannot be converted to an integral.

5. What are the benefits of converting sums to integrals?

Converting sums to integrals allows us to solve more complex problems and work with continuous quantities. Integrals also offer a more precise and accurate representation of a quantity compared to sums, which only provide an approximation.

Similar threads

Replies
16
Views
2K
Replies
2
Views
1K
Replies
1
Views
2K
Replies
3
Views
972
Replies
18
Views
2K
Replies
1
Views
938
Replies
6
Views
1K
Replies
2
Views
1K
  • Calculus
Replies
3
Views
1K
Replies
8
Views
1K
Back
Top