Friday, June 19, 2015

Fundamentals - Fooling Around with Polynomials and Equations

Hey, this post is one of the series of posts which essentially list out the commands that I have combed through the manuals and the various sage wiki and chatrooms, about the basic commands that you can use to follow things through as per the instructions on a classic textbook)

A list of commands which I found to be extremely helpful in manipulating the various equations and polynomials which are like the bread and butter of any Mathematical Analysis.

I did come across the extensive usage of Rings and Fields within the various examples in the manuals but apart from that, I think the following commands would suffice for anyone who wishes to begin with formula manipulation within Sage.

I have used MathJax to render the basic LATEX code into the traditional form). Seriously, this is amazing, I mean the lingo coming out from my mouth, I am improving and I truly hope that you get something out of this as well;P

As for our working example let us take these two equations and try out various Sage commands on them.

NOTE: This is a very rough draft post, as at the moment I am only collecting the most important commands which are essential to make progress, but I'll convert it into a proper blog post overtime.


These equations are, of course, to be typed in Sage notebooks as following

var('a b x y')
eq1 = 3*x*x + 5*y ;
eq2 = 3*x*x + 5*y*z + (x-y)^2

Whereas the first command declares the list of variables that we would be using in our calculations without assigning any value to them. The fact the a/b/x/y are independent variables with no values of their own makes it necessary for us to specify their nature to Sage beforehand, whereas variables like eq1 and eq2 would be accommodated by Sage on it's own.

︠latex(eq1)

eq3 = eq1 == eq2

show(eq3)

eq2.expand()

eq1.coefficients(x)

(eq2.expand()).collect(y)

eq2.simplify()

eq2.is_polynomial(x)

(eq2.expand()).combine()

eq3.add_to_both_sides(a)

eq3.denominator()

eq4 =eq3.lhs()

eq4  = eq3.lhs() + b

show(eq4)

(eq3.lhs()).substitute(x=4)

eq3.simplify_full()

eq5 = eq3.subtract_from_both_sides( eq3.rhs())

show(eq5.expand())

eq2.add(x, y, z, hold = True)

eq5.collect_common_factors()

eq5.factor_list()

eq5.factor()

function()
assume()
forget()

gradient()
truncate() # yields the trancated form of power series in Big-Oh
leading_coefficient()
low_degree()
number_of_arguments()
number_of_operands()
partial_fraction()
polynomial()
list()
dict()
power()
power_series()
series()
rect_form()
test_relation()
trailing_coefficient()
is_SymbolicEquation()



I'll add more commands and examples on this post as I myself learn more. So, keep an eye for these updates. 

No comments:

Post a Comment