Processing math: 100%
Ask Your Question
1

Problem by finding an integral

asked 3 years ago

Spyridon Kanavos gravatar image

updated 3 years ago

slelievre gravatar image

I have to find the integral of x*sqrt(x + 1) dx.

By hand, I found (2/3)*x*(x + 1)^(3/2) – (4/15)*(x + 1)^(5/2) + c.

By SageMath I found -(2/3)*(x + 1)^(3/2) + (2/15)*(x + 1)^(5/2).

The SageMath code is simple:

x = var('x')
f = x*sqrt(x + 1)
fi = integral(f, x)
print(latex(fi))

Which is the error?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
3

answered 3 years ago

rburing gravatar image

The SageMath result (output of your code in SageMath 9.2) has coefficient a 2/5 instead of the 2/15 you claim:

sage: fi
2/5*(x + 1)^(5/2) - 2/3*(x + 1)^(3/2)

Then it agrees with your hand calculation, e.g. because for z=x+1 we have 25z523z3=23(z21)z3415z5.

Preview: (hide)
link

Comments

Thank you! Thanks a lot!

Spyridon Kanavos gravatar imageSpyridon Kanavos ( 3 years ago )

You can accept rburing's answer by clicking the check mark next to it below its score.

slelievre gravatar imageslelievre ( 3 years ago )
2

answered 3 years ago

slelievre gravatar image

updated 3 years ago

Both answers are correct.

To see it by hand, we can use:

  • (x+1)5/2=(x+1)(x+1)3/2=x(x+1)3/2+(x+1)3/2
  • (x+1)3/2=(x+1)(x+1)1/2=x(x+1)1/2+(x+1)1/2

to express both as linear combinations of (x+1)1/2, x(x+1)1/2 and x2(x+1)1/2.

To see it with Sage, we can

  • ask Sage whether the two different expressions in fact agree
  • differentiate both and compare them
  • plot the functions to visually check whether they agree

Define the function to integrate:

sage: x = var('x')
sage: f = x*sqrt(x + 1)
sage: f
sqrt(x + 1)*x

Compute a primitive (aka antiderivative) with Sage:

sage: F = integral(f, x)
sage: F
2/5*(x + 1)^(5/2) - 2/3*(x + 1)^(3/2)

The primitive you computed (up to a constant):

sage: G = (2/3)*x*(x + 1)^(3/2) - (4/15)*(x + 1)^(5/2)
sage: G
-4/15*(x + 1)^(5/2) + 2/3*(x + 1)^(3/2)*x

Check that they agree:

sage: bool(F == G)
True

Check they have the same derivative:

sage: g = G.diff(x)
sage: g
sqrt(x + 1)*x

sage: ff = F.diff(x)
sage: ff
(x + 1)^(3/2) - sqrt(x + 1)

sage: bool(g == ff)
True

Or more visually, compare the plots of F and G (or f and ff):

sage: pF = plot(F, (-1, 1.6), color='firebrick')
sage: pG = plot(G, (-1, 1.6), color='steelblue')
sage: p = graphics_array([pF, pG, pF + pG])
sage: p.show(figsize=(7, 3))
Launched png viewer for Graphics Array of size 1 x 3

Plot two functions with Sage and check they are the same

Preview: (hide)
link

Comments

Excellent! Very interesting answer. Otherwise, I have an older version: Sage 8.0

Spyridon Kanavos gravatar imageSpyridon Kanavos ( 3 years ago )

Oh, I see. I would recommend upgrading to Sage 9.3.

When I run Sage 8.0 I get this:

sage: x = var('x')
sage: f = x*sqrt(x + 1)
sage: f
sqrt(x + 1)*x
sage: F = integral(f, x)
sage: F
2/5*(x + 1)^(5/2) - 2/3*(x + 1)^(3/2)

Do you really get (2/15)?

slelievre gravatar imageslelievre ( 3 years ago )

Yeah, the problem probably has to do with the version. I uninstalled the 8.0 version and I installed the 9.3 one. Now everything is o.k. Thanks a lot!

Spyridon Kanavos gravatar imageSpyridon Kanavos ( 3 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 3 years ago

Seen: 350 times

Last updated: Jun 16 '21