Skip to main content
edited title
Source Link

How to get a generaluniversal answer using Integrate

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1}, 
  Assumptions -> {k ∈ Integers, n ∈ Integers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
  Assumptions -> {n ∈ Integers,k = 2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a generaluniversal result. Isn't Code 1 supposed to give a general result?Isn't Code 1 supposed to give a universal result? if not, how to get one?

How to get a general answer using Integrate

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1}, 
  Assumptions -> {k ∈ Integers, n ∈ Integers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
  Assumptions -> {n ∈ Integers,k = 2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a general result. Isn't Code 1 supposed to give a general result?

How to get a universal answer using Integrate

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1}, 
  Assumptions -> {k ∈ Integers, n ∈ Integers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
  Assumptions -> {n ∈ Integers,k = 2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a universal result. Isn't Code 1 supposed to give a universal result? if not, how to get one?

Post Closed as "Duplicate" by Daniel Lichtblau, Sektor, halirutan, m_goldberg, MarcoB
Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[Sin[k*Pi*x]*Sin[2*n*Pi*x]Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
   
  Assumptions -> {k  Integers, n  Assumptions->{k\[Element]Integers,n\[Element]IntegersIntegers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[Sin[k*Pi*x]*Sin[2*n*Pi*x]Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
    Assumptions -> {n  Integers,k = Assumptions->{n\[Element]Integers,k=2*n2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a general result. Isn't Isn't Code 1 supposed to give a general result?

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[Sin[k*Pi*x]*Sin[2*n*Pi*x],{x,0,1},
           Assumptions->{k\[Element]Integers,n\[Element]Integers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[Sin[k*Pi*x]*Sin[2*n*Pi*x],{x,0,1},
          Assumptions->{n\[Element]Integers,k=2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a general result. Isn't Code 1 supposed to give a general result?

The following two codes give conflicting answers, when integrating $\sin(k\pi x)\sin(2n\pi x)$ from $0$ to $1$, where both $k$ and $n$ are positive integers.

Code 1 assumes that $k$,$n$ are independent integers:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},  
  Assumptions -> {k  Integers, n  Integers}]

The result given by mathematica is 0.

Code 2 assumes that $k=2n$ and $n$ is integer:

Integrate[
  Sin[k*Pi*x]*Sin[2*n*Pi*x], {x, 0, 1},
  Assumptions -> {n  Integers,k = 2*n}]

The result is 1/2.

The result of Code 2 should be included in that of Code 1. It seems that Code 1 doesn't manage to give a general result. Isn't Code 1 supposed to give a general result?

edited title; edited tags
Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

How to get a general answer using Integrate[]Integrate

formula typesetting
Source Link
Thies Heidecke
  • 8.8k
  • 34
  • 45
Loading
added 48 characters in body
Source Link
Loading
Source Link
Loading