Guys, I have incredible integration issues, see below:
I need to calculate a difficult integral and I didn't obtain good results, so I try a very simple integral in order to try to understand the problem and as you can see from the code below, Matlab provides a wrong results, beacuse the correct results is (-log(1-x)) and not (-log(x-1)), and for these reasons I'm having lots of troubles in my computations. Honestly, I have no idea about this problem, I even doubts about my capabilty of calculating such a simple integral so that I verify with WolphramAlpha that provides the correct results!
Could someone help me? Thank you very much and sorry for my english.
>> int ((-1./(1-x), x)
ans =
-log(x-1)

 Réponse acceptée

Star Strider
Star Strider le 8 Jan 2020
It looks correct to me.
The int call first simplifies:
-1/(1-x)
to:
1/(x-1)
and then integrates it to get:
Q1 = int (-1./(1-x), x)
producing:
Q1 =
log(x - 1)
The unary negative does not propagate when I run it in R2019b.

5 commentaires

yes you're right, but now I am a bit confused. Actually if i try to compute int (1/(1-x), x) , Matlab gives me -log(x-1), but even if 1/(1-x) is equal to -1/(x-1) , when the integral is computed i need the version log(1-x) because my domain x belongs to [-1,1]...
Sorry If this could appear a very ridicoulous problem, but how I can solve ? How I can get the expression log(1-x) ?
MATLAB appears to view them as being interchangable:
syms x
Q1 = diff(log(1-x),x)
Q2 = int(Q1,x)
producing:
Q1 =
1/(x - 1)
Q2 =
log(x - 1)
I cannot find any name-value pair arguments in the int function that would not result in its interim simplification. That is just how the Symbolic Math Toolbox orders expressions.
so you're saying to me that it's impossible with the intengration in matlab to obtain the results log(1-x)? There is absolutely no way?
There is absolutely no way?
I would not say that there is absolutely no way, but I would say that it might take someone outside of Mathworks... 2 or 3 person-years at least. It would involve a fundamental change to the simplification algorithm, and there is a whole bunch of existing mathematical library code that counts on the algorithm being what it currently is, so it would take a careful review of every routine inside the Symbolic Toolbox to ensure that they did not break.
It would be a lot faster if you were willing to adapt a different syntax, such as
int( DIVIDE(-1, 1-x), x)
because that could be implemented as a new data structure that only had to be processed by a limited number of routines, with it just being expected that (for example) GAMMA() could not be called on the result
Star Strider
Star Strider le 8 Jan 2020
@Walter — Thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by