Discussion:
evaluate assuming odd integers?
(too old to reply)
ab@sd.com
2005-07-25 05:24:31 UTC
Permalink
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
the integral itself??:
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
dh
2005-07-26 08:03:39 UTC
Permalink
Hi,
an assumption of e.g.

Element[(n+1)/2,Integers]

will do the trick,
sincerely, Daniel
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
Andrzej Kozlowski
2005-07-26 08:07:42 UTC
Permalink
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i
tell it
that n is odd integer in the Assumptions section of FullSimplify
command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
All you *actually* need is:



Simplify[Integrate[Sin[(Pi*n*z)/L], {z, 0, L}],
Mod[n, 2] == 1]


(2*L)/(n*Pi)

Andrzej Kozlowski
Bob Hanlon
2005-07-26 08:12:15 UTC
Permalink
Clear[n];

int=Integrate[Sin[n*Pi*(z/L)],{z,0,L}];

Simplify[
Simplify[
int/.n->2*m+1,
Element[m, Integers]]/.
m->(n-1)/2]

(2*L)/(n*Pi)


Bob Hanlon
Date: 2005/07/25 Mon AM 01:12:15 EDT
Subject: evaluate assuming odd integers?
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command
or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
Jean-Marc Gulliet
2005-07-26 08:15:17 UTC
Permalink
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
Replace n by 2*k+1, k being any non-negative integer:

In[1]:=
Integrate[Sin[(2*k + 1)*Pi*(z/L)], {z, 0, L}, Assumptions -> {k ∈
Integers && k >= 0 && L > 0 && z ∈ Reals}]

Out[1]=
(2*L)/(Pi + 2*k*Pi)

Regards,
/J.M.
Pratik Desai
2005-07-26 08:19:05 UTC
Permalink
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
I guess the two simplest approaches that come to mind are


int[n_?OddQ] = Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
int2 = Table[Integrate[Sin[(2*n - 1)*Pi*(z/L)], {z, 0, L}], {n, 1, 5}]

Best regards
Pratik
--
Pratik Desai
Graduate Student
UMBC
Department of Mechanical Engineering
Phone: 410 455 8134
David Park
2005-07-26 08:21:22 UTC
Permalink
Perhaps there is a simpler method, but the following works.

Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
% /. n -> 2*k + 1
Simplify[%, k \[Element] Integers]
Simplify[% /. {k -> (1/2)*(-1 + n)}]

David Park
***@earthlink.net
http://home.earthlink.net/~djmp/



From: ***@sd.com [mailto:***@ads.com]


Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
the integral itself??:
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
Yasvir A. Tesiram
2005-07-26 08:22:53 UTC
Permalink
OddQ[expr]
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
stephen layland
2005-07-26 08:23:38 UTC
Permalink
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
OddQ[]

--
/*------------------------------*\
| stephen layland |
| Documentation Programmer |
| http://members.wri.com/layland |
\*------------------------------*/
Steve Luttrell
2005-07-26 08:30:28 UTC
Permalink
Simplify[Integrate[Sin[(2m+1)*Pi*(z/L)], {z, 0,
L}],Assumptions->m\[Element]Integers]

(2*L)/(Pi + 2*m*Pi)

Steve Luttrell
Post by ***@sd.com
Is there a way in Mathematica to evaluate an expression assuming some
varialbe is Odd integer, for example in below integral how can i tell it
that n is odd integer in the Assumptions section of FullSimplify command or
In[35]:=
Integrate[Sin[n*Pi*(z/L)], {z, 0, L}]
FullSimplify[%, n \[Element] Integers && n >= 0 &&
L \[Element] Reals && L > 0 && z \[Element] Reals]
Continue reading on narkive:
Loading...