# one hard integral for Maple: int(exp(cos(x))*cos(x-sin(x)),x=0..2*Pi);

Discussion in 'Maple' started by Nasser M. Abbasi, Dec 6, 2009.

1. ### Nasser M. AbbasiGuest

FYI,

Maple 12

Can do this integral numerically, but not analytically:
f:=exp(cos(x))*cos(x-sin(x));
int(f,x=0..2*Pi);
------> returns unevaluated
f:=exp(cos(x))*cos(x-sin(x));
evalf(Int(f,x=0..2*Pi));

6.283185307

OK.

I do not have Maple13, but was wondering if it can do it in Maple13?
--Nasser

Nasser M. Abbasi, Dec 6, 2009

2. ### Axel VogtGuest

Plotting and playing suggests f:= x -> exp(cos(x))*cos(x-sin(x)) is
periodic and symmetric like cos, actually both f(Pi+x) - f(Pi-x) and
f(2*Pi+x) - f(x) are zero, so the task is 2*Int(f(x), x= 0 .. Pi)

Smells like a Fourier thing ... playing with exp(cos(x)+I*sin(x)) and
differentiating gives

Int(f(x),x=0..Pi); expand(%);

Pi
/
|
| exp(cos(x)) cos(x) cos(sin(x))
|
/
0

+ exp(cos(x)) sin(x) sin(sin(x)) dx

And exp(cos(x)+I*sin(-x)); evalc(Im(%)); diff(%, x);

-exp(cos(x)) cos(x) cos(sin(x)) + exp(cos(x)) sin(x) sin(sin(x))

Now -exp(cos(x))*sin(sin(x)) is 0 in 0 and in Pi and an antiderivative,

Int(2*exp(cos(x))*cos(x)*cos(sin(x)),x = 0 .. Pi)

which Maple 12 evaluates to be Pi.

Done.

Axel Vogt, Dec 6, 2009

3. ### Nasser M. AbbasiGuest

hi Alex;

But Pi is the WRONG answer. It should be 2 Pi?

--Nasser

Nasser M. Abbasi, Dec 6, 2009
4. ### Rouben RostamianGuest

Maple 11, 12, 13 can do it if we expand f first:

int(expand(f), x=0..2*Pi);

The result is 2*Pi.

Rouben Rostamian, Dec 6, 2009
5. ### Axel VogtGuest

As said: your original integral is twice of it. Axel

Axel Vogt, Dec 6, 2009
6. ### Axel VogtGuest

Much better than my way ...

Axel Vogt, Dec 6, 2009
7. ### Nasser M. AbbasiGuest

Alex, With the transformation you did, I was not sure if Pi you showed above

f:=exp(cos(x))*cos(x-sin(x));
int(f,x=0..2*Pi);

should be 2 Pi, not Pi.

--Nasser

Nasser M. Abbasi, Dec 6, 2009
8. ### FÄ±ratGuest

I want to ask new integral such as

f:=(t-a)^c/(b-t)^d; #a,b,c,d are contant

How can I found analytical integral solution

Firat

FÄ±rat, Dec 8, 2009
9. ### G. A. EdgarGuest

Well, int(t^c*(1-t)^d,t=0..1); is the Beta function.
Change variables x=(t-a)/(b-a) to reduce yours to the case a=0, b=1.
Then since yours is the indefinite integral, it would be called an
"incomplete Beta function" I suppose. Maple reports
Int(x^c*(1-x)^(-d), x) = x^(c+1)*hypergeom([d, c+1], [2+c], x)/(c+1)

G. A. Edgar, Dec 9, 2009
10. ### FÄ±ratGuest

Thanks for your answer. But I have some problem. I wrote my maple file
as you say in the following form:

with(student):
F:=Int((t-a)^c/(b-t)^d,t);

/ c
| (t - a)
F := | -------- dt
| d
/ (b - t)
/ c
| (x b - x a) (b - a)
| -------------------- dx
| d
/ (b - a - x b + x a)
/ c
| (x b - 1. x a) (b - 1. a)
| -------------------------- dx
| d
/ (b - 1. a - 1. x b + x a)

but it does not give any answer. Main problem is: this integral form
appear in my iteration statement and I have to use this integral value
for new iteration after previous iteration. I want to integrate this
function and get numerical value.

Is this possible?

Firat

FÄ±rat, Dec 10, 2009
11. ### Ray VicksonGuest

You cannot get a numerical answer unless you specify numerical values
for a, b, c and the integration limits. Maple cannot read your mind.
You can write answer_above = (b-a)^(c+1-d) * int(x^c/(1-x)^d,x), and
then express this last integral in terms of an incomplete beta
function (or a hypergeometric function, as Maple seems to prefer).
Of course not. You have not said what are the values of a, b, c and
the integration limits.

R.G. Vickson

Ray Vickson, Dec 10, 2009
12. ### FÄ±ratGuest

In my previous message I said the power c and d are non-integer value.
I give some values as you say but it does not evulate integral for
example

FÄ±rat, Dec 10, 2009
13. ### Ray VicksonGuest

Here is what I get using Maple 9.5:
restart;params:={c=0.3,d=0.5};

params := {c = 0.3, d = 0.5}
(c + 1)
x hypergeom([d, c + 1], [2 + c], x)
J := ------------------------------------------
c + 1

J1:=subs(params,J);

1.3
J1 := 0.7692307692 x hypergeom([0.5, 1.3], [2.3], x)

Of course, if we give numerical values for the integration limits we
will get a numerical evaluation:
J2:=subs(params,int(x^c/(1-x)^d,x=0 .. .97)): value(J2);
1.362551855

R.G. Vickson

Ray Vickson, Dec 11, 2009
14. ### FÄ±ratGuest

Thanks for your kindly help and understanding. I am beginner in Maple.
I want to ask a question. I want to use the first example in Maplesoft
webpage

http://www.maplesoft.com/support/he...Student/NumericalAnalysis/InitialValueProblem

I wrote as follow
`Error, NumericalAnalysis is not a command in the Student package\n`

and give above error message.

I want write this in Maple 10 classical worksheet. Please let me know
where I did wrong.

Firat

FÄ±rat, Dec 11, 2009
15. ### Robert IsraelGuest

I hope what you wrote was actually

with(Student[NumericalAnalysis]);
The NumericalAnalysis subpackage was first introduced in Maple 13. It
does not exist in Maple 10.

Robert Israel, Dec 11, 2009
16. ### BillGuest

Actually, a little simplify will produce the desired result directly:

y := exp(cos(x))*cos(x-sin(x)):
ti := int(y, x=0..2*Pi):
simplify(ti, [trig]);
2 Pi

Bill

Bill, Dec 11, 2009
17. ### FÄ±ratGuest

FÄ±rat, Dec 12, 2009
18. ### ArchimedesGuest

Using simplify with the trig option is square brackets is equivalent
to issuing the command "expand" first, and then simplifying the
output. So simplify(ti, trig); is not the same as simplify(ti,
[trig]); Is this documented somewhere? I did not see this in the
help pages for simplify, or simplify/siderels

Regards,
Georgios

Archimedes, Dec 13, 2009
19. ### BillGuest

I agree that the help pages don't explain this well. If you want to
see what the difference is, try executing
and then run the other commands. It's quite a bit different. Also try
'expand. to see how it calls 'simplify.'

Bill
Mele Kalikimaka to all

Bill, Dec 14, 2009