Ask Your Question

Best way to really simplify ugly formulas

asked 2019-06-22 17:17:13 +0200

Harald gravatar image

As a casual user of sagemath I am always struggling to get my formulas simplified:

var('rg rs r');
dens = 1-r^2*rs/rg^3;
idens = 1-rs/rg;
ism = 1/4 *(3*sqrt(idens)-sqrt(dens))^2 * dens;
d = derivative(ism, r);

The result has some potential for simplification, at least in terms of what think simplification might be. Can someone provide some hints as to how to get better results than from simplify_full()?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-06-22 18:07:20 +0200

Juanjo gravatar image

updated 2019-06-22 18:08:32 +0200

If you type

sage: d.simplify

and the tab key, you will see a pop-up frame showing different ways to complete that command to simplify d:

image description

Select one of them, say simplify_full, add ? and press the return key to see the associated help:

sage: d.simplify_full?
   Apply "simplify_factorial()", "simplify_rectform()",
   "simplify_trig()", "simplify_rational()", and then "expand_sum()"
   to self (in that order).

   ALIAS: "simplify_full" and "full_simplify" are the same.


      sage: f = sin(x)^2 + cos(x)^2
      sage: f.simplify_full()

      sage: f = sin(x/(x^2 + x))
      sage: f.simplify_full()
      sin(1/(x + 1))

In this case, since d contains radicals, you may try another method:

sage: d.canonicalize_radical()

which is the actual form of the deprecated simplify_radical. Check if the resulting simplification is good enough for you.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-06-22 17:17:13 +0200

Seen: 91 times

Last updated: Jun 22 '19