Ask Your Question
1

Best way to really simplify ugly formulas

asked 2019-06-22 10:17:13 -0600

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-06-22 11:07:20 -0600

Juanjo gravatar image

updated 2019-06-22 11:08:32 -0600

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.

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

Stats

Asked: 2019-06-22 10:17:13 -0600

Seen: 50 times

Last updated: Jun 22