Opened 12 years ago

Closed 9 years ago

# Get Maxima to easily accept flag values

Reported by: Owned by: Karl-Dieter Crisman Burcin Erocal trivial sage-6.3 calculus maxima, calculus, flag, radexpand Robert Marik, Burcin Erocal, Nils Bruin, Jason Grout, David Joyner Peter Bruin Nils Bruin, Karl-Dieter Crisman N/A b94b48a 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.

```sage: sage.calculus.calculus.maxima('radexpand:all')
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 9 years ago by Nils Bruin

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 9 years ago by Peter Bruin

Authors: → Peter Bruin → u/pbruin/10955-maxima_radexpand → b94b48a873b29617f5562f18ffd1a61d67b1a7a6 → sage-6.3 minor → trivial new → needs_review defect → task

Works for me too; here is a doctest.

### comment:3 Changed 9 years ago by Karl-Dieter Crisman

Reviewers: → Nils Bruin, Karl-Dieter Crisman, Michael Orlitzky needs_review → 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 9 years ago by Karl-Dieter Crisman

Reviewers: Nils Bruin, Karl-Dieter Crisman, Michael Orlitzky → Nils Bruin, Karl-Dieter Crisman

### comment:5 Changed 9 years ago by Volker Braun

Branch: u/pbruin/10955-maxima_radexpand → b94b48a873b29617f5562f18ffd1a61d67b1a7a6 → fixed positive_review → closed
Note: See TracTickets for help on using tickets.