Symbolic Integration Bug?

1 visualizzazione (ultimi 30 giorni)
Baha411
Baha411 il 3 Mag 2019
Risposto: Walter Roberson il 3 Mag 2019
Hi All,
Is this a bug of symbolic toolbox? It is kind of messing up when changing the signs.
clear all; clc;
syms x L1 L2;
L1val = 10;
L2val = 20;
Ma = -(x-L1)^2;
Mb = -(x^2+L1^2-2*x*L1);
Maint = int(Ma, x);
Mbint = int(Mb, x);
vpa(subs(subs(Maint, L1, L1val),x, 1))
vpa(subs(subs(Mbint, L1, L1val),x, 1))
ans =
243.0
ans =
-90.333333333333333333333333333333
Regards,
Baha

Risposta accettata

Walter Roberson
Walter Roberson il 3 Mag 2019
No bug. You are doing indefinite integration, which is permitted to have a constant of integration. You are evaluating at a single point rather than evaluating the difference between two locations, so the constant of integration is included in the value. It is permitted for the two forms to generate two different constants of integration.
If you were to
syms a
Maint = int(Ma, x, a, x);
Mbint = int(Mb, x, a, x);
then you would get the same result for the two.

Più risposte (0)

Categorie

Scopri di più su Symbolic Math Toolbox in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by