This sort of problem can be solved by identifying the generator with the 
smallest power. In this case `g = x**1/2` so `sqrt(x) + x -> y + y**2` 
which factors as `y*(1 + y) -> sqrt(x)*(1 + sqrt(x))`.

/c

On Friday, February 24, 2023 at 3:58:37 AM UTC-6 atharv....@gmail.com wrote:

> Lack of ability to factor out square roots seems to be a particular cause 
> for simplification issues like #23641 
> <https://github.com/sympy/sympy/issues/23641>. For example, one might 
> expect factor(sqrt(x)+x) to return sqrt(x)*(1+sqrt(x)), but it does not do 
> anything. In this specific case, we may be able to avoid simplification 
> issues by using radsimp. However, in the more general scenario, it would be 
> very beneficial to be able to factor out radicals "naturally".
>
> One potential issue I see with this is that there are many expressions 
> that would factor 'indefinitely' if we were able to factor using radicals. 
> For instance, factor_rad(x+1) might return (sqrt(x)+I)*(sqrt(x)-I). 
> However, there are many other 
> <https://www.youtube.com/watch?v=pf5wc6E4Dxc> factorizations of this 
> expression into different radicals.
>  
> The simplest fix for this would be to implement a way to specify a 
> "irreducible degree" with default setting 1. For instance, in the above 
> examples, we would choose 1/2.
>
> I would attempt to implement this right away, but I am new to both 
> open-source and SymPy, so I need some guidance. In particular, I don't 
> quite understand how _symbolic_factor works, and how exactly formal mode is 
> implemented for factor.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/2a8d8514-40ee-42c5-80a9-b817742b8589n%40googlegroups.com.

Reply via email to