3

Maple solves the following problem incorrectly when using ShowSolution function which is in student.calculus1 package. It's works fine when the power of x variable is odd or when I write sin(n*x) but when I wrote x^(even number)cos(nx) it's calculated incorrectly. Or when I put a number instead of n it's calculated correctly. Do I miss something? :| Here is a screenshot:

When assume(n::integer). Maple says the answer is 0 which is also incorrect

1 Answers1

2

It looks like a bug (and I have submitted a bug report), going wrong at the first step.

As workaround, you could do this as a first step,

restart;
with(Student:-Calculus1):

ee := Int( x^2*cos(n*x), x=-Pi..Pi ):

new := rhs( Rule[parts, x^2, sin(n*x)/n]( ee ) ) assuming n::integer;

             -(Int(2*sin(n*x)*x/n, x = -Pi .. Pi))

ShowSolution( new ) assuming n::integer; 

which produces 4*(-1)^n*Pi/n^2 at the final step.

Or do those steps without the assumptions on n, and then simplify the final result under assuming n::integer.

acer
  • 6,671
  • 15
  • 15
  • Yes... It turns out it's bug... I explained it to my prof and finally accepted it (math prof couldn'd accept that Maple had buds)... It's finnished but thank you you might have saved me in other projects. – Afshin Mobayen Khiabani Oct 29 '18 at 16:12