Dividing numerator and denominator by the same thing WAS: Newbie Question
Subject: Dividing numerator and denominator by the same thing WAS: Newbie Question
From: Stavros Macrakis
Date: Wed, 11 Nov 2009 15:51:02 -0500
Thanks for your interest in Maxima.
There is no built-in function which will do what you want, but it's easy to
define one that will do it:
(%i1) display2d:false$
(%i2) numdenmul(expr, mul) :=
if op(expr) = "-" then - numdenmul(- expr, mul)
elseif op(expr) = "/" then apply("/", expand(mul * args(expr)))
else expr $
(%i3) (2*x^2-1)/(5*x-7);
(%o3) (2*x^2-1)/(5*x-7)
(%i4) numdenmul(%o3,1/5);
(%o4) (2*x^2/5-1/5)/(x-7/5)
By the way, it is often easier for us to answer questions like this if you
give a concrete example of the input you have (e.g. (2*x^2-1)/(5*x-7) ) and
the output you want (e.g. (2*x^2/5-1/5)/(x-7/5) ) rather than giving the
general case using non-Maxima syntax (such as _ for subscripts, ellipses,
etc.).
Hope this helps,
-s
On Tue, Nov 10, 2009 at 7:41 PM, Jim scott <jscott366 at yahoo.com> wrote:
> I am an electrical engineer newly trying out Maxima to manipulate control
> system and filter equations. Part of the manipulation is to form the
> equation into an "engineer readable" format. The following has me stumped
> (b subscript n is written b_n):
>
> Given an equation of the form
> (b_n*s^n + b_(n-1)*s^(n-1) + .... b_1*s + b_0) / (a_n*s^n + a_(n-1)*s^(n-1)
> + .... a_1*s + a_0),
> how would I go about dividing the numerator and denominator by a_n (such
> that the s^n term in the denominator is always multiplied by 1)?
> Neither a_n nor the value of n is known beforehand.
>
> I have spent several hours trying to find Maxima operators to perform the
> needed division (or supportive operations) and am not finding what I need.
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>