Error using sym.int Too many input arguments
I was looking for some "Too many input arguments". questions, but I couldn't find an answer ...
I am new to matlab, so I have the following problem.
I want to integrate using the primaryvalue method, but I am getting the following 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?
source to share
Your Matlab version, 7.12.0, also known as R2011a, has no functionality 'PrincipalValue'
. 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 only yields the real component pi^2/4000
without the imaginary part. In addition, Wolfram Alpha does not compute the principal value, as it appears to be able to estimate the indefinite integral in w = 1000
, as shown here . This would mean that there is no need to compute the base value, since there is a normal integral, according to Wolfram Alpha. Matlab seems to disagree as he computes another antiderivative for f2
.
If you want to try and calculate the underlying values ββfor other functions using your version of Matlab, the following script can work like a template (using the definition of the value of the Cauchy principle 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 pi^2/4000
. The advanced results calculated by Matlab and Wolfram Alpha agree in their real-world arguments, but differ in their imaginary arguments (Wolfram Alpha does not).
Note that I am using the variable ' fake_inf
: Matlab cannot compute the integral if true inf
.
source to share