Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

About Singularity Problem

72 views
Skip to first unread message

Oguzhan Ayrancioglu

unread,
Jun 3, 2016, 3:00:09 AM6/3/16
to
Hi,

First of all I am new on Matlab. I searched some topics and "Matlab Help" section but didn't find that how can i solve problems which have singularity issue. There are some cases in the "help" menu and it says if there is a singularity u should split function boundaries. But i just have function that is "F(x)=1/x" and interval "0-1" so as you see, when x gets value of "0" function goes to infinity..

Could someone help me what is the approach i need to follow for this situation?

Thank you

Torsten

unread,
Jun 3, 2016, 4:30:08 AM6/3/16
to
"Oguzhan Ayrancioglu" wrote in message <nir9tj$17i$1...@newscl01ah.mathworks.com>...
What are you trying to do with the function that causes the error message ?

Best wishes
Torsten.

Oguzhan Ayrancioglu

unread,
Jun 3, 2016, 6:19:09 AM6/3/16
to
> What are you trying to do with the function that causes the error message ?
>
> Best wishes
> Torsten.

I just want to integrate "1/x" between 0,1. When "x=0" i got error which is "Warning: Infinite or Not-a-Number value encountered." i gave Tolerance (like "RelTol" and "AbsTol") nothing changed.

Than use this;

[int_2, err]=quadgk(fun,inf,1,'RelTol',1e-8,'AbsTol',1e-12,'MaxIntervalCount',1024)

at intervals, "inf" is "0" here. cause like i said before when x=0 function is infinite. so i need to have good approximation to "0" and it has to stop before x hits to "0" to avoid being infinite. But the output "err" gave me 3.7. And said i need to more iteration for interval counting.. The warning is like below;

"Warning: Reached the limit on the maximum number of intervals in use. Approximate bound on
error is 3.7e+00. The integral may not exist, or it may be difficult to approximate
numerically. Increase MaxIntervalCount to 1504 to enable QUADGK to continue for another
iteration."

How do i solve this?

Thanks for your help
Oguzhan

Bruno Luong

unread,
Jun 3, 2016, 6:28:08 AM6/3/16
to
"Oguzhan Ayrancioglu" wrote in message <nirlio$pnk$1...@newscl01ah.mathworks.com>...

> How do i solve this?
>

Easy:

int2 = Inf

Nasser M. Abbasi

unread,
Jun 3, 2016, 6:41:30 AM6/3/16
to
On 6/3/2016 5:19 AM, Oguzhan Ayrancioglu wrote:
>> What are you trying to do with the function that causes the error message ?
>>
>> Best wishes
>> Torsten.
>
> I just want to integrate "1/x" between 0,1.
>When "x=0" i got error which is "Warning: Infinite or Not-a-Number value encountered."
>
> How do i solve this?
>
> Thanks for your help
> Oguzhan
>


int(1/x,x) is ln(x). When x=0, ln(x)=infinity.

You could integrate starting from some epsilon after zero.

int(1/x,x,eps('double'),1)
52*log(2)
double(ans)
36.0437

some integrals with singularities can be integrated
using 'PrincipalValue' option. For example

syms x
int(1/x,x,-1,1)

NaN

but

int(1/x,x,-1,1,'PrincipalValue',true)
0

--Nasser






Oguzhan Ayrancioglu

unread,
Jun 3, 2016, 6:46:08 AM6/3/16
to
> Easy:
>
> int2 = Inf

Thank you for ur post but, int_2=inf???

That is my problem indeed Bruno. Before it goes infinite i should hold it at some tolerance level giving me result. But i can't hold it. x goes every time to zero and Function goes infinite either.. So integral as u said equals to "inf" I need approximation before reaching value of zero.

Can i explain myself? Cause maybe i couldn't cause of my pretty bad english..

Best Wishes,
Oguzhan

Bruno Luong

unread,
Jun 3, 2016, 6:53:09 AM6/3/16
to
"Nasser M. Abbasi" wrote in message <nirmsj$1pff$1...@gioia.aioe.org>...
> On 6/3/2016 5:19 AM, Oguzhan Ayrancioglu wrote:

>
> int(1/x,x) is ln(x). When x=0, ln(x)=infinity.
>

Sign is reversed:

ln(x=0+) = -Inf.
But integral on [0,1] 1/x dx = log(1) - log(0+) = 0 - (-Inf) = +Inf
0 new messages