Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problems integrating a function

Subject: problems integrating a function

From: Marcio Barbalho

Date: 5 Jan, 2011 01:29:05

Message: 1 of 6

Please,
 Could any of you find the numerical solution to the integral of sin[(x-pi)/sqrt(x)] from pi/100 to pi?

S = int(sin((x-pi)/sqrt(x)),x=pi/100..pi)

You may copy and paste there.
I have already tried both Matlab and Scilab.

From Matlab I get:
Warning: Explicit integral could not be found.
> In sym.int at 64
  In char.int at 9
 ans =
 int(-sin(1/x^(1/2)*(pi - x)), x = pi/100..pi)

From scilab (I installed scilab just to integrate this function):
-->integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)
 !--error 24
Convergence problem...
at line 70 of function integrate called by :
integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)

The solution is -1.295820

I just can't get Matlab to find it.

Many thanks

Subject: problems integrating a function

From: Oleg Komarov

Date: 5 Jan, 2011 02:14:05

Message: 2 of 6

"Marcio Barbalho" wrote in message <ig0hh0$pvb$1@fred.mathworks.com>...
> Please,
> Could any of you find the numerical solution to the integral of sin[(x-pi)/sqrt(x)] from pi/100 to pi?
>
> S = int(sin((x-pi)/sqrt(x)),x=pi/100..pi)
>
> You may copy and paste there.
> I have already tried both Matlab and Scilab.
>
> From Matlab I get:
> Warning: Explicit integral could not be found.
> > In sym.int at 64
> In char.int at 9
> ans =
> int(-sin(1/x^(1/2)*(pi - x)), x = pi/100..pi)
>
> From scilab (I installed scilab just to integrate this function):
> -->integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)
> !--error 24
> Convergence problem...
> at line 70 of function integrate called by :
> integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)
>
> The solution is -1.295820
>
> I just can't get Matlab to find it.
>
> Many thanks

quadv(@(x) sin((x-pi)/sqrt(x)),pi/100,pi)

Oleg

Subject: problems integrating a function

From: proecsm

Date: 5 Jan, 2011 02:18:04

Message: 3 of 6

"Marcio Barbalho" wrote in message <ig0hh0$pvb$1@fred.mathworks.com>...
> Please,
> Could any of you find the numerical solution to the integral of sin[(x-pi)/sqrt(x)] from pi/100 to pi?
>
> S = int(sin((x-pi)/sqrt(x)),x=pi/100..pi)
>
> You may copy and paste there.
> I have already tried both Matlab and Scilab.
>
> From Matlab I get:
> Warning: Explicit integral could not be found.
> > In sym.int at 64
> In char.int at 9
> ans =
> int(-sin(1/x^(1/2)*(pi - x)), x = pi/100..pi)
>
> From scilab (I installed scilab just to integrate this function):
> -->integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)
> !--error 24
> Convergence problem...
> at line 70 of function integrate called by :
> integrate('sin((x-%pi)/sqrt(x))','x',0,%pi)
>
> The solution is -1.295820
>
> I just can't get Matlab to find it.
>
> Many thanks

It does not have a closed from solution, here is numeric

f = @(x)sin((x-pi)./sqrt(x))
quad(f,pi/100,pi,eps)

ans =

  -1.295458003695058

Subject: problems integrating a function

From: Walter Roberson

Date: 5 Jan, 2011 15:46:42

Message: 4 of 6

On 04/01/11 7:29 PM, Marcio Barbalho wrote:
> Please,
> Could any of you find the numerical solution to the integral of
> sin[(x-pi)/sqrt(x)] from pi/100 to pi?
>
> S = int(sin((x-pi)/sqrt(x)),x=pi/100..pi)

I can't speak about MuPad (the current Matlab symbolic engine), but when
I investigate in Maple, I find that some of the avenues to creating the
integral involve (either implicitly or explicitly) summations of an
expression from 0 to infinity, and that depending on how the terms of
that expression are arranged, the closed form summation may have a
singularity at 0 because of a denominator term that works out as
sin(Pi/2 + Pi*A) where A is the lower bound on the summation; with A
being 0, that's going to give you a 0 in the denominator.

Other paths to finding the integral look like they might be fine (or at
least not involving a division by 0).

I think the division by 0 that Maple comes up with in some cases is
probably a bug in Maple; when I wake up more, I will write it up as a
bug report for them.

Again, I have no information as to how MuPad would attempt the same
calculation.

Subject: problems integrating a function

From: Greg von Winckel

Date: 5 Jan, 2011 16:29:20

Message: 5 of 6

At first glance it looks like with some manipulation, you could write the solution in terms of exponential integrals, which you would then evaluate numerically, if you wished to obviate the need for numerical integration for some reason.

Subject: problems integrating a function

From: Greg von Winckel

Date: 5 Jan, 2011 16:38:05

Message: 6 of 6

Or rather, I meant incomplete gamma functions.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us