Opened 9 years ago

Closed 5 years ago

Get Maxima to easily accept flag values

Reported by: Owned by: kcrisman burcin trivial sage-6.3 calculus maxima, calculus, flag, radexpand robert.marik, burcin, nbruin, jason, wdj Peter Bruin Nils Bruin, Karl-Dieter Crisman N/A b94b48a (Commits) b94b48a873b29617f5562f18ffd1a61d67b1a7a6

Description

Maxima relatively recently decided that 1/sqrt(x) is not sqrt(1/x), for good reasons (1/sqrt(-1)=-i but sqrt(1/-1)=i in usual discussion). So for the following integral, they note that it depends on how you input it:

sage: integrate(sqrt(1/x^2+x),x)
integrate(sqrt(x + 1/x^2), x)
sage: integrate(1/sqrt(x^2+x),x)
log(2*x + 2*sqrt(x^2 + x) + 1)

Fine. Then they suggest using the flag radexpand:all to make the first one behave. But I can't figure out how to get it to evaluate.

all
sage: integrate(sqrt(1/x^2+x),x)
integrate(sqrt(x + 1/x^2), x)

Trying maxima.eval only changes that I get 'all' instead of all. We should make this work, since this is the *calculus* instance of Sage!

comment:1 Changed 6 years ago by nbruin

Works for me on some flavour of 5.13.beta0

sage: integrate(sqrt(1/x^2+x),x)
integrate(sqrt(x + 1/x^2), x)
all
sage: integrate(sqrt(1/x^2+x),x)
2/3*sqrt(x^3 + 1) - 1/3*log(sqrt(x^3 + 1) + 1) + 1/3*log(sqrt(x^3 + 1) - 1)

I didn't check if the answer makes sense, but at least setting the flag has effect.

comment:2 Changed 5 years ago by pbruin

• Authors set to Peter Bruin
• Branch set to u/pbruin/10955-maxima_radexpand
• Commit set to b94b48a873b29617f5562f18ffd1a61d67b1a7a6
• Milestone set to sage-6.3
• Priority changed from minor to trivial
• Status changed from new to needs_review
• Type changed from defect to task

Works for me too; here is a doctest.

comment:3 Changed 5 years ago by kcrisman

• Reviewers set to Nils Bruin, Karl-Dieter Crisman, Michael Orlitzky
• Status changed from needs_review to positive_review

As far as I can tell this is fine. I have no idea why this didn't work before. Passes tests, does right thing.

Wow, I am just now noticing that the suggestion made earlier was pretty bogus.

sage: integrate(1/sqrt(x^2+x),x)
log(2*x + 2*sqrt(x^2 + x) + 1)

Totally not the same thing as sqrt(1/x^2+x)! Should have been

sage: integrate(1/sqrt(x^2+x),x)
log(2*x + 2*sqrt(x^2 + x) + 1)
sage: integrate(sqrt(1/(x^2+x)),x)
log(sqrt(x + 1)/sqrt(x) + 1) - log(sqrt(x + 1)/sqrt(x) - 1)

which also happens to be affected by radexpand:all.

comment:4 Changed 5 years ago by kcrisman

• Reviewers changed from Nils Bruin, Karl-Dieter Crisman, Michael Orlitzky to Nils Bruin, Karl-Dieter Crisman

comment:5 Changed 5 years ago by vbraun

• Branch changed from u/pbruin/10955-maxima_radexpand to b94b48a873b29617f5562f18ffd1a61d67b1a7a6
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.