Ask Your Question
1

Best way to really simplify ugly formulas

asked 5 years ago

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);
d.simplify_full();

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()?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

Juanjo gravatar image

updated 5 years ago

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?
Docstring:     
   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.

   EXAMPLES:

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

      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.

Preview: (hide)
link

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

Stats

Asked: 5 years ago

Seen: 231 times

Last updated: Jun 22 '19