Ask Your Question

Revision history [back]

With the algorithm by Fu et al, implemented as fu.py in Sympy:

import sympy as sy

f = sqrt(3)/3*cos(x)+1/3*sin(x)
f_reduced = SR(sy.fu(sy.sympify(f))); f

gives 2/3*sin(1/3*pi + x) (which is $\frac{\pi}{2}$-close to the answer you expected!).


From my own experience, this type of functionality is very useful (1). I'd define this reduction as: "try to get a formula with the smaller number of terms as possible". This is the type of simplification that often looks nicer, or simpler (to a physicist, say), and it what I often want from a CAS -- though in many real cases a trained human does better and faster. A step forward would be that the program introduces new useful auxiliary variables, I ignore if this exists in some form already.

In the case at hand, there is a single specific reduction which works, sy.FU['TR10i'](expr), while using sy.fu(expr) runs through several reductions and picks the one which gives a "simpler" expression, as explained in the doc.

(1) The use case is solving physics/engineering problems that involve long formulas with many trig functions/complex exponentials. As a concrete example, these often arise when computing determinants in Fourier space.

With the algorithm by Fu et al, implemented as fu.py in Sympy:

import sympy as sy

f = sqrt(3)/3*cos(x)+1/3*sin(x)
f_reduced = SR(sy.fu(sy.sympify(f))); f
f_reduced

gives 2/3*sin(1/3*pi + x) (which is $\frac{\pi}{2}$-close to the answer you expected!).


From my own experience, this type of functionality is very useful (1). I'd define this reduction as: "try to get a formula with the smaller number of terms as possible". This is the type of simplification that often looks nicer, or simpler (to a physicist, say), and it what I often want from a CAS -- though in many real cases a trained human does better and faster. A step forward would be that the program introduces new useful auxiliary variables, I ignore if this exists in some form already.

In the case at hand, there is a single specific reduction which works, sy.FU['TR10i'](expr), while using sy.fu(expr) runs through several reductions and picks the one which gives a "simpler" expression, as explained in the doc.

(1) The use case is solving physics/engineering problems that involve long formulas with many trig functions/complex exponentials. As a concrete example, these often arise when computing determinants in Fourier space.

With the algorithm by Fu et al, implemented as fu.py in Sympy:

import sympy as sy

f = sqrt(3)/3*cos(x)+1/3*sin(x)
f_reduced = SR(sy.fu(sy.sympify(f))); f_reduced

gives 2/3*sin(1/3*pi + x) (which is $\frac{\pi}{2}$-close to the answer you expected!).


From my own experience, this type of functionality is very useful (1). I'd define this reduction as: "try to get a formula with the smaller number of terms as possible". This is the type of simplification that often looks nicer, or simpler (to a physicist, say), and it is what I often want from a CAS -- though in many real cases a trained human does better and faster. A step forward would be that the program introduces new useful auxiliary variables, I ignore if this exists in some form already.

In the case at hand, there is a single specific reduction which works, sy.FU['TR10i'](expr), while using sy.fu(expr) runs through several reductions and picks the one which gives a "simpler" expression, as explained in the doc.

(1) The use case is solving physics/engineering problems that involve long formulas with many trig functions/complex exponentials. As a concrete example, these often arise when computing determinants in Fourier space.

With the algorithm by Fu et al, implemented as fu.py in Sympy:

import sympy as sy

f = sqrt(3)/3*cos(x)+1/3*sin(x)
f_reduced = SR(sy.fu(sy.sympify(f))); f_reduced

gives 2/3*sin(1/3*pi + x) (which is $\frac{\pi}{2}$-close to the answer you expected!).


From my own experience, this type of functionality is very useful (1). I'd define this reduction as: "try to get a formula with the smaller number of terms as possible". This is the type of simplification that often looks nicer, or simpler (to a physicist, say), and it is what I often want from a CAS -- though in many real cases a trained human does better and faster. A step forward would be that the program introduces new useful auxiliary variables, I ignore if this exists in some form already.

In the case at hand, there is a single specific reduction which works, sy.FU['TR10i'](expr), while using sy.fu(expr) runs through several reductions and picks the one which gives a "simpler" expression, as explained in the doc.

(1) The use case is solving physics/engineering problems that involve long formulas with many trig functions/complex exponentials. As a concrete example, these often arise when computing determinants in Fourier space.

With the algorithm by Fu et al, implemented as fu.py in Sympy:

import sympy as sy

f = sqrt(3)/3*cos(x)+1/3*sin(x)
f_reduced = SR(sy.fu(sy.sympify(f))); f_reduced

gives 2/3*sin(1/3*pi + x) (which is $\frac{\pi}{2}$-close to the answer you expected!).


From my own experience, this type of functionality is very useful (1). I'd define this reduction as: "try to get a formula with the smaller number of terms as possible". This is the type of simplification that often looks nicer, or simpler (to a physicist, say), and it is what I often want from a CAS -- though in many real cases a trained human does better and faster. A step forward would be that the program introduces new useful auxiliary variables, I ignore if this exists in some form already.

In the case at hand, there is a single specific reduction which works, sy.FU['TR10i'](expr), while using sy.fu(expr) runs through several reductions and picks the one which gives a "simpler" expression, as explained in the doc.

(1) The use case is solving physics/engineering problems that involve formulas with many trig functions/complex exponentials. As a concrete example, these often arise when computing determinants consider a determinant in Fourier space.

space arising from the normal modes of a discrete system.