Sponsored links: Algebra eBooks
 

Related

ratvars

? ratvars ;

Calculate

ratvars

? ratvars ;

Calculate

ratvars

Run Example
(%i1)? ratvars;

 -- Function: ratvars (<x_1>, ..., <x_n>)
 -- Function: ratvars ()
 -- System variable: ratvars
     Declares main variables <x_1>, ..., <x_n> for rational expressions.
     <x_n>, if present in a rational expression, is considered the main
     variable.  Otherwise, <x_[n-1]> is considered the main variable if
     present, and so on through the preceding variables to <x_1>, which
     is considered the main variable only if none of the succeeding
     variables are present.

     If a variable in a rational expression is not present in the
     `ratvars' list, it is given a lower priority than <x_1>.

     The arguments to `ratvars' can be either variables or non-rational
     functions such as `sin(x)'.

     The variable `ratvars' is a list of the arguments of the function
     `ratvars' when it was called most recently.  Each call to the
     function `ratvars' resets the list.  `ratvars ()' clears the list.


  There are also some inexact matches for `ratvars'.
  Try `?? ratvars' to see them.

(%o1)                                true
(%i2) 
Run Example
p(z):= a*z^2+b;
                                          2
(%o1)                          p(z) := a z  + b
(%i2) q(z):= c*z^2+d;
                                          2
(%o2)                          q(z) := c z  + d
(%i3) nxt(ns) := rat(ns[1]^2*[p(ns[2]/ns[1]),q(ns[2]/ns[1])]);
                                           ns      ns
                                      2      2       2
(%o3)                nxt(ns) := rat(ns  [p(---), q(---)])
                                      1    ns      ns
                                             1       1
(%i4) iter(n,z):=if n=0 then [z,1] else nxt( iter(n-1,z));
(%o4)     iter(n, z) := if n = 0 then [z, 1] else nxt(iter(n - 1, z))
(%i5) cmp(a,b):=a[1]*b[2]-a[2]*b[1];
(%o5)                     cmp(a, b) := a  b  - a  b
                                        1  2    2  1
(%i6) ratvars(r);
(%o6)                                 [r]
(%i7) periods(n,z):= block([foo:iter(n,z)], resultant(cmp(foo,[z,1])/cmp(iter(1,z),iter(0,z)),foo[2]*r-cmp(diff(foo,z),[z,1]),z)/part(foo[2],1,1));
(%o7) periods(n, z) := block([foo : iter(n, z)], 
                cmp(foo, [z, 1])
 resultant(---------------------------, foo  r - cmp(diff(foo, z), [z, 1]), z)
           cmp(iter(1, z), iter(0, z))     2
 -----------------------------------------------------------------------------)
                               part(foo , 1, 1)
                                       2
(%i8) factor(periods(2,z));
                  2
(%o8) ((a d - b c)
    2  2                    2  2        3                    2  2        3 2
  (a  d  r - 2 a b c d r + b  c  r - 4 c  d - 4 a b c d - 4 b  c  - 4 a b ) )/d
(%i9) 
Run Example
(x^2+x)/x;
                                     2
                                    x  + x
(%o1)                               ------
                                      x
(%i2) ratvars(x);
(%o2)                                 [x]
(%i3) ratsimp(%);
(%o3)             

Related Help

Help for Ratvars