Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Symbolic Math Integration

Subject: Symbolic Math Integration

From: David Egolf

Date: 28 Nov, 2010 23:07:03

Message: 1 of 3

I'm having a problem with the "igrand" statement in Matlab's Symbolic Math toolbox. For example, please refer to the following two programs that I copied and pasted from my "m" files. The only difference between these two programs is that, in the
integrand, the coefficients R1=c1, R2=c2/2, and R3=c3/3. I ran both programs, then made the substitutions indicated in the previous sentence by hand. But the two solutions are different by 1/2*log(6) = 0.896. Am I doing something wrong or is the Symbolic Math "igrand" statement screwed up? I hope somebody can set me straight. My direct e-mail address is <degolf@uidaho.edu>.
Thanks,
David Egolf

%
% LK_Integration_Using R_Coefficients_Nov_2_2010
clear all
syms F R1 R2 R3
igrand = 1./((R1).*(1-(F))+(R2).*(1-(F.^2))+(R3).*(1-(F.^3)))
y = int(igrand,F)
ys = simple(y)
%

%
% LK_Integration_Using_C_Coefficients_Nov_9_2010
clear all
syms F c1 c2 c3
igrand = 1./(c1+(c2./2)+(c3./3)-((c1).*(F))-((c2./2).*(F.^2))-((c3./3)...
    .*(F.^3)))
y = int(igrand,F)
ys = simple(y)
%

Subject: Symbolic Math Integration

From: Roger Stafford

Date: 29 Nov, 2010 00:08:02

Message: 2 of 3

"David Egolf" <degolf@uidaho.edu> wrote in message <icunan$lrd$1@fred.mathworks.com>...
> I'm having a problem with the "igrand" statement in Matlab's Symbolic Math toolbox. For example, please refer to the following two programs that I copied and pasted from my "m" files. The only difference between these two programs is that, in the
> integrand, the coefficients R1=c1, R2=c2/2, and R3=c3/3. I ran both programs, then made the substitutions indicated in the previous sentence by hand. But the two solutions are different by 1/2*log(6) = 0.896. Am I doing something wrong or is the Symbolic Math "igrand" statement screwed up? I hope somebody can set me straight. My direct e-mail address is <degolf@uidaho.edu>.
> Thanks,
> David Egolf
>
> %
> % LK_Integration_Using R_Coefficients_Nov_2_2010
> clear all
> syms F R1 R2 R3
> igrand = 1./((R1).*(1-(F))+(R2).*(1-(F.^2))+(R3).*(1-(F.^3)))
> y = int(igrand,F)
> ys = simple(y)
> %
>
> %
> % LK_Integration_Using_C_Coefficients_Nov_9_2010
> clear all
> syms F c1 c2 c3
> igrand = 1./(c1+(c2./2)+(c3./3)-((c1).*(F))-((c2./2).*(F.^2))-((c3./3)...
> .*(F.^3)))
> y = int(igrand,F)
> ys = simple(y)
> %
- - - - - - - -
  Here you are using the 'int' function to find indefinite integrals, and there is no canonically unique answer to an indefinite integral. Therefore the symbolic toolbox is only restricted in its answer up to an arbitrary added constant. Whatever the inscrutable procedures 'int' has used on these two examples it has somehow managed to have different added constants for the differing expressions.

  The same thing happens frequently to calculus students finding indefinite integrals. One student's solution may different by a constant from another's because they have used different methods even though each was correct. You need to give 'int' the same leeway.

Roger Stafford

Subject: Symbolic Math Integration

From: David Egolf

Date: 29 Nov, 2010 00:31:03

Message: 3 of 3

Roger,
Thank you very much.
David Egolf


"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <icuqt2$84v$1@fred.mathworks.com>...
> "David Egolf" <degolf@uidaho.edu> wrote in message <icunan$lrd$1@fred.mathworks.com>...
> > I'm having a problem with the "igrand" statement in Matlab's Symbolic Math toolbox. For example, please refer to the following two programs that I copied and pasted from my "m" files. The only difference between these two programs is that, in the
> > integrand, the coefficients R1=c1, R2=c2/2, and R3=c3/3. I ran both programs, then made the substitutions indicated in the previous sentence by hand. But the two solutions are different by 1/2*log(6) = 0.896. Am I doing something wrong or is the Symbolic Math "igrand" statement screwed up? I hope somebody can set me straight. My direct e-mail address is <degolf@uidaho.edu>.
> > Thanks,
> > David Egolf
> >
> > %
> > % LK_Integration_Using R_Coefficients_Nov_2_2010
> > clear all
> > syms F R1 R2 R3
> > igrand = 1./((R1).*(1-(F))+(R2).*(1-(F.^2))+(R3).*(1-(F.^3)))
> > y = int(igrand,F)
> > ys = simple(y)
> > %
> >
> > %
> > % LK_Integration_Using_C_Coefficients_Nov_9_2010
> > clear all
> > syms F c1 c2 c3
> > igrand = 1./(c1+(c2./2)+(c3./3)-((c1).*(F))-((c2./2).*(F.^2))-((c3./3)...
> > .*(F.^3)))
> > y = int(igrand,F)
> > ys = simple(y)
> > %
> - - - - - - - -
> Here you are using the 'int' function to find indefinite integrals, and there is no canonically unique answer to an indefinite integral. Therefore the symbolic toolbox is only restricted in its answer up to an arbitrary added constant. Whatever the inscrutable procedures 'int' has used on these two examples it has somehow managed to have different added constants for the differing expressions.
>
> The same thing happens frequently to calculus students finding indefinite integrals. One student's solution may different by a constant from another's because they have used different methods even though each was correct. You need to give 'int' the same leeway.
>
> Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us