Skip to content

rat/algebraic can return unsimplified result with tellrat #4199

@rtoy

Description

@rtoy

Imported from SourceForge on 2024-07-09 19:42:23
Created by macrakis on 2021-10-16 19:48:41
Original: https://sourceforge.net/p/maxima/bugs/3879


tellrat(q^2-q) => [q^2-q]
rat(q*(q+1)/2) => (q^2+q)/2
ralg: rat(%),algebraic => (2*q)/2

I'd think that the last result should be simply q.

This only happens with an argument in CRE form; with general representation, it's correct:

rat(q*(q+1)/2),algebraic => q

Workaround: call rat/algebraic on the result again:

rat(ralg) => (2*q)/2          << rat doesn't simplify
rat(ralg),algebraic => q      << repeating rat/algebraic simplifies
ratdisrep(ralg) => q          << ratdisrep also works

The problem does not come up with ratsubst:

ratsubst(r,r^2,rat(r*(r+1)/2)) => r
ratsubst(0,r^2-r,rat(r*(r+1)/2)) => r

Tested on the prebuilt Windows version of Maxima 5.45.1 / SBCL 2.0.0 / Windows 10.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions