Integral keeps showing wrong answer
Ältere Kommentare anzeigen
I have been doing the integral of f=(8*x-4)/(4*x^2-4*x+5) with matlab, however, it keeps giving the wrong answer, could you help me spot whether I did something wrong with my codes? Or is it a problem of matlab?
PS: the correct answer should be log(4*x^2−4*x+5)+c, but matlab keeps showing log(x^2 - x + 5/4) (yeah I know that matlab doesn't show "+c", but still, the answer is wrong).

Akzeptierte Antwort
Weitere Antworten (1)
Walter Roberson
am 1 Mär. 2020
0 Stimmen
Log of something multiplied by 4 is equal to log 4 plus log of the something. log 4 is an additive constant and indefinite integrals can have arbitrary additive constants. Therefore both versions are correct.
MATLAB considers division (your proposed 5/4) to be more expensive than multiplication so it prefers the version without the division.
Kategorien
Mehr zu Programming finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!