# Complex integra problem

Discussion in 'MATLAB' started by Paul, Aug 5, 2010.

1. ### PaulGuest

Hi.

Suppose, I have integral I(t)=int from 0 to inf x^-2 (1-0.8*i*t*x)^-5*erfc(1-logx/5)dx
Function
dblquad is used to calculate int from 0 to inf I(t)dt
But how can I use it to calculate int from 0 to inf I(t)*I(t)dt ?
Do I need here nested handles? If yes, then how should I apply them?

Or maybe you know some other ways?

Paul, Aug 5, 2010

2. ### Walter RobersonGuest

I2 = @(t) I(t).^2;

Questions:

- Is that log(x/5) or log(x)/5 ?

- Is your log base 10 or natural log?

- Is the 0.8 intended to be equivalent to 4/5 ?

I am attempting some symbolic transforms to see if I can derive a nicer
function, but when you start doing symbolic transforms, 4/5 versus 0.8 makes a
difference, especially if the coefficient turns up as an exponent.

Walter Roberson, Aug 5, 2010

3. ### PaulGuest

Coefficients can be changed dynamically in problem, those digits are just example.
I tried to use symbolic, but this integral can't be evaluated explicitly. Moreover, you could see i under integral (i^2=-1). So it's complex.

Paul, Aug 5, 2010
4. ### PaulGuest

Hello thanks for answer.
I2 = @(t) I(t).^2;

But how are you define I ?

Paul, Aug 5, 2010
5. ### usGuest

a hint:
- the var I must live in the workspace when you create the function handle...

us

us, Aug 5, 2010
6. ### PaulGuest

can you give me the code, not hint.
[email protected](x,t) x^-2*...... ?

Paul, Aug 5, 2010
7. ### Walter RobersonGuest

Take the function handle you have now for dblquad'ing x^-2 <etc>
and wrap another handle around it that takes the same parameters and calls the
first handle and squares the result.

Walter Roberson, Aug 5, 2010
8. ### PaulGuest

I tried this code: (function x*y^2)
And integration from 0 to 1:
[email protected](x,y) x.^2*y;
[email protected](y) I(y).^2;

But it's not working.

??? Error using ==> @(y) I(y).^2
Too many input arguments.

Paul, Aug 5, 2010
9. ### Walter RobersonGuest

Does that match what I said,

Does your I2 have the *same* parameters as your I ?

I = @(x,y) x.^2*y;
I2 = @(x,y) I(x,y).^2;

ans =
0.0666666666666667

Walter Roberson, Aug 5, 2010
10. ### PaulGuest

Thanks!!!!!

Paul, Aug 5, 2010
11. ### PaulGuest

Can I find value of this integral in analytical value i.e. before last integrating - I(x,y).^2. Maybe using some series expansion?

Paul, Aug 5, 2010
12. ### Walter RobersonGuest

For the original function with erfc, it appears that the answer is NO. You can
construct a series or taylor expansion, but the expansion has to be around a
particular point; some trials show that the expansion would get to very large
numbers on short order, with a lot of cancellation.

Experimenting, at least with positive t, it appears that an outcome of the
log(x)/5 term in conjunction with the rest is that there is a natural
breakpoint in the integral at x=exp(5), and that for x above that, the
expression becomes very small. Towards 0, at least for t=2, there appears to
be a peak around 1/10^9 but I have not yet found any transformation that would
allow me to calculate where that peak really is; the peak is tall enough that
even though the area is fairly narrow, it would represent quite a bit of the
integral.

If you could prove these tendencies then it would point to a possible change
of variables u = 1/x and evaluation "close to 0" that might perhaps be
amenable to computation in a relatively small number of steps while preserving
decent precision. Maybe.

Walter Roberson, Aug 6, 2010
13. ### PaulGuest

Hello! Thanks for the answers.
But I've found the problem.
I will simplify it
I need to do the following (I will denote integral through S).
I need to find: S(S(x.^2*y)*S(x.^2*y))
All limits are from 0 to 1
You wrote:
I = @(x,y) x.^2*y;
I2 = @(x,y) I(x,y).^2;
But this code makes the following:
S(S(x*y^2*x*y^2))
See the difference?
I must take two integrals and then take integral from their multiplication, not multiply functions and take double integral.
Can you provide the appropriate code, if such exists?

Thank you and please don't propose to use symbolic integration.
It won't work in my case.

Paul, Aug 6, 2010