Message Boards Message Boards

0
|
8061 Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Mathematica doesn't simplify an expression where n is a positive integer

Posted 9 years ago

Could someone help me to understand why Mathematica seems not see that (sin(nPi)=0) ?

 In[2]:= Integrate[t Sin[ 2 n t], {t, 0, \[Pi]},  Assumptions -> Element[n, Integers] && n > 0]

Out[2]= (-2 n \[Pi] Cos[2 n \[Pi]] + Sin[2 n \[Pi]])/(4 n^2)

Mathematica should "see" that Sin[n Pi] with n natural is always null, and thus give right the answer -Pi/(2*n) (n = 1..infinite)

What happens, what did I do wrong?

Thx to you.

bilik.miloslav@wanadoo.fr

POSTED BY: bilik.miloslav
4 Replies

Check this MSE thread. Also this one.

Also maybe these:

1

2

3

POSTED BY: Daniel Lichtblau
Posted 9 years ago

Hi, try Assuming[m [Element] Integers && m > 0, Integrate[t Sin[2 m t], {t, 0, Pi}]] It also works with $n$, but I usually try to avoid $n$ because there is a function $N$ and sometimes that can be confusing. Cheers, Marco

It's magic and you're great, many thx

Milos.

PS : I read your post with Outlook and thus, n apparates as dollar-n-dollar. Sorry, but I'm still curious abour the perhaps dysfunction of (Elements->..) ?

POSTED BY: bilik.miloslav

Hi Milos,

it's not really magic -just syntax.

PS : I read your post with Outlook and thus, n apparates as dollar-n-dollar. Sorry, but I'm still curious abour the perhaps dysfunction of (Elements->..) ?

I don't use Outlook, but the $n$ comes from the markdown syntax that the community uses. It's a bit like Latex and I instinctively use it for formatting text. If you read the post in a browser it will not show up. Regarding the Element function I think it works just fine.

This function shows you what is going on in my line of code:

Assuming[m \[Element] Integers && m > 0, Integrate[t Sin[2 m t], {t, 0, Pi}]] // HoldForm // TreeForm

enter image description here

This here is what your code does:

enter image description here

That should help you to understand what is going on.

Cheers,

Marco

POSTED BY: Marco Thiel

Hi,

try

Assuming[m \[Element] Integers && m > 0, Integrate[t Sin[2 m t], {t, 0, Pi}]]

It also works with $n$, but I usually try to avoid $n$ because there is a function $N$ and sometimes that can be confusing.

Alternatively, you can first integrate and then simplify using assumptions:

FullSimplify[Integrate[t Sin[2 n t], {t, 0, Pi}], Assumptions -> n \[Element] Integers && n > 0]

Cheers,

Marco

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

Group Abstract Group Abstract