ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 13 May 2019 17:14:37 +0200Rearranging expressions to minimize negative signshttps://ask.sagemath.org/question/46502/rearranging-expressions-to-minimize-negative-signs/ SageMath newbie still learning the basics here. My goal is to mostly use Sage for basic arithmetic and calculus. I'm playing with some basic equations here, but I can't seem to figure out how to rearrange the output the way I'd like.
For instance:
f, s, s_i = var("f, s, s_i")
thin_lens_formula = 1/f == 1/s + 1/s_i
solve(thin_lens_formula, s)[0]
Output:
s == -f*s_i/(f - s_i)
I'd prefer this to be expressed as `s == f*s_i / (s_i - f)`, multiplying both numerator and denominator by -1 so there is one less negative sign in total. Is there a way to do this or is Sage not really meant to be micro-managed like this?
relatively_randomMon, 13 May 2019 17:14:37 +0200https://ask.sagemath.org/question/46502/