Antonis St
Antonis St

Reputation: 33

Error using sym.int Too many input arguments

i ve searched some "Too many input arguments." questions but i have not found answer...

i am a newbie to matlab so i have the following problem

i want to integrate using principalvalue method but i get the folowing message

 syms w
 f2=(log(w)-log(1000))/(w^2-1000000)
 int(f2, w, 0, inf, 'PrincipalValue', true)

and i get :

Error using ==> sym.int
Too many input arguments.

What can i do to overcome this problem?

Upvotes: 3

Views: 807

Answers (1)

MattG
MattG

Reputation: 1426

Your version of Matlab, 7.12.0, also known as R2011a, does not have the 'PrincipalValue' functionality. The documentation for R2011a can be found here.

The value returned by my copy of Matlab for your integral is

(pi*243045032034301i)/70368744177664000 + pi^2/4000

However, using the command integrate(log(x) - log(1000))/(x^2 - 1000000)) from 0 to infinity with Wolfram Alpha yields only the real pi^2/4000 component with no imaginary part. Additionally, Wolfram Alpha is not computing the principal value, as it appears that it is able to evaluate the indefinite integral at w = 1000 as shown here. This would mean that there is no need to compute the principal value as the ordinary integral exists, according to Wolfram Alpha. Matlab seems to disagree, as it computes a different antiderivative for f2.

If you want to try and compute principal values for other functions using your version of Matlab, the following script can work as a template (using the definition of a Cauchy Principal Value found here):

syms w;
syms e;
syms b;
format long; % For long decimal display
f2=(log(w)-log(1000))/(w^2-1000000);
fake_inf = 5e60; % Really high number, gives NaN for true inf
% Cauchy Principal Value about w = 1000: compute as limit of a sum
integral1 = int(f2, w, 0, 1000-e);
integral2 = int(f2, w, 1000+e, fake_inf);

% Built-in Principal Value integral result:
% int(f2, w, 0, inf, 'PrincipalValue', true);
0.002467401100272 + 0.010850676618623i

CPV = limit(integral1+integral2, e, 0, 'right');
eval(CPV)

which outputs

ans =

  0.002467401100272 + 0.010850676618623i


ans =

  0.002467401100272 - 0.417381909829793i

where 0.002467... is the decimal expansion of pi^2/4000. The antiderivatives computed by Matlab and Wolfram Alpha agree in their real arguments yet differ in their imaginary arguments (Wolfram Alpha has none).

Note that I use a 'fake_inf' variable: Matlab cannot compute the integral if the true inf value is used.

Upvotes: 2

Related Questions