Saturday, November 30, 2019
The LEGO Group Working with Strategy
Introduction Investors must evaluate the effectiveness of their strategies to ensure they do not waste time and resources on unnecessary expeditions. The need to develop management strategies pushes managers and other senior employees to invest in research and consultations to ensure they have the relevant knowledge about various approaches used to improve performance (David 2012).Advertising We will write a custom essay sample on The LEGO Group: Working with Strategy specifically for you for only $16.05 $11/page Learn More It is necessary to explain that business strategies are not static; therefore, managers should continue to develop new approaches that will ensure the operations of their companies are relevant, acceptable and reward their factors of production. This discussion presents an analysis of a case study about how LEGO Group worked with strategy to influence its performance. Company Background The management of The Lego Group has never left the family of its founder Ole Kirk Christiansen. It was established in 1932 in Billund, Denmark and used to manufacture wooden toys, ironing boards, stools and stepladders. However, the demand and market for wooden toys surpassed those of other products and this forced this company to specialise in this line of production. Today, it is the fifth largest company in the world that manufactures plastic and to some extend wooden toys. It has been managed by Ole Kirk Christiansen, Godtfred, Kjeld Kirk and Jorgen Vig Knudstorp. A report prepared in 2012 the revenue of this company was estimated to be 2.956 billion Euros. In addition, it had an operating capital of 1.001 billion and net income of 706 million Euros. It has more than 10,000 employees working in different branches located in Germany, America, Malaysia and other countries. This company started facing financial difficulties in the 1970s and 1980s, when its future was threatened by strategic uncertainty and poor performance. It took this company more than a decade to restructure and regain its excellent performance and this highlights the need for it to evaluate important strategic management issues. Features of Its External Environment The LEGO Group has been influenced by various external environmental features that have shaped its management strategies. PESTEL, 5 Forces and strategic group models will be used to explain how this organisation has adopted different strategies in ensuring that it succeeds in developing an effective performance strategy. PESTEL Analysis This analysis examines the macro-economic factors that affected this company and led to the development of performance and management strategic plans (Schroeder and Goldstein 2010). These factors involve political, economic, social, technological, environmental and legal features that played significant roles in shaping the practices of The LEGO Group.Advertising Looking for essay on business economics? Let's see if we can help you! Ge t your first paper with 15% OFF Learn More Political factors refer to organisational aspects that were influenced by the government and which affected its activities (Reeves 2012). Denmark offered conducive conditions for the activities of this company to thrive. The education system allowed this company to supply toys that were used to enhance learning in children. This promoted the popularity of this company and ensured its products fetched good prices in the local market. Taxation policies did not affect its performance; therefore, it had ample time to concentrate on its activities without worrying about the levies imposed on its products by the government. However, environmental laws played minor roles in limiting consumersââ¬â¢ demand for plastic toys. The government required companies to use environment-friendly ways of production; therefore, this limited the popularity of plastic toys. Political stability in Denmark helped this company to perform its duties withou t interference. Secondly, economic factors like inflation, exchange rates and the oil crisis were responsible for the slow growth of this company witnessed in the 1970s and 1980s. The economy of Denmark did not grow as it was anticipated by many investors and this means that companies like The LEGO Group were forced to reduce their recurrent expenses to cushion their capital against inflation. This company registered poor sales before 2008 and this was orchestrated by a decline in the international economy. Most people concentrated on the need to reduce their budgets to cut their expenses. In addition, competitions from other companies like Mattel, Bandai-Namco, Hasbro, Tomy-Takara and MGA Entertainment forced this company to lower the costs of its toys. This company experienced economic difficulties and this forced it to sack 1000 employees in 1999. Lastly, the exchange rate of the USS weakened and traded poorly against the Danish Krone. The social factors that affected the perform ance of this company include the resistance of customers from buying plastic toys. They were used to wooden toys because of their health concerns and long life. In addition, lifestyles were changing and children wanted toys that reflected current developments in the entertainment industry. This forced this company to struggle to adopt themes and models that reflected trends in the entertainment industryââ¬â¢ for instance, the successful production and launch of Harry Porter and Star Wars led to an increase in demand for toys that portrayed the themes of these movies. However, lack of new movies in 2003 led to a slump in production and sales of this company. Moreover, children were learning very first and thus they required sophisticated toys and this threatened the lifespan of the products of this company. In addition, this company faced barriers to entry because of changes in technology. The need to shift from wooden to plastic toys meant that it had to spend more money on the p roduction and marketing of its products. However, this was not proportional to the demand for plastic toys because consumers did not receive the new products positively.Advertising We will write a custom essay sample on The LEGO Group: Working with Strategy specifically for you for only $16.05 $11/page Learn More Even though, this company innovated new products it started most of its financial calendars with high inventories in the shops and this forced it to offer discounts or wait for retailers to finish old stocks. Parents with young children are the main clients of this company and this means that it has limited ability to retain its customers. Lastly, technological factors impacted negatively on the performance of this company during the 1970s and 1980s. Consumers were reluctant to purchase plastic toys because of the need to preserve their traditional tastes. The company was at cross-roads because of the need to keep pace with the demands of moder n technology that was adopted by its competitors. In addition, toys differ depending on the era and generation targeted. This forced this company to keep inventing new techniques and modify its products to reflect changes in technology. Porterââ¬â¢s Five Forces Michael E. Porter proposed five forces that are responsible for shaping the strategies used by a company in planning its management and production processes (Pynes 2013). He defined industries depending on their attractiveness and claims that pure competitions drive organisations to get normal profits. On the other hand, attractive organisations combine the five forces of Industrial Organisation Economics (IOE) to initiate change and ensure they generate profits. The forces he identified include the bargaining power of suppliers and consumers, threats of new entrants and new products and competitive rivalry within an industry. These forces help companies to offer attractive services and products and generate higher profits than their competitors in the industry (Stevenson 2011). These forces have influenced the strategy development of the Lego Group in the following ways. Threat of new entrants refers to competition offered by other companies that wish to invest in business activities (Rosenbaum 2013). The Lego Group specialises in the production of toys that have high demand in local and international markets. This means that this industry attracts investors from different spheres. New entrants reduce market for products and services because of increased supply. In addition, they lower the prices of products in the market to attract customers and this reduces the profits generated by a company. Competition makes companies to struggle to acquire modern technology, give discounts and invest in marketing strategies to protect their brand names from copyright infringement and manipulation by their competitors. Even though, this company had established its brand name in the toy industry new entrants like Sony, Activision, Nintendo and Visual Arts were serious threats to the success of this company. Their entrance in the toy industry had huge impacts because they used sophisticated technology and produced advanced electronic games for children. The demand for Legoââ¬â¢s products was reduced because this company was unable to immediately keep with the pace of new entrants in producing new and more exciting products.Advertising Looking for essay on business economics? Let's see if we can help you! Get your first paper with 15% OFF Learn More Therefore, it was necessary for it to diversify the production of toys and formed partnerships with film, clothing and games companies. In addition, it started offering other entertainment activities like parks and social centres to market its products and diversify its risks. In addition, the threat of substitute products or services started hitting this company when it invested in plastic toys. This move had serious consequences on this company even though it had long-term benefits. Other companies like Mattel and Hasbro had started producing plastic toys and did not have serious impacts in penetrating their markets. However, this company was traditionally concerned with wooden products and this made it difficult for it to persuade its customers to buy its products. In addition, it had already saturated its market with wooden products and retailers were not ready to add new stock yet they had huge inventories of wooden toys. In addition, parks are frequented during holidays like E aster and Christmas and this means that this company had limited products and services. Therefore, it had to develop products that would be used during other times of the year. Chase boards and other indoor games were introduced and this reduced competition from substitute product. In addition, it started to focus on family games and this supplemented its sales during low seasons. The high quality of the toys produced by this company is perhaps the only factor that enabled it to retain customers. The bargaining power of customers affects the volume of services of goods a company produces. In addition, it determines the production and supply strategies organisations use to market their products. It is the ability of clients to ensure a company is put under pressure to produce quality, cheap, affordable and adequate products to satisfy their demands. The LEGO Group failed to implement a loyalty plan to ensure it reduced the power of its clients. The need to reward loyal customers is a strategy employed by most companies to ensure their clients are loyal and have minimal influence on their production processes. For instance, the resistance of customers to buy plastic toys produced by this company shows their power in controlling the activities of this organisation. This company had minimal bargaining leverage powers and this exposed it to financial uncertainties that saw it register different performance records within a short time. Buyers were not sensitive to the prices of toys, but they concentrated on the uniqueness of the products offered by all companies in this sector. Some clients preferred wooden toys because of their health advantages and durability. However, they were very few and this means that the process of adopting the production of plastic toys was inevitable. In addition, the bargaining powers of suppliers bring long-term benefits to organisations (Zenger 2013). The need to reduce operation costs enabled it to sack 1000 workers, even though the impacts of this were not realised as soon as they were expected. In addition, this company realised the need to use professional skills to ensure its production met the demands of consumer and compete effectively with other similar investments. For instance, this company decided to seek the services of experts and hired a Chief Operating Officer (COO). This helped it to develop a restructuring and cost cutting programme that reduced the number of its employees and the launch of Lego Star Wars products and opening of LEGOLAND in California. Strategic Groups This company used this strategy to reduce competition and diversify its products in the international and local market. Strategic groups are links and partnerships formed by companies that have similar activities or specialise in offering related services. This company is ranked highly in the global production and sale of toys. However, this does not exclude it from competitive rivalry witnessed in this industry since the 1940s. I t tries very hard to change its products and services to ensure consumers are offered the best value for their money. For instance, it rebranded its product name from LEGO DUPLO to LEGO EXPLORER even though this step did not have positive impacts on its sales. In addition, it established a sustainable growth programme that included the opening of its own distribution shop in the U.S. in 2003. Moreover, it started inviting users to assist and participate in the development of its products. The development of its digital strategy that led to the production and launch of its first online multiplayer game (LEGO Universe) had major positive impacts on its sales and enabled this company to attract new clients and develop trust in existing ones. The partnership between the Lego Group and Warner Bros was welcome by investors and the public because it would promote diversity in the entertainment industry. However, transparency became a serious issue in this industry as other players like Tia njin Coko Toy, Best-Lock Construction Toys and Mega Blocks infringed on the patent rights of the Lego Group brick products. Impacts of the Resources and Competencies The Lego Group is a successful company because of its large capital base that enables this organisation to invest in different approaches to boost its performance. Even though, it faced financial difficulties in 2003 that led to huge losses. It has an operating capital of 1.001 billion Euros. This capital is adequate to enable this company to invest in modern technology, research, recruitment of professional staff and market its products. New entrants do not have this amount of capital to compete with this company; therefore, the Lego Groupââ¬â¢s foot is ahead of most of its competitors. In addition, it has experienced staff and recruits professional workers in its key departments to ensure it offers quality services to consumers. The toy industry is experiencing tremendous changes, especially because of the need to incorporate various technological aspects in its products. This company has formed partnership with leading film producers like Warner Bros to ensure all latest movies are used to develop the themes of its parks. In addition, the company has invested in high cost countries and those that compete with China in political interests. This is an effective strategy of ensuring that the market for its products is protected from cheap products from China. Manufacturing products through outsourcing is another strategy adopted by this company to reduce its production costs. For instance, the company signed an outsourcing agreement with Flextronics and this enabled it to manufacture 20% of its products in Billund; therefore, other processes to be done in regions like Eastern Europe that offer cheaper options. Moreover, the management board did not fear to accommodate risks and thus it decided to order new equipment and increase production. Lastly, its foundation is based on the LEGO bricks and no matter what the global economy offers to this company it will not relent its quest to diversify its processes along this line. Redundant and dynamic capabilities of this business enabled it to regain its success in producing, marketing and selling toys. The CEOs managed to learn the demands of its customers and at the same time use current technology in manufacturing its products. Some aspects of technology may reduce the impacts of new products on consumers, but this organisation ensured there were less drawbacks associated with changes in technology used to produce toys. For instance, the procurement processes were reviewed and suppliers reduced to cut costs. Secondly, the company embraced partnership and outsourced some services like the production of some products from cheap locations to reduce operation costs. This enabled this company to sense opportunities and shape them to meet the demands of its clients. For instance, the introduction of family games was a major boost t hat ensured this company manufactured products that would fetch high demand throughout the year. In addition, its employees learn very fast and adopt new strategies like the use of modern technology in communication, marketing and distribution of its products. The CEOs effectively coordinate, integrate and use strategic resources like capital, machines, technology and companyââ¬â¢s rich history to improve the performance of this organisation. The specialisation of the companyââ¬â¢s employees, products and intellectual property provided energy and complemented the available financial assets. The combination of these assets ensured this company had a competitive advantage over other firms even if they offered cheap and a variety of products. The distinctive characteristic of this company is marked by its structure and history. It has been led by the Christiansen family and only seeks expert management in issues that are beyond their abilities. For example, the recruitment of the Chief Operating Officer in 1999 by Kjeld portrayed how this company had a unique way of outsourcing expert services in instances where its traditional managers were unable to offer quality services. In addition, it sought collaboration with other companies like Warner Bros, Flextronics and Wal-Mart to ensure its products penetrated into tough markets dominated by other giant toy producers. The VRIN strategy employed by this company involved the identification of the key resources of this organisation. This includes the huge capital that helped the company to invest in research and innovative processes to ensure it produced quality products. The identification of the capabilities of this company is a key aspect that helped CEOs to plan and execute their strategies properly. The need to combine the efforts of employees and company potentials enabled companies to rise every time they have financial difficulties (Williams 20110. 1999, was a period marked by financial difficulties that challenged the management and suitability of the operations of this organisation. It was almost being declared bankrupt and sold to the Merlin Entertainment Group. In addition, the laying off of workers was a significant step towards developing effective cost reduction and sustainable programmes that would help this organisation to be on its feet once the financial crisis of 2007 subsided. This company had strengths, weaknesses, opportunities and threats that played important roles in influencing the decisions of this organisation. First, its long standing tradition of producing wooden toys was a major strength that made it easy for this company to enter high cost markets. In addition, the introduction of modern technology offered various opportunities for this organisation to develop diversify and improve its toys. However, it faced major threats from new entrants that had huge capital, experience and resources to invest in the international market. Conversely, its management syste m was decentralised and this was a major weakness before Jorgen introduced a decentralised form of leadership that allowed other employees to participate in key decision making. Lastly, this company considers its products unique and its market sustainable. The demand for toys will never fade because people will continue to give birth and create new market for the products of this company. It is necessary to explain that this company aspired to maintain the value chain of its products to ensure it embraces a unique way of marketing. This will help it to compete effectively with similar companies and reduce confusion associated with brand names and qualities (Slack, Chambers and Johnston 2009). Alternative Strategies This company focuses on the internal mechanisms of generating capital and this is why it has limited abilities to expand and explore international markets. Therefore, it should consider other ways of generating additional capital through the following ways. First, it has a well established history and no financial institution can deny it loans to boost its working capital. This is a simple way of ensuring the company has adequate funds to manage its activities and invest in technology, research and recruitment of professional workers (Martocchio 2012). Additional capital helps companies to explore investment opportunities in foreign markets. It is not easy for a poor or newly established organisation to penetrate into new markets if it does not have the financial muscles necessary to manage the impacts of competition, inflation and the need to observe local conditions that allow investors to achieve their objectives. Moreover, the huge capital enabled this organisation to mitigate the effects of inflation and competition that causes huge inventories in retail outlets. This strategy helped this organisation to manage various economic challenges that affected it in 1999 and 2003. Secondly, this company can merge with other similar organisations that a re struggling to succeed in toy manufacturing. Mergers enable companies to boost their capital because it injects additional funds that will help strengthen their financial bases. Moreover, it is necessary to explore the skills and abilities of different specialists from other companies because this enables companies to produce quality products and services. The need to equip employees with the relevant skills and knowledge regarding various operations highlight the importance of merging with companies that have experience, skills and knowledge that are relevant in this industry. It is necessary to explain that this company will reduce its operation costs if it merges with another company. It will enjoy economies of scale and diversify its marketing strategies to promote its products. Different companies use different ways to market their products and this will be imported to this organisation if it decides to merge with such investments. The cost of purchasing modern equipment is v ery high and most organisations cannot afford to acquire new machines after every few years. This means that they must seek the assistance of other organisations so that they can reduce their expenses. This means that merging with other organisations will ensure this company acquires modern technology without incurring huge expenses. In addition, it can acquire small firms to ensure it expands its ability to market toys in all regions. This is an effective way of minimising the influences of its competitors in international markets. Acquisitions enable organisations to get huge assets (physical, human and financial) that are available within a short time. This enables companies to get already established investments and boost their performance. Moreover, it has to diversify its management and develop a decentralised strategy that will ensure all key employees play important roles in making the decisions of this company. Decentralisation of management will delegate responsibilities t o workers and this will ensure every employee contributes his or her skills, experience and time to the success of this company. Lastly, this company can outsource some of the services it has not attained professional experience in it. This includes web hosting, call centres and some roles of the human resource department. This will enable this company to get professional services from qualified and experienced services from other firms. In addition, it will reduce the costs of recruiting workers and ensure this company focuses on its core competencies. Extent of LEGOââ¬â¢s Strategy Orientation The Lego Group is a highly strategy oriented organisation and most of its plans seem to bear fruits and give it a head-start when competing with others. In addition, it failed and managed to rise in different occasions and has never been on its toes since it started its operations. The strategies executed by its current and last two CEOs continue to yield good results for this organisation and enable it to generate profits, diversify products and services and control the impacts of competition on its markets. It is evident that this organisation has employed strategic management practices that ensure its practices reflect the demands of its consumers. The introduction of plastic toys was a major investment that was supposed to transform the performance of this organisation. However, this did not happen as it was expected and the company decided to focus on introducing new models and children parks to diversify its investments and cushion itself from imminent collapse. References David, R. F 2012, Strategic Management Concepts and Cases, Pearson, New Jersey. Martocchio, J. J 2012, Strategic Compensation: A Human Resource Managementà Approach, Prentice Hall, New Jersey. Pynes, J. E 2013, Human Resources Management for Public and Non-profità Organizations: A Strategic Approach (Essential Texts for Non-profit and Publicà Leadership and Management), Jossey-Bass, New Jersey. Reeves, A 2012, Telecommuting ââ¬â A Guide on How to Be a Successfulà Telecommuter, Anthony Reeves, Washington. Rosenbaum, J 2013, Investment Banking: Valuation Leveraged Buyouts, and Mergersà and Acquisitions, Wiley, New York. Schroeder, R. and Goldstein, S 2010, Operations Management: Contemporaryà Concepts and Cases, McGraw-Hill, New York. Slack, N., Chambers, S. and Johnston, R 2009, Operations Management andà MyOMLab, Prentice Hall, New Jersey. Stevenson, W 2011, Operations Management (Operations and Decision Sciences), McGraw-Hill, New York. Williams, T 2011, Mergers and Acquisitions, Cases and Materials, Aspen Press, New York. Zenger, T. (2013). Strategy: The Uniqueness Challenge, Harvard Business Review, New York. This essay on The LEGO Group: Working with Strategy was written and submitted by user Alissa P. to help you with your own studies. You are free to use it for research and reference purposes in order to write your own paper; however, you must cite it accordingly. You can donate your paper here.
Tuesday, November 26, 2019
The Promise and Peril of Editing in Proof
The Promise and Peril of Editing in Proof The Promise and Peril of Editing in Proof The Promise and Peril of Editing in Proof By Mark Nichol Which method of editing is the most effective one? Which content formats should be employed, and how many iterations are necessary? Ultimately, what works for the publisher is the best approach, but consider that what is most expedient is often at odds with what is best. Until a generation ago, typewritten manuscripts were edited on paper: Editors would mark changes with a pen or pencil, and writers would type (or hire someone to type) a new version; this process might be repeated at least a couple of times, as the manuscript underwent first developmental (comprehensive thematic and structural) editing and then copyediting (the nuts and bolts of word style and usage and of grammar and syntax, or sentence formation). The last iteration would then be given to a typesetter, who would transcribe the text using a word-processing device, incorporating the last set of penciled-in revisions as he or she went along, and would format it according to its intended mode of presentation. A proof, or a facsimile of the manuscriptââ¬â¢s intended published appearance, would then be printed out, and a proofreader would check the proof against the final typed version, glancing back and forth ad infinitum to check for typographical errors as well as duplicated, omitted, or misplaced text and for formatting errors. The typesetter would then enter corrections and print out a new iteration, and the proofreader would spot-check the corrected elements and passages. This exchange would then be repeated if and as necessary. (Some publishers, notably the National Geographic Society, paired two people: one to read the original final manuscript aloud while the other checked the corresponding proof text and marked any errors observed.) As desktop publishing evolved, this process was streamlined: Editors revised directly in content files using simplified word-processing programs such as Microsoft Word. And because the content was copied and pasted into the proof file, rather than laboriously typed, proofreaders no longer had to compare proofs against the manuscript word for word; they merely examined the proofs for errors, consulting the manuscript only occasionally for clarification if at all. Early on in this new paradigm, the proofreader would mark a printout of the proof, and a member of the publicationââ¬â¢s production staff, or a freelance graphic designer or production artist, would enter the changes and then generate a new iteration of the proof, and the proofreader or another person would check corrections. Then, in the last few years, it became easier for proofreaders to revise proofs themselves using programs such as Adobe Acrobat. Ultimately, some publishers have decided to occasionally or routinely forgo the manuscript-editing process (either the copyediting stage alone or both developmental editing and copyediting) and ââ¬Å"flowâ⬠the writerââ¬â¢s raw (or developmentally edited but not copyedited) manuscript directly into proof, then have it edited when it is already in its formatted form. This certainly saves much time and effort, but it also complicates the process, because developmental editors and copy editors must then maintain the parameters of the copyfit- they cannot insert, omit, or relocate content without perhaps significantly altering the layout, which may require more time and effort by design and/or production staff. If the editor is given authority to copyfit as needed, he or she can revise the text so that it fits the format, but this may compromise the quality of the content because of the limits of that format. I have edited and proofread content that appears in all these manifestations, starting out by editing my college newspaper using a manual typewriter, Wite-Out, scissors, and red pencils. A few of my contemporaries still prefer to mark up a piece of paper, but I have embraced the expeditious advantages of editing in proof (though for most of my employers and clients, I continue to edit in Word and proof in Acrobat), and I predict that this strategy will soon be the norm. But publishers, from mom-and-pop marketers to multinational corporations, must weigh the benefits and drawbacks and take care not to cut corners by, say, minimizing comprehensive reorganization and revision of a manuscript because it doesnââ¬â¢t adhere to a templated publication format or eliminating copyediting and proofreading because they are costly, time-consuming steps. Too many publications already suffer, sometimes egregiously, from a de-emphasis on (or even outright dismissal of) the editing process, and the art of turning a competent composition into a compelling one must not be suborned to an efficiency that ignores the crucial factor of quality. Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Writing Basics category, check our popular posts, or choose a related post below:Coordinating vs. Subordinating Conjunctions75 Idioms and Expressions That Include ââ¬Å"Breakâ⬠Parataxis and Hypotaxis
Friday, November 22, 2019
10 Types of Wordplay
10 Types of Wordplay 10 Types of Wordplay 10 Types of Wordplay By Mark Nichol Humorous works of fiction are easily enlivened when the author resorts to one or more of the following categories of playing with prose: 1. Acronyms: An acronym is an abbreviation consisting of a string of initial letters pronounced as a word. Fictional examples, such as SPECTRE (for ââ¬Å"Special Executive for Counter-intelligence, Terrorism, Revenge, and Extortionâ⬠), from the James Bond novels and films, and VILE (for ââ¬Å"Villainsââ¬â¢ International League of Evilâ⬠), from the Carmen Sandiego computer-game series, can be serious or humorous depending on formation and intent. 2. Anagrams: An anagram is simply a word with its letters scrambled in a new order. Many humorous phrases have been derived by scrambling expressions or peopleââ¬â¢s names, such as forming ââ¬Å"I am a weakish spellerâ⬠from ââ¬Å"William Shakespeare.â⬠(Anagram generators can be found on the Internet.) 3. Chronograms: A chronogram is a phrase in which constituent letters also express a number, as in ââ¬Å"My Day Closed Is In Immortality,â⬠an epitaph for Englandââ¬â¢s Queen Elizabeth I in which the first letter of each word corresponds to a Roman numeral; the numerical sequence, MDCIII, is translated as 1603, the date of her death. A weak variant is a habit of filmmakers (or, more accurately, film marketers) of replacing one or more letters in a movie title with a number vaguely resembling the letter or otherwise related, as in the title of the 1995 crime thriller Seven, represented on posters as Se7en. 4. Initialisms: Initialisms are distinguished from acronyms by the fact that the constituent letters are pronounced individually, rather than sequentially sounded as if they were a single word. Many popular social-networking terms such as LOL (ââ¬Å"laugh out loudâ⬠) and ROTFL (ââ¬Å"roll on the floor laughingâ⬠) are initialisms; so is TEOTWAWKI (ââ¬Å"the end of the world as we know itâ⬠). 5. Lipograms: A lipogram is a composition deliberately consisting of words lacking a letter of the alphabet. Such a work is more or less easily accomplished depending on the letter selected for omission; many writers, astonishingly, have written novels produced without recourse to use of a common letter such as e or t. 6. Malapropisms: This type of wordplay refers to misuse of one word for another by those too ignorant to recognize the error. Itââ¬â¢s named after Mrs. Malaprop, a character in an eighteenth-century play who is notorious for such unwitting utterances, as exemplified by the characterââ¬â¢s line ââ¬Å"Sheââ¬â¢s as headstrong as an allegory on the banks of Nile.â⬠Shakespeare also employed such humor, most notably in lines by the character Dogberry in Much Ado About Nothing such as ââ¬Å"Our watch, sir, have indeed comprehended two auspicious persons.â⬠7. Mondegreens: Misunderstood song lyrics are often referred to as mondegreens; the term itself is based on a mishearing of the phrase ââ¬Å"laid him on the green.â⬠A more recent example is ââ¬Å"Excuse me while I kiss this guy,â⬠rather than ââ¬Å"Excuse me while I kiss the sky,â⬠from the Jimi Hendrix song ââ¬Å"Purple Haze.â⬠8. Onomatopoeias: Onomatopoeias (the term is from the Greek words for ââ¬Å"makeâ⬠and ââ¬Å"nameâ⬠) are words that imitate sounds, such as splash or bump. A notable example of an onomatopoeic proper name is that of the Houyhnhnms, the sentient, civilized horses from Jonathan Swiftââ¬â¢s Gulliverââ¬â¢s Travels. 9. Portmanteaus: Portmanteaus, words creating by combining two words and their meanings into one, were named and popularized by Lewis Carroll. He coined several, such as slithy (from lithe and slimy); more recent examples include brunch and smog. (Carroll named the form of wordplay after a word for a suitcase with two separate compartments.) 10. Spoonerisms: The term for expressions in which initial letters, or sometimes entire syllables or words, are transposed is based on the name of a British clergyman supposedly prone to such utterances, though many attributed to him were only inspired by him. Among them is ââ¬Å"a well-boiled icicleâ⬠for ââ¬Å"a well-oiled bicycleâ⬠; John Lennon is credited with coining a variation on ââ¬Å"Time heals all woundsâ⬠: ââ¬Å"Time wounds all heels.â⬠Want to improve your English in five minutes a day? Get a subscription and start receiving our writing tips and exercises daily! Keep learning! Browse the Vocabulary category, check our popular posts, or choose a related post below:50 Incorrect Pronunciations That You Should AvoidConfusing "Passed" with "Past"Confusion of Subjective and Objective Pronouns
Wednesday, November 20, 2019
Forensic Science Essay Example | Topics and Well Written Essays - 1000 words
Forensic Science - Essay Example The evidence which is collected by forensic experts is tested in a forensic toxicology lab, which contains sophisticated instruments. These instruments, along with precise methodologies hold importance in producing a toxicology report, because these reports are presented in court and their results are important in determining the sentence of a person (Hagedorn, 2011). However, toxicology is not limited to criminal investigations only, in fact, they are used in cases which involve environmental contamination, to determine what would be the impact of a spill, if it is near a population. Forensic Toxicologist needs to be prepared to testify in court and justify his findings and to explain methodologies which may seem complex to the jury. Before toxicologists conduct their process, they would need samples from the body under consideration. Toxicology is useful because of how it helps, particularly, the law enforcement authorities. Toxicologists collect samples from the body and then study them in the lab; they give a report about all the chemicals found in the body, alcohol, prescription drugs and illegal drugs. In fact, toxicologists can also find out if the personââ¬â¢s death has resulted because of poison or not. For example, hair samples from a body could be tested to see if the person has been involved in drug abuse for a long time or a short time. Saliva can also be used to test for the use of drugs. The Death Investigation Toxicology is also known as the Postmortem technology, where forensic toxicologists work with examiners and coroners to determine if the cause of a death, there has been involvement of alcohol or drugs. Human performance toxicology is about the effects of alcohol and drugs on the behavior of people. This could include investigations related to impaired driving, sexual assault, which is facilitated by
Tuesday, November 19, 2019
Resolving Landfill Problem Coursework Example | Topics and Well Written Essays - 1250 words
Resolving Landfill Problem - Coursework Example Environmental inequality usually rises when a community determines the rate at which it can pollute the environment without considering sustainable development measures. The attitude that is resistive to change in the environmental policies is considered by many to be anti-urban. Unfortunately, the most sensitive issue of the environment as both the people with color, without color, flora, and fauna depend on the Mother Natureââ¬â¢s environment has been ignored or made to look racist. This problem is mostly felt in the cities due to the large population dwelling in them. Due to this fact that with a large population there comes great responsibility that seems to be sadly ignored as the skies continue to turn black and brown in color. Efforts to change this by the environmentalists have been greatly sidetracked by the issues of racial ideology that seems to be predominantly in the people minds. It is unfortunate that the color of the skin determines who make the policies and those to implement them in the American society. In order to improve cumulative assessment, there are several factors that we must take into consideration. These factors include factors for us to achieve a sustainable urban planning. Hence, the community involvement is very important in determining the social, economic, and cultural parameters for any cumulative risk assessment. This will help us develop some more questions on the cumulative risk assessment and answer some questions. Currently, the landfill contains class II landfill that deals with construction debris. It is believed that the construction of Ngamia 1 and Ngamia 2 is expected to increase revenue for the State as these landfills will be more spacious and huge.Ã
Saturday, November 16, 2019
Fallout Book Report Essay Example for Free
Fallout Book Report Essay P.S. I am sorry the summary is so long but I wanted to make sure everything in the book was covered and there being 3 people makes it 2 times longer. The novel is a memoir of the lives of three children of a meth-addicted mother, Kristina, and how her addiction affected their lives. They now live in different homes, with different parents, as well as different last names. Each of them has a different story, some more fortunate than others. Hunter knows about his sisters and new younger brothers, while Summer knows about her brothers and Autumn knows nothing. It starts with Hunterââ¬â¢s story; adopted and raised by his biological momââ¬â¢s mother and stepfather. He refers to his adoptive parents as Mom and Dad. He works at a radio station in Reno, Nevada. His girlfriend, Nikki, supports him in everything he does. As Christmas approaches, he is living with Nikki and having relationship troubles. Hunter is doing drugs more frequently, and cheats on Nikki with a persistent radio groupie. All the while, Hunter is feeling like a piece of him is missing because of the lack of knowledge about his father. When he sees him, he knows, but his father is the date of his coworker, Montana. Hunter then gets drunk and calls Brendan (his father) out on his actions about how him raping Kristina produced Hunter. Once that situation is in the past, another problem occurs, as Hunter is approached by Nikki, who hears a voicemail left by Leah on Hunterââ¬â¢s phone about the cheating incident. He is kicked out of Nikkiââ¬â¢s house and takes the guestroom in his parents house because, thanks to Kristina, his two younger brothers, David and Donald, have moved in and taken his room. Shortly after Hunter has moved back in, he is notified that Kristina will be spending Christmas with them. Autumnââ¬â¢s story takes place at her grandfatherââ¬â¢s house in Texas. Her OCD (obsessive-compulsive disorder) and frequent panic attacks make her a loner at school, so her best friend is her Aunt Cora. Although she promises Autumn they will always be friends, she is wooed by her massage therapist professo r and taken away from her. A new boy comes to her school and is immediately taken with her. She has a hard time opening up to him and even tells him her parents are dead. His name is Bryce and he ends up being Autumnââ¬â¢s first boyfriend, first kiss and first time. When her aunt announces her engagement, the happiness she gets from her new boyfriend fades and she feels alone. Desperate to make sure he stays with her, she has sex with him without protection. Realizing that being drunk makes everything easier to deal with, she begins drinking to make herself feel better. Her fathers and grandmotherââ¬â¢s interruption at Aunt Coraââ¬â¢s wedding only makes things worse, bringing her past to her present; then, Bryce finds out her parents arenââ¬â¢t dead. Devastated about the lying, Bryce leaves Autumn, and to make matters worse her drinking has gotten out of hand and she is almost raped by the groomââ¬â¢s cousin, Micah. The wedding ends when Autumn realizes how lonely she is and begins to wish she is pregnant, and her father finds her and tells her how she came to be. In the process, he convinces her to go to Reno for Christmas to see the mother she never knew. The California foster system took Summer away shortly after living with her f ather when they were abandoned by Kristina. She knows everyone in her family except for Autumn. Her fatherââ¬â¢s ex-girlfriends have molested and used her, causing her to be thrown in different homes with different problems. Her life is pretty stable in one home until one of the meth-using girls that also lives there molests one of the younger girls; it hits close to home and she is unable to control her anger. She gets in a fight with the meth girl and ends up getting sent to live back with her father and his girlfriend of the moment. The day after the fight, her boyfriend, Matt, saw her face and offered no sympathy, so she ran to his best friend, Kyle, who always showed interest. She ends up cheating on her boyfriend with Kyle by having sex with him. She knows that Kyle uses meth and other drugs but his loving nature has drawn her in. When he and Summer confront Matt about their newfound relationship, she sees the side of Kyle she never wanted to and realizes his addiction and anger may cause problems. The living conditions at her fatherââ¬â¢s house arenââ¬â¢t the be st; the constant smoking irritates her asthma and as Thanksgiving approaches, she starts to miss Kristina. She calls her, but canââ¬â¢t remember why; she was blown away by her motherââ¬â¢s selfishness and when her father is drunk later that night, he reveals that Kristina only cares about herself. Her father being drunk proves to be a much worse situation than just spilling the truth; his drinking costs him a DUI and he loses Summer. She is sent to another home in Fresno. Leaving her boyfriend and life behind, she is unwilling to move far away. When she gets to her new home, she is immediately taken aback by her new foster father. His demeanor worries her and makes her wonder what secrets the other girls in the house might have. She knows from experience not to get close to the other girls in the house, but one of the girls tells Summer her secrets and becomes attached to her. During the few days Summer is there, she hides her cell phone and planned to meet Kyle. When she sneaks from under her foster sisterââ¬â¢s watch long enough to escape, she ends up running away with Kyle for Christmasââ¬âhe is so in love with her that he even attempts to stop using meth for her, which means suffering through withdrawal. She and Kyle save up money and live out of his car while they head to a ski lodge, where Kyle plans to work. The stories collide when Kyle and Summer get in a car accident and the closest place to them is Reno, Nevada. Summer ends up calling her grandfather to pick her up from the hospital the morning after the blizzard hit and the accident happened. Hunter is out picking up Kristina and his grandfather from the airport after spending the early morning making up with Nikki. He knows that things wont quite be merry and joyful Christmas morning with the whole family being together. Autumn and Trey show up before Summer gets there and when Trey sees Kristina, they are immediately drawn to each other and spend most of the day before dinner talking to each other. Summer tries to be sisterly to Autumn and Autumn doesnââ¬â¢t know what to make of all of it. When dinner starts, David asks when heââ¬â¢ll be going home and Kristina says she doesnââ¬â¢t know; Donald gets angry and tells her he never wants to go backââ¬âthat he never wants to be with her again. Hunter is the first one to jump up when Kristina acts offended and he yells at her, telling her the only person responsible for what happened to her was her. Summer jumps in the argument too when Kristina begins to complain that she doesnââ¬â¢t have the resources to take care of her kids or give them a good life. The book ends with a newspaper article saying Marie Haskins has put her new book ââ¬ËMonsterââ¬â¢, on indefinite hold while Kristina is undergoing chemotherapy for cancer. At this point, Kristina has reunited with her husband, Trey, and with her resources, she is trying to make her life better so she can be the mother she has never been. I canââ¬â¢t personally connect to this book but I can emotionally connect to this book. I have a friend in my life that I like a brother to me and he has parents just like hunter, autumn and summer. Drugs are a very personal matter and mess up your life more than anyone can know until it happens to you. I felt what he felt becaus e he is such a dear friend that all I could do was worry about him and wonder how he was doing in that new foster home he was moved to. I always heard all about the stories and the way he was in the foster home. He said it wasnââ¬â¢t easy and it was painful to know that everyone he loved had bailed out on him. He soon developed many of the problems these kids experienced with drinking and doing other drugs. This life isnââ¬â¢t easy from what I have heard. This book is very easy to relate other books by Ellen Hopkins because all of the books I have read by her seem to be about drugs and complications in life including hardships and suffering. I donââ¬â¢t really watch movies in this type of subject but I did hear that there is supposed to be a movie coming out based on the crank series by Ellen. Iââ¬â¢m not sure whether itââ¬â¢s out or not but the books are great and movies tend to ruin the reading of the book. Both crank and glass led up to this point in the book series and was consistent throughout the storyline of all three books. There is so much drug abuse in the books and making right decisions is not one of Kristinaââ¬â¢s strong points. I believe that the theme of this book is that drugs can ruin lives especially to the young girls out there. The plot of this story is to tell a story from the perspective from the 3 abandoned children that Kristina left behind. There storied tell about the hardships they went through and how life was for them during this painful teenage years. Even though the plot wasnââ¬â¢t very funny, it is very intriguing and interesting to find out what makes people do this to their own children and why they do the things they do. This story is told from the three kids point of view. And it switched off every so often so it was very suspenseful. The setting of this book is in three different places considering the three different points of view. Huntersââ¬â¢ setting was in Reno while Autumnââ¬â¢s setting was in Texas and Summerââ¬â¢s setting was anywhere the foster system took her. In my personal view the climax of the story was when all three of the children met for the first time and got to be a family together. In conclusion, I would recommend this book to anyone that enjoys reading this type of book seeing as how it has sex and drugs in it. I would definitely restrict this book to anyone under the age of 15 or 16. This book is a lot more profane then the others and I feel that you should be at least old enough to understand the meaning and why the book is how it is. Not many people judge books but I would definitely recommend this book to anyone who wants a good read and interesting enough to make it to when you put the book down you canââ¬â¢t wait to pick it back up. I truly feel her books are amazing and make you see how messed up some situations are.
Thursday, November 14, 2019
The Victorian Butler :: Victorian Time Period
The Victorian Butler Colonel Mustard: ââ¬Å"Are you the host?â⬠Wadsworth: ââ¬Å"Me, sir? No, I'm just the humble butler.â⬠Colonel Mustard: ââ¬Å"And what exactly is it you do here?â⬠Wadsworth: ââ¬Å"I buttle, sir.â⬠In Victorian times having a house full of servants at the owner's command was quite common for upper and middle class families. Some job titles included footman, cooks, maids, butlers, coachman, and cooks. Among these servants, the highest ranked and paid was the butler. While we all may have a stereotype of a tall, skinny man that opens the door and says, ââ¬Å"You rang?â⬠the actual list of duties and responsibilities of a butler express he is a man of high demand. The Butler of a home was expected to be present during breakfast, lunch, and dinner. He was to serve the meals and drinks to each member of the family and to wait on them for any requests. He also had the responsibility to oversee the kitchen and make sure it was in order. This included choosing fine wine, managing the wine cellar and the inventory of liquors. The Butler worked closely with the cook and not only assisted with preparing a menu for everyday meals but also for upcoming events and parties the master may present. He was expected to set the table and the decorations for all parties. During these events the butler was always present awaiting any requests from the guests and served them drinks and their meals. The Butler also was responsible for other servants in the home and acted as a manager for the property. The average pay for a Victorian butler was between 40 to 100 pounds per year, which converts to about 2600 to 6500 today. Charles Dickens, Jr. gave this advice in 1879: ââ¬Å"Give good wages, and let it be clearly understood before hiring that no perquisites are allowed. A serious mistake, and one too often made, is to lay down the hard-and-fast rule 'no followers allowed'. Servants always have had and always will have followers, whether their masters and mistresses like it or notâ⬠(n.pag.). In Vanity Fair, we read that Miss Horrocks also serves in the house because she is the daughter of the butler. Miss Horrocks acted as a maid in the Crawley's home. Housemaids during the Victorian times were responsible for keeping the home clean and tidy. They did the ââ¬Å"cleaning, scrubbing and dustingâ⬠(Roberts 206). The number of housemaids was determined by the size of the home.
Monday, November 11, 2019
Children of Incarcerated Parents
Effects on Children of Incarcerated Fathers Most of the prisons in America are overcrowded. They are overcrowded with men, most of which are fathers and nearly half of these incarcerated fathers were living with their child or children before going to prison. The effects on these children can be detrimental. This can also cause strained relationships with the mothers or other family members doing their best to take care of these children while their father is away.There can be social as well as emotional problems, but luckily there are many states that are trying to accommodate for the parent being gone with programs and camps for these children. Many social issues occur with a child of an incarcerated father as they grow older. It is common knowledge that if a parent or any caregiver disappears from a childââ¬â¢s life, that childââ¬â¢s attachment to that person will diminish. It is hard to establish a childââ¬â¢s trust and takes time, so if a parent disappears that the chil d has depended on, it can affect the future of the child.He/she may grow up thinking they cannot get too close to someone, fearing theyââ¬â¢ll lose that person. A lot of behavioral problems can also occur in a child. This may happen at home, in school, or in the streets. ââ¬Å"Absence of the father is associated more with ââ¬Ëacting outââ¬â¢ behavior (such as hostility, use of drugs or alcohol, running away, school truancy, discipline problems, aggressive acts and involvement in delinquent activities (Rosenburg 2009). â⬠Being antisocial is looked at as a list of multiple behaviors that disrupt normalcy. As the child of an incarcerated parent grows to be an adolescent, there may be even more social problems.Now the child is growing up and can get into more trouble for their social deviance. When it comes to getting in trouble, they may use excuses to cause them to get into more trouble. After all, what excuse is better than, ââ¬Å"My dad did it? â⬠It is very sa d when kids are isolated socially from their peers because of their situation; even when it is not their fault. There was a study done in Oregon with 22 children with incarcerated fathers. Within this group, six children admitted they had no friends and four of these children said other parents would not allow their kids to play with them because there ââ¬Å"dad was in jail. These children grow up with feelings of shame, embarrassment, and mixtures of hope and fears of their relationships with their fathers, which leads them to be treated differently as they grow older. A father being gone in prison is also a huge financial strain on their families. Whether it be from the father having a job (legal or illegal), the family still depends on that income to help support the family. A lot of families need help through Public Aid to get through these difficult times. The family turns to food stamps, medical assistance, and child care assistance.There are also many emotional issues that o ccur for a child dealing with a father in prison. Sometimes the child or children stay with another caregiver while their father(s) is/are in prison. It becomes way harder for the mother alone to maintain a household if she has relied on the father for help and support. This can cause emotional problems with the caregiver the child is staying with. There are many kids that are taken care of by their grandparents, other relatives, friends, or even foster care.These kids can become unstable very quickly because if there is no relative to take care of them, they have to immediately be placed in foster care because they become dependents of the juvenile court. They are automatically thrust into a more stable household, but because that is what they are not used to, their personalities become shaky. ââ¬Å"The 1980 Federal Adoption Assistance and Child Welfare Reform Act mandate that children who are placed in foster care must either be returned to their parents or placed with long-term guardians within 12-18 months (Hairston 2007). This gives the parents a chance to fix what they have done and realize what they are doing to their children, so they do not have to go through more emotional hardships. When abruptly removing a child from their father is ignoring the emotional needs of that child/children. They end up feeling vulnerable, alone, and frightened While being a father in prison, it is still necessary to establish a parental connection with their son or daughter. It has been said that it is most beneficial to have both parents in the childââ¬â¢s life. They must create their own role even though they are behind bars.A study showed that most incarcerated fathers have feelings of ââ¬Å"helplessness and difficulties in being a ââ¬Ëgood father (Rosenburg 2009). â⬠There are many reasons why the fathers may feel this way. A lot of mothers refuse to bring the children to a prison or jail, but a lot of mothers may have a problem with finances, transporta tion, or time. There are strict rules and codes to follow when visiting a prisoner, so it would be difficult for a child to act normally with their father. Waiting times can be long, children will be frisked, and chances are it will be hot, dirty, and crowded.The caregiver may say that is emotionally scarring and the visiting can have a bad influence on the child. When a father is sent away, he is not sent to a prison in accordance with the familyââ¬â¢s home. For those that are close, they are lucky, but if a person is in the stateââ¬â¢s Department of Corrections, they can be sent anywhere in the state. When these fathers are taken away, the children receive little or no support on how to deal with their grief, loss, anger, shame, and fear. Depending on where the father is in prison, different programs can be available.There are parent education courses- which most prisons teach special parent-child visits, child-oriented visiting activities, parent support groups, and custody and parental rights services. These programs are designed to develop and strengthen attachments, provide access to services, and address the issues that face the incarcerated parent when it comes to parenting. There is also a service for father behind bars that provides publications on self-help support groups. It serves many prisons with incarcerated fathers in the US and Canada.There are more and more states doing something to lessen the impact of a parent going to prison on the child. States are now addressing the needs of a child at the time a parent is arrested. New laws are now requiring more extensive training to ensure the safety of a child at the time of arrest. Some states are also requiring judges to now consider the effects of a parentââ¬â¢s incarceration on the child. ââ¬Å"One Tennessee judge routinely requests that a video of the father interacting with the child accompany family impact statements (Christian 2009). Some policies are being imposed to require child -friendly visiting areas within prisons and jails, training correctional officers to have a better understanding of visiting children, and reducing the cost of maintaining contact. Welfare agencies in New York are now requiring arrangements to be made for the child to keep a meaningful relationship with that child, unless there is clear evidence that a relationship would be detrimental to the child. These arrangements would include transportation and providing social and rehabilitative services to resolve or correct the roblems which prohibit normal contact with the child. Most normal parenting classes do not meet the needs of incarcerated parents. If these programs want to succeed in decreasing criminal activities, they need to be more specific to maintaining a presence in a childââ¬â¢s life. There are nurseries and different accommodations for mothers that are incarcerated, so why not fathers? In New York, there is a facility called The Bedford Hills Correctional Facility. They also have a childrenââ¬â¢s center with their own building, which allows overnight and summer visits for older children.There are inmate caregivers that work as associates in the center, which have gone through an accredited program that prepares graduates to teach in an accredited nursery anywhere in the country. There is a dayroom designed for the kids to play and the other inmates to form new friendships. It is an excellent opportunity for these children to make new friendships with other children going through the same thing. Why should these only be applied to women inmates with children? It is no surprise that fathers are just as important in a childââ¬â¢s life as a mother is.If there were more daycare centers for menââ¬â¢s prisons, there would probably be less violence and problems within the population of the prison. If the Department of Corrections would give these men an incentive for their good behavior to see their families in a more ââ¬Å"home-likeâ⬠sett ing, there would be a lot less lockdowns. Many issues occur within a child when their father goes to prison. There will be social and emotional problems, including anger, depression, shame, and guilt. They will be socially isolated and for any child, that is not a positive thing in their life.Although these issues have been going on for a long time, states are now presenting new laws and implications for families with an incarcerated father. Little changes in the judicial system will help keep these kids out of trouble and continue to maintain a strong relationship with their father. Having two parents is the best basis for raising a child and even if one of the parents is absent, it is still best to maintain a paternal bond with the child. As a single mother of a child that has been raising a child going through this, I have constantly kept in contact with my daughterââ¬â¢s father.I understand the importance of having a family and one day, they will be able to have a normal rela tionship with each other. I understand the programs and meetings he attends in the prisons within the Illinois Department of Corrections to become a better person and a better father. If I donââ¬â¢t believe in him, his daughter will never believe either. I have admired my dad ever since I can remember and I want my daughter to feel the same way about her father as I always have. References Christian, S. (2009, March).Children of incarcerated parents. Retrieved January 30, 2013, from http://www. ncsl. org/documents/cyf/childrenofincarceratedparents. pdf Hairston, C. F. (2007, October). Focus on children with incarcerated parents. Retrieved from http://www. fcnetwork. org/AECFOverview%20of%20the%20Research%20Literature. pdf Shlafer, R. J. , & Rosenburg, J. (2010). Attachment and caregiving relationships in families affected by parental incarceration. Attachment & Human Development, 12(4), 395-415. doi:10. 1080/14616730903417052
Saturday, November 9, 2019
Sage 50 Accounting Software Tutorial
Sage Tutorial Release 5. 3 The Sage Development Team September 10, 2012 CONTENTS 1 Introduction 1. 1 Installation 1. 2 Ways to Use Sage . . 1. 3 Longterm Goals for Sage . . 3 4 4 4 7 7 9 10 13 18 21 24 26 29 33 38 39 41 51 51 53 54 54 55 56 57 58 60 61 62 65 65 66 67 68 2 A Guided Tour 2. 1 Assignment, Equality, and Arithmetic 2. Getting Help . 2. 3 Functions, Indentation, and Counting 2. 4 Basic Algebra and Calculus . . 2. 5 Plotting . 2. 6 Some Common Issues with Functions 2. 7 Basic Rings . . 2. 8 Linear Algebra 2. 9 Polynomials . 2. 10 Parents, Conversion and Coercion . . 2. 11 Finite Groups, Abelian Groups . 2. 12 Number Theory . . 2. 13 Some More Advanced Mathematics 3 The Interactive Shell 3. 1 Your Sage Session . . 3. 2 Logging Input and Output . 3. 3 Paste Ignores Prompts 3. 4 Timing Commands . . 3. 5 Other IPython tricks . 3. 6 Errors and Exceptions 3. 7 Reverse Search and Tab Completion . . 3. 8 Integrated Help System . 3. 9 Saving and Loading Individual Objects 3. 10 Savi ng and Loading Complete Sessions 3. 11 The Notebook Interface . . 4 Interfaces 4. 1 GP/PARI 4. 2 GAP . . 4. 3 Singular . 4. 4 Maxima i 5 Sage, LaTeX and Friends 5. 1 Overview . . 5. 2 Basic Use . . 5. 3 Customizing LaTeX Generation . . 5. 4 Customizing LaTeX Processing . . 5. 5 An Example: Combinatorial Graphs with tkz-graph . 5. 6 A Fully Capable TeX Installation . 5. 7 External Programs . 71 71 72 73 75 76 77 77 79 79 80 81 81 82 84 85 86 86 88 91 93 93 94 95 97 97 99 101 103 105 6 Programming 6. 1 Loading and Attaching Sage ? les 6. 2 Creating Compiled Code . 6. 3 Standalone Python/Sage Scripts . 6. 4 Data Types 6. 5 Lists, Tuples, and Sequences 6. 6 Dictionaries 6. 7 Sets . 6. 8 Iterators . . 6. 9 Loops, Functions, Control Statements, and Comparisons 6. 10 Pro? ling . 7 Using SageTeX 8 . . Afterword 8. 1 Why Python? . . 8. I would like to contribute somehow. How can I? . 8. 3 How do I reference Sage? . 9 Appendix 9. 1 Arithmetical binary operator precedence . . 10 Bibliography 1 1 Indices and tables Bibliography Index ii Sage Tutorial, Release 5. 3 Sage is free, open-source math software that supports research and teaching in algebra, geometry, number theory, cryptography, numerical computation, and related areas. Both the Sage development model and the technology in Sage itself are distinguished by an extremely strong emphasis on openness, community, cooperation, and collaboration: we are building the car, not reinventing the wheel. The overall goal of Sage is to create a viable, free, open-source alternative to Maple, Mathematica, Magma, and MATLAB. This tutorial is the best way to become familiar with Sage in only a few hours. You can read it in HTML or PDF versions, or from the Sage notebook (click Help, then click Tutorial to interactively work through the tutorial from within Sage). This work is licensed under a Creative Commons Attribution-Share Alike 3. 0 License. CONTENTS 1 Sage Tutorial, Release 5. 3 2 CONTENTS CHAPTER ONE INTRODUCTION This tutorial should take at most 3-4 hours to fully work through. You can read it in HTML or PDF versions, or from the Sage notebook click Help, then click Tutorial to interactively work through the tutorial from within Sage. Though much of Sage is implemented using Python, no Python background is needed to read this tutorial. You will want to learn Python (a very fun language! ) at some point, and there are many excellent free resources for doing so including [PyT] and [Dive]. If you just want to quickly try out Sage, this tutorial is the place to start. For example: sage: 2 + 2 4 sage: factor(-2007) -1 * 3^2 * 223 sage: A = matrix(4,4, range(16)); A [ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11] [12 13 14 15] sage: factor(A. charpoly()) x^2 * (x^2 ââ¬â 30*x ââ¬â 80) sage: m = matrix(ZZ,2, range(4)) sage: m[0,0] = m[0,0] ââ¬â 3 sage: m [-3 1] [ 2 3] sage: E = EllipticCurve([1,2,3,4,5]); sage: E Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field sage: E. anlist(10) [0, 1, 1, 0, -1, -3, 0, -1, -3, -3, -3] sage: E. ank() 1 sage: k = 1/(sqrt(3)*I + 3/4 + sqrt(73)*5/9); k 1/(I*sqrt(3) + 5/9*sqrt(73) + 3/4) sage: N(k) 0. 165495678130644 ââ¬â 0. 0521492082074256*I sage: N(k,30) # 30 ââ¬Å"bitsâ⬠0. 16549568 ââ¬â 0. 052149208*I sage: latex(k) frac{1}{i , sqrt{3} + frac{5}{9} , sqrt{73} + frac{3}{4}} 3 Sage Tutorial, Release 5. 3 1. 1 Installation If you do not have Sage installed on a computer and just want to try s ome commands, use online at http://www. sagenb. org. See the Sage Installation Guide in the documentation section of the main Sage webpage [SA] for instructions on installing Sage on your computer. Here we merely make a few comments. 1. The Sage download ? le comes with ââ¬Å"batteries includedâ⬠. In other words, although Sage uses Python, IPython, PARI, GAP, Singular, Maxima, NTL, GMP, and so on, you do not need to install them separately as they are included with the Sage distribution. However, to use certain Sage features, e. g. , Macaulay or KASH, you must install the relevant optional package or at least have the relevant programs installed on your computer already. Macaulay and KASH are Sage packages (for a list of available optional packages, type sage -optional, or browse the ââ¬Å"Downloadâ⬠page on the Sage website). . The pre-compiled binary version of Sage (found on the Sage web site) may be easier and quicker to install than the source code version. Just unpack the ? le and run sage. 3. If youââ¬â¢d like to use the SageTeX package (which allows you to embed the results of Sage computations into a LaTeX ? le), you will need to make SageTeX known to yo ur TeX distribution. To do this, see the section ââ¬Å"Make SageTeX known to TeXâ⬠in the Sage installation guide (this link should take you to a local copy of the installation guide). Itââ¬â¢s quite easy; you just need to set an environment variable or copy a single ? e to a directory that TeX will search. The documentation for using SageTeX is located in $SAGE_ROOT/local/share/texmf/tex/generic/sagetex/, where ââ¬Å"$SAGE_ROOTâ⬠refers to the directory where you installed Sage ââ¬â for example, /opt/sage-4. 2. 1. 1. 2 Ways to Use Sage You can use Sage in several ways. â⬠¢ Notebook graphical interface: see the section on the Notebook in the reference manual and The Notebook Interface below, â⬠¢ Interactive command line: see The Interactive Shell, â⬠¢ Programs: By writing interpreted and compiled programs in Sage (see Loading and Attaching Sage ? es and Creating Compiled Code), and â⬠¢ Scripts: by writing stand-alone Python scripts that use the Sag e library (see Standalone Python/Sage Scripts). 1. 3 Longterm Goals for Sage â⬠¢ Useful: Sageââ¬â¢s intended audience is mathematics students (from high school to graduate school), teachers, and research mathematicians. The aim is to provide software that can be used to explore and experiment with mathematical constructions in algebra, geometry, number theory, calculus, numerical computation, etc. Sage helps make it easier to interactively experiment with mathematical objects. Ef? cient: Be fast. Sage uses highly-optimized mature software like GMP, PARI, GAP, and NTL, and so is very fast at certain operations. â⬠¢ Free and open source: The source code must be freely available and readable, so users can understand what the system is really doing and more easily extend it. Just as mathematicians gain a deeper understanding of a theorem by carefully reading or at least skimming the proof, people who do computations should be able to understand how the calculations work by re ading documented source code. If you use Sage to do computations 4 Chapter 1. Introduction Sage Tutorial, Release 5. 3 in a paper you publish, you can rest assured that your readers will always have free access to Sage and all its source code, and you are even allowed to archive and re-distribute the version of Sage you used. â⬠¢ Easy to compile: Sage should be easy to compile from source for Linux, OS X and Windows users. This provides more ? exibility for users to modify the system. â⬠¢ Cooperation: Provide robust interfaces to most other computer algebra systems, including PARI, GAP, Singular, Maxima, KASH, Magma, Maple, and Mathematica. Sage is meant to unify and extend existing math software. â⬠¢ Well documented: Tutorial, programming guide, reference manual, and how-to, with numerous examples and discussion of background mathematics. â⬠¢ Extensible: Be able to de? ne new data types or derive from built-in types, and use code written in a range of languages. â⬠¢ User friendly: It should be easy to understand what functionality is provided for a given object and to view documentation and source code. Also attain a high level of user support. 1. 3. Longterm Goals for Sage 5 Sage Tutorial, Release 5. 3 6 Chapter 1. Introduction CHAPTER TWO A GUIDED TOUR This section is a guided tour of some of what is available in Sage. For many more examples, see ââ¬Å"Sage Constructionsâ⬠, which is intended to answer the general question ââ¬Å"How do I construct ? â⬠. See also the ââ¬Å"Sage Reference Manualâ⬠, which has thousands more examples. Also note that you can interactively work through this tour in the Sage notebook by clicking the Help link. (If you are viewing the tutorial in the Sage notebook, press shift-enter to evaluate any input cell. You can even edit the input before pressing shift-enter. On some Macs you might have to press shift-return rather than shift-enter. ) 2. 1 Assignment, Equality, and Arithmetic With some minor exceptions, Sage uses the Python programming language, so most introductory books on Python will help you to learn Sage. Sage uses = for assignment. It uses ==, =, < and > for comparison: sage: sage: 5 sage: True sage: False sage: True sage: True a = 5 a 2 == 2 2 == 3 2 < 3 a == 5 Sage provides all of the basic mathematical operations: age: 8 sage: 8 sage: 1 sage: 5/2 sage: 2 sage: True 2**3 2^3 10 % 3 10/4 10//4 # for integer arguments, // returns the integer quotient # # # ** means exponent ^ is a synonym for ** (unlike in Python) for integer arguments, % means mod, i. e. , remainder 4 * (10 // 4) + 10 % 4 == 10 7 Sage Tutorial, Release 5. 3 sage: 3^2*4 + 2%5 38 The computation of an expression like 3^2*4 + 2%5 depends on the order in which the operations are applied; this is speci? ed in the ââ¬Å"operator precedence tableâ⬠in Arithmetical binary operator precedence. Sage also provides many familiar mathematical functions; here are just a few examples: sage: sqrt(3. ) 1. 84390889145858 sage: sin(5. 135) -0. 912021158525540 sage: sin(pi/3) 1/2*sqrt(3) As the last example shows, some mathematical expressions return ââ¬Ëexactââ¬â¢ values, rather than numerical approximations. To get a numerical approximation, use either the function n or the method n (and both of these have a longer name, numerical_approx, and the function N is the same as n)). These take optional arguments prec, which is the requested number of bits of precision, and digits, which is the requested number of decimal digits of precision; the default is 53 bits of precision. sage: exp(2) e^2 sage: n(exp(2)) 7. 8905609893065 sage: sqrt(pi). numerical_approx() 1. 77245385090552 sage: sin(10). n(digits=5) -0. 54402 sage: N(sin(10),digits=10) -0. 5440211109 sage: numerical_approx(pi, prec=200) 3. 14 15926535897932384626433832795028841971693993751058209749 Python is dynamically typed, so the value referred to by each variable has a type associated with it, but a given variable may hold values of any Python type within a given scope: sage: sage: The C programming language, which is statically typed, is much different; a variable declared to hold an int can only hold an int in its scope. A potential source of confusion in Python is that an integer literal that begins with a zero is treated as an octal number, i. e. , a number in base 8. sage: 9 sage: 9 sage: sage: ââ¬â¢11ââ¬â¢ 011 8 + 1 n = 011 n. str(8) # string representation of n in base 8 8 Chapter 2. A Guided Tour Sage Tutorial, Release 5. 3 This is consistent with the C programming language. 2. 2 Getting Help Sage has extensive built-in documentation, accessible by typing the name of a function or a constant (for example), followed by a question mark: sage: tan? Type: Definition: Docstring: tan( [noargspec] ) The tangent function EXAMPLES: sage: tan(pi) 0 sage: tan(3. 1415) -0. 0000926535900581913 sage: tan(3. 1415/4) 0. 999953674278156 sage: tan(pi/4) 1 sage: tan(1/2) tan(1/2) sage: RR(tan(1/2)) 0. 546302489843790 sage: log2? Type: Definition: log2( [noargspec] ) Docstring: The natural logarithm of the real number 2. EXAMPLES: sage: log2 log2 sage: float(log2) 0. 69314718055994529 sage: RR(log2) 0. 693147180559945 sage: R = RealField(200); R Real Field with 200 bits of precision sage: R(log2) 0. 9314718055994530941723212145817656807550013436025525412068 sage: l = (1-log2)/(1+log2); l (1 ââ¬â log(2))/(log(2) + 1) sage: R(l) 0. 18123221829928249948761381864650311423330609774776013488056 sage: maxima(log2) log(2) sage: maxima(log2). float() . 6931471805599453 sage: gp(log2) 0. 6931471805599453094172321215 # 32-bit 0. 69314718055994530941723212145817656807 # 64-bit sage: sudoku? 2. 2. Getting Help 9 Sage Tutorial, Release 5. 3 File: Type: D efinition: Docstring: sage/local/lib/python2. 5/site-packages/sage/games/sudoku. py sudoku(A) Solve the 9Ãâ"9 Sudoku puzzle defined by the matrix A. EXAMPLE: sage: A = matrix(ZZ,9,[5,0,0, 0,8,0, 0,4,9, 0,0,0, 5,0,0, 0,3,0, 0,6,7, 3,0,0, 0,0,1, 1,5,0, 0,0,0, 0,0,0, 0,0,0, 2,0,8, 0,0,0, 0,0,0, 0,0,0, 0,1,8, 7,0,0, 0,0,4, 1,5,0, 0,3,0, 0,0,2, 0,0,0, 4,9,0, 0,5,0, 0,0,3]) sage: A [5 0 0 0 8 0 0 4 9] [0 0 0 5 0 0 0 3 0] [0 6 7 3 0 0 0 0 1] [1 5 0 0 0 0 0 0 0] [0 0 0 2 0 8 0 0 0] [0 0 0 0 0 0 0 1 8] [7 0 0 0 0 4 1 5 0] [0 3 0 0 0 2 0 0 0] [4 9 0 0 5 0 0 0 3] sage: sudoku(A) [5 1 3 6 8 7 2 4 9] [8 4 9 5 2 1 6 3 7] [2 6 7 3 4 9 5 8 1] [1 5 8 4 6 3 9 7 2] [9 7 4 2 1 8 3 6 5] [3 2 6 7 9 5 4 1 8] [7 8 2 9 3 4 1 5 6] [6 3 5 1 7 2 8 9 4] [4 9 1 8 5 6 7 2 3] Sage also provides ââ¬ËTab completionââ¬â¢: type the ? rst few letters of a function and then hit the tab key. For example, if you type ta followed by TAB, Sage will print tachyon, tan, tanh, taylor. This provides a good way to ? nd the names of functions and other structures in Sage. 2. 3 Functions, Indentation, and Counting To de? ne a new function in Sage, use the def command and a colon after the list of variable names. For example: sage: def is_even(n): return n%2 == 0 sage: is_even(2) True sage: is_even(3) False Note: Depending on which version of the tutorial you are viewing, you may see three dots n the second line of this example. Do not type them; they are just to emphasize that the code is indented. Whenever this is the case, press [Return/Enter] once at the end of the block to insert a blank line and conclude the function de? nition. You do not specify the types of any of the input arguments. You can specify multiple inputs, each of which may have an optional defaul t value. For example, the function below defaults to divisor=2 if divisor is not speci? ed. 10 Chapter 2. A Guided Tour Sage Tutorial, Release 5. 3 sage: sage: True sage: True sage: False ef is_divisible_by(number, divisor=2): return number%divisor == 0 is_divisible_by(6,2) is_divisible_by(6) is_divisible_by(6, 5) You can also explicitly specify one or either of the inputs when calling the function; if you specify the inputs explicitly, you can give them in any order: sage: is_divisible_by(6, divisor=5) False sage: is_divisible_by(divisor=2, number=6) True In Python, blocks of code are not indicated by curly braces or begin and end blocks as in many other languages. Instead, blocks of code are indicated by indentation, which must match up exactly. For example, the following is a syntax error because the return statement is not indented the same amount as the other lines above it. sage: def even(n): v = [] for i in range(3,n): if i % 2 == 0: v. append(i) return v Syntax Error: return v If you ? x the indentation, the function works: sage: def even(n): v = [] for i in range(3,n): if i % 2 == 0: v. append(i) return v sage: even(10) [4, 6, 8] Semicolons are not needed at the ends of lines; a line is in most cases ended by a newline. However, you can put multiple statements on one line, separated by semicolons: sage: a = 5; b = a + 3; c = b^2; c 64 If you would like a single line of code to span multiple lines, use a terminating backslash: sage: 2 + 3 5 In Sage, you count by iterating over a range of integers. For example, the ? rst line below is exactly like for(i=0; i x^2 sage: g(3) 9 sage: Dg = g. derivative(); Dg x |ââ¬â> 2*x sage: Dg(3) 6 sage: type(g) sage: plot(g, 0, 2) Note that while g is a callable symbolic expression, g(x) is a related, but different sort of object, which can also be plotted, differentated, etc. , albeit with some issues: see item 5 below for an illustration. sage: x^2 sage: g(x). derivative() plot(g(x), 0, 2) 3. Use a pre-de? ed Sage ââ¬Ëcalculus functionââ¬â¢. These can be plotted, and with a little help, differentiated, and integrated. sage: type(sin) sage: plot(sin, 0, 2) sage: type(sin(x)) sage: plot(sin(x), 0, 2) By itself, sin cannot be differentiated, at least not to produce cos. sage: f = sin sage: f. derivative() Traceback (most recent call last): AttributeError: Using f = sin(x) instead of sin works, but it is probably even better to use f(x) = sin(x) to de? ne a callable symbolic expression. sage: S(x) = sin(x) sage: S. derivative() x |ââ¬â> cos(x) Here are some common problems, with explanations: 4. Accidental evaluation. sage: def h(x): f x 1 to 0. sage: G = DirichletGroup(12) sage: G. list() [Dirichlet character modulo 12 of conductor 1 mapping 7 |ââ¬â> 1, 5 |ââ¬â> 1, Dirichlet character modulo 12 of conductor 4 mapping 7 |ââ¬â> -1, 5 |ââ¬â> 1, Dirichlet character modulo 12 of conductor 3 mapping 7 |ââ¬â> 1, 5 |ââ¬â> -1, Dirichlet character modulo 12 of conductor 12 mapping 7 |ââ¬â> -1, 5 |ââ¬â> -1] sage: G. gens() (Dirichlet character modulo 12 of conductor 4 mapping 7 |ââ¬â> -1, 5 |ââ¬â> 1, Dirichlet character modulo 12 of conductor 3 mapping 7 |ââ¬â> 1, 5 |ââ¬â> -1) sage: len(G) 4 Having created the group, we next create an element and compute with it. age: G = DirichletGroup(21) sage: chi = G. 1; c hi Dirichlet character modulo 21 of conductor 7 mapping 8 |ââ¬â> 1, 10 |ââ¬â> zeta6 sage: chi. values() [0, 1, zeta6 ââ¬â 1, 0, -zeta6, -zeta6 + 1, 0, 0, 1, 0, zeta6, -zeta6, 0, -1, 0, 0, zeta6 ââ¬â 1, zeta6, 0, -zeta6 + 1, -1] sage: chi. conductor() 7 sage: chi. modulus() 21 sage: chi. order() 6 sage: chi(19) -zeta6 + 1 sage: chi(40) -zeta6 + 1 It is also possible to compute the action of the Galois group Gal(Q(? N )/Q) on these characters, as well as the direct product decomposition corresponding to the factorization of the modulus. sage: chi. alois_orbit() [Dirichlet character modulo 21 of conductor 7 mapping 8 |ââ¬â> 1, 10 |ââ¬â> zeta6, 2. 13. Some More Advanced Mathematics 45 Sage Tutorial, Release 5. 3 Dirichlet character modulo 21 of conductor 7 mapping 8 |ââ¬â> 1, 10 |ââ¬â> -zeta6 + 1] sage: go = G. galois_orbits() sage: [len(orbit) for orbit in go] [1, 2, 2, 1, 1, 2, 2, 1] sage: [ Group 6 and Group 6 and ] G. decomposition() of Dirichlet char acters of modulus 3 over Cyclotomic Field of order degree 2, of Dirichlet characters of modulus 7 over Cyclotomic Field of order degree 2 Next, we construct the group of Dirichlet characters mod 20, but with values n Q(i): sage: sage: sage: Group K. = NumberField(x^2+1) G = DirichletGroup(20,K) G of Dirichlet characters of modulus 20 over Number Field in i with defining polynomial x^2 + 1 We next compute several invariants of G: sage: G. gens() (Dirichlet character modulo 20 of conductor 4 mapping 11 |ââ¬â> -1, 17 |ââ¬â> 1, Dirichlet character modulo 20 of conductor 5 mapping 11 |ââ¬â> 1, 17 |ââ¬â> i) sage: G. unit_gens() [11, 17] sage: G. zeta() i sage: G. zeta_order() 4 In this example we create a Dirichlet character with values in a number ? eld. We explicitly specify the choice of root of unity by the third argument to DirichletGroup below. age: x = polygen(QQ, ââ¬â¢xââ¬â¢) sage: K = NumberField(x^4 + 1, ââ¬â¢aââ¬â¢); a = K. 0 sage: b = K. gen(); a == b True sage: K Number Field in a with defining polynomial x^4 + 1 sage: G = DirichletGroup(5, K, a); G Group of Dirichlet characters of modulus 5 over Number Field in a with defining polynomial x^4 + 1 sage: chi = G. 0; chi Dirichlet character modulo 5 of conductor 5 mapping 2 |ââ¬â> a^2 sage: [(chi^i)(2) for i in range(4)] [1, a^2, -1, -a^2] Here NumberField(x^4 + 1, ââ¬â¢aââ¬â¢) tells Sage to use the symbol ââ¬Å"aâ⬠in printing what K is (a Number Field in a with de? ning polynomial x4 + 1). The name ââ¬Å"aâ⬠is undeclared at this point. Once a = K. 0 (or equivalently a = K. gen()) is evaluated, the symbol ââ¬Å"aâ⬠represents a root of the generating polynomial x4 + 1. 46 Chapter 2. A Guided Tour Sage Tutorial, Release 5. 3 2. 13. 4 Modular Forms Sage can do some computations related to modular forms, including dimensions, computing spaces of modular symbols, Hecke operators, and decompositions. There are several functions available for computing dimensions of spaces of modular forms. For example, sage: dimension_cusp_forms(Gamma0(11),2) 1 sage: dimension_cusp_forms(Gamma0(1),12) 1 sage: dimension_cusp_forms(Gamma1(389),2) 6112 Next we illustrate computation of Hecke operators on a space of modular symbols of level 1 and weight 12. sage: M = ModularSymbols(1,12) sage: M. basis() ([X^8*Y^2,(0,0)], [X^9*Y,(0,0)], [X^10,(0,0)]) sage: t2 = M. T(2) sage: t2 Hecke operator T_2 on Modular Symbols space of dimension 3 for Gamma_0(1) of weight 12 with sign 0 over Rational Field sage: t2. matrix() [ -24 0 0] [ 0 -24 0] [4860 0 2049] sage: f = t2. charpoly(ââ¬â¢xââ¬â¢); f x^3 ââ¬â 2001*x^2 ââ¬â 97776*x ââ¬â 1180224 sage: factor(f) (x ââ¬â 2049) * (x + 24)^2 sage: M. T(11). charpoly(ââ¬â¢xââ¬â¢). factor() (x ââ¬â 285311670612) * (x ââ¬â 534612)^2 We can also create spaces for ? 0 (N ) and ? 1 (N ). sage: ModularSymbols(11,2) Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field sage: ModularSymbols(Gamma1(11),2) Modular Symbols space of dimension 11 for Gamma_1(11) of weight 2 with sign 0 and over Rational Field Letââ¬â¢s compute some characteristic polynomials and q-expansions. sage: M = ModularSymbols(Gamma1(11),2) sage: M. T(2). charpoly(ââ¬â¢xââ¬â¢) x^11 ââ¬â 8*x^10 + 20*x^9 + 10*x^8 ââ¬â 145*x^7 + 229*x^6 + 58*x^5 ââ¬â 360*x^4 + 70*x^3 ââ¬â 515*x^2 + 1804*x ââ¬â 1452 sage: M. T(2). charpoly(ââ¬â¢xââ¬â¢). actor() (x ââ¬â 3) * (x + 2)^2 * (x^4 ââ¬â 7*x^3 + 19*x^2 ââ¬â 23*x + 11) * (x^4 ââ¬â 2*x^3 + 4*x^2 + 2*x + 11) sage: S = M. cuspidal_submodule() sage: S. T(2). matrix() [-2 0] [ 0 -2] sage: S. q_expansion_basis(10) [ q ââ¬â 2*q^2 ââ¬â q^3 + 2*q^4 + q^5 + 2*q^6 ââ¬â 2*q^7 ââ¬â 2*q^9 + O(q^10) ] 2. 13. Some More A dvanced Mathematics 47 Sage Tutorial, Release 5. 3 We can even compute spaces of modular symbols with character. sage: G = DirichletGroup(13) sage: e = G. 0^2 sage: M = ModularSymbols(e,2); M Modular Symbols space of dimension 4 and level 13, weight 2, character [zeta6], sign 0, over Cyclotomic Field of order 6 and degree 2 sage: M. T(2). charpoly(ââ¬â¢xââ¬â¢). factor() (x ââ¬â 2*zeta6 ââ¬â 1) * (x ââ¬â zeta6 ââ¬â 2) * (x + zeta6 + 1)^2 sage: S = M. cuspidal_submodule(); S Modular Symbols subspace of dimension 2 of Modular Symbols space of dimension 4 and level 13, weight 2, character [zeta6], sign 0, over Cyclotomic Field of order 6 and degree 2 sage: S. T(2). charpoly(ââ¬â¢xââ¬â¢). factor() (x + zeta6 + 1)^2 sage: S. q_expansion_basis(10) [ q + (-zeta6 ââ¬â 1)*q^2 + (2*zeta6 ââ¬â 2)*q^3 + zeta6*q^4 + (-2*zeta6 + 1)*q^5 + (-2*zeta6 + 4)*q^6 + (2*zeta6 ââ¬â 1)*q^8 ââ¬â zeta6*q^9 + O(q^10) ] Here is another example of how Sage can compute the action of Hecke operators on a space of modular forms. sage: T = ModularForms(Gamma0(11),2) sage: T Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field sage: T. degree() 2 sage: T. level() 11 sage: T. group() Congruence Subgroup Gamma0(11) sage: T. dimension() 2 sage: T. cuspidal_subspace() Cuspidal subspace of dimension 1 of Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field sage: T. isenstein_subspace() Eisenstein subspace of dimension 1 of Modular Forms space of dimension 2 for Congruence Subgroup Gamma0(11) of weight 2 over Rational Field sage: M = ModularSymbols(11); M Modular Symbols space of dimension 3 for Gamma_0(11) of weight 2 with sign 0 over Rational Field sage: M. weight() 2 sage: M. basis() ((1,0), (1,8), (1,9)) sage: M. sign() 0 Let Tp denote the usual Hecke operators (p prime). How do the Hecke operators T2 , T3 , T5 act on the space of modular symbols? sage: M. T(2). matrix() [ 3 0 -1] [ 0 -2 0] [ 0 0 -2] sage: M. T(3). matrix() [ 4 0 -1] 8 Chapter 2. A Guided Tour Sage Tutorial, Release 5. 3 [ 0 -1 0] [ 0 0 -1] sage: M. T(5). matrix() [ 6 0 -1] [ 0 1 0] [ 0 0 1] 2. 13. Some More Advanced Mathematics 49 Sage Tutorial, Release 5. 3 50 Chapter 2. A Guided Tour CHAPTER THREE THE INTERACTIVE SHELL In most of this tutorial, we assume you start the Sage interpreter using the sage command. This starts a customized version of the IPython shell, and imports many functions and classes, so they are ready to use from the command prompt. Further customization is possible by editing the $SAGE_ROOT/ipythonrc ? le. Upon starting Sage, you get output similar to the following: ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| SAGE Version 3. 1. 1, Release Date: 2008-05-24 | | Type notebook() for the GUI, and license() for information. | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â- sage: To quit Sage either press Ctrl-D or type quit or exit. sage: quit Exiting SAGE (CPU time 0m0. 00s, Wall time 0m0. 89s) The wall time is the time that elapsed on the clock hanging from your wall. This is relevant, since CPU time does not track time used by subprocesses like GAP or Singular. Avoid killing a Sage process with kill -9 from a terminal, since Sage might not kill child processes, e. g. , Maple processes, or cleanup temporary ? les f rom $HOME/. sage/tmp. ) 3. 1 Your Sage Session The session is the sequence of input and output from when you start Sage until you quit. Sage logs all Sage input, via IPython. In fact, if youââ¬â¢re using the interactive shell (not the notebook interface), then at any point you may type %history (or %hist) to get a listing of all input lines typed so far. You can type ? at the Sage prompt to ? nd out more about IPython, e. g. ââ¬Å"IPython offers numbered prompts with input and output caching. All input is saved and can be retrieved as variables (besides the usual arrow key recall). The following GLOBAL variables always exist (so donââ¬â¢t overwrite them! )â⬠: _: previous input (interactive shell and notebook) __: next previous input (interactive shell only) _oh : list of all inputs (interactive shell only) Here is an example: sage: factor(100) _1 = 2^2 * 5^2 sage: kronecker_symbol(3,5) 51 Sage Tutorial, Release 5. 3 _2 = -1 sage: %hist #This only works from the interacti ve shell, not the notebook. : factor(100) 2: kronecker_symbol(3,5) 3: %hist sage: _oh _4 = {1: 2^2 * 5^2, 2: -1} sage: _i1 _5 = ââ¬â¢factor(ZZ(100)) ââ¬â¢ sage: eval(_i1) _6 = 2^2 * 5^2 sage: %hist 1: factor(100) 2: kronecker_symbol(3,5) 3: %hist 4: _oh 5: _i1 6: eval(_i1) 7: %hist We omit the output numbering in the rest of this tutorial and the other Sage documentation. You can also store a list of input from session in a macro for that session. sage: E = EllipticCurve([1,2,3,4,5]) sage: M = ModularSymbols(37) sage: %hist 1: E = EllipticCurve([1,2,3,4,5]) 2: M = ModularSymbols(37) 3: %hist sage: %macro em 1-2 Macro ââ¬Ëemââ¬Ë created. To execute, type its name (without quotes). sage: E Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field sage: E = 5 sage: M = None sage: em Executing Macro sage: E Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field When using the interactive shell, any UNIX shell command can be executed from Sage by prefacing it by an exclamation point !. For example, sage: ! ls auto example. sage glossary. tex t tmp tut. log tut. tex returns the listing of the current directory. The PATH has the Sage bin directory at the front, so if you run gp, gap, singular, maxima, etc. you get the versions included with Sage. sage: ! gp Reading GPRC: /etc/gprc Done. GP/PARI CALCULATOR Version 2. 2. 11 (alpha) i686 running linux (ix86/GMP-4. 1. 4 kernel) 32-bit version 52 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 sage: ! singular SINGULAR A Computer Algebra System for Polynomial Computations 0< by: G. -M. Greuel, G. Pfister, H . Schoenemann FB Mathematik der Universitaet, D-67653 Kaiserslautern October 2005 / / Development version 3-0-1 3. 2 Logging Input and Output Logging your Sage session is not the same as saving it (see Saving and Loading Complete Sessions for that). To log input (and optionally output) use the logstart command. Type logstart? for more details. You can use this command to log all input you type, all output, and even play back that input in a future session (by simply reloading the log ? le). [emailà protected]:~$ sage ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| SAGE Version 3. 0. 2, Release Date: 2008-05-24 | | Type notebook() for the GUI, and license() for information. | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âsage: logstart setup Activating auto-logging. Current session state plus future input saved. Filename : setup Mode : backup Output logging : False Timestamping : False State : active sage: E = EllipticCurve([1,2,3,4,5]). minimal_model() sage: F = QQ^3 sage: x,y = QQ[ââ¬â¢x,yââ¬â¢]. gens() sage: G = E. gens() sage: Exiting SAGE (CPU time 0m0. 61s, Wall time 0m50. 39s). [emailà protected]:~$ sage ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| SAGE Version 3. 0. 2, Release Date: 2008-05-24 | | Type notebook() for the GUI, and license() for information. | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âsage: load ââ¬Å"setupâ⬠Loading log file one line at a time Finished replaying log file sage: E Elliptic Curve defined by y^2 + x*y = x^3 ââ¬â x^2 + 4*x + 3 over Rational Field sage: x*y x*y sage: G [(2 : 3 : 1)] If you use Sage in the Linux KDE terminal konsole then you can save your session as follows: after starting Sage in konsole, select ââ¬Å"settingsâ⬠, then ââ¬Å"history â⬠, then ââ¬Å"set unlimitedâ⬠. When you are ready to save your session, select ââ¬Å"editâ⬠then ââ¬Å"save history as â⬠and type in a name to save the text of your session to your computer. After saving this ? le, you could then load it into an editor, such as xemacs, and print it. 3. 2. Logging Input and Output 53 Sage Tutorial, Release 5. 3 3. Paste Ignores Prompts Suppose you are reading a session of Sage or Python computations and want to copy them into Sage. But there are annoying >>> or sage: prompts to worry about. In fact, you can copy and paste an example, including the prompts if you want, into Sage. In other words, by de fault the Sage parser strips any leading >>> or sage: prompt before passing it to Python. For example, sage: 2^10 1024 sage: sage: sage: 2^10 1024 sage: >>> 2^10 1024 3. 4 Timing Commands If you place the %time command at the beginning of an input line, the time the command takes to run will be displayed after the output. For example, we can compare the running time for a certain exponentiation operation in several ways. The timings below will probably be much different on your computer, or even between different versions of Sage. First, native Python: sage: %time a = int(1938)^int(99484) CPU times: user 0. 66 s, sys: 0. 00 s, total: 0. 66 s Wall time: 0. 66 This means that 0. 66 seconds total were taken, and the ââ¬Å"Wall timeâ⬠, i. e. , the amount of time that elapsed on your wall clock, is also 0. 66 seconds. If your computer is heavily loaded with other programs, the wall time may be much larger than the CPU time. Next we time exponentiation using the native Sage Integer type, which is implemented (in Cython) using the GMP library: sage: %time a = 1938^99484 CPU times: user 0. 04 s, sys: 0. 00 s, total: 0. 04 s Wall time: 0. 04 Using the PARI C-library interface: sage: %time a = pari(1938)^pari(99484) CPU times: user 0. 05 s, sys: 0. 00 s, total: 0. 05 s Wall time: 0. 05 GMP is better, but only slightly (as expected, since the version of PARI built for Sage uses GMP for integer arithmetic). You can also time a block of commands using the cputime command, as illustrated below: sage: sage: sage: sage: sage: 0. 4 t = cputime() a = int(1938)^int(99484) b = 1938^99484 c = pari(1938)^pari(99484) cputime(t) # somewhat random output sage: cputime? Return the time in CPU second since SAGE started, or with optional argument t, return the time since time t. 54 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 INPUT: t ââ¬â (optional) float, time in CPU seconds OUTPUT: float ââ¬â time i n CPU seconds The walltime command behaves just like the cputime command, except that it measures wall time. We can also compute the above power in some of the computer algebra systems that Sage includes. In each case we execute a trivial command in the system, in order to start up the server for that program. The most relevant time is the wall time. However, if there is a signi? cant difference between the wall time and the CPU time then this may indicate a performance issue worth looking into. sage: time 1938^99484; CPU times: user 0. 01 s, sys: 0. 00 s, total: Wall time: 0. 01 sage: gp(0) 0 sage: time g = gp(ââ¬â¢1938^99484ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 0. 04 sage: maxima(0) 0 sage: time g = maxima(ââ¬â¢1938^99484ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 0. 0 sage: kash(0) 0 sage: time g = kash(ââ¬â¢1938^99484ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 0. 04 sage: mathematica(0) 0 sage: time g = mathematica(ââ¬â¢1938^99484ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 0. 03 sage: maple(0) 0 sage: time g = maple(ââ¬â¢1938^99484ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 0. 11 sage: gap(0) 0 sage: time g = gap. eval(ââ¬â¢1938^99484;;ââ¬â¢) CPU times: user 0. 00 s, sys: 0. 00 s, total: Wall time: 1. 02 0. 01 s 0. 00 s 0. 00 s 0. 00 s 0. 00 s 0. 00 s 0. 00 s Note that GAP and Maxima are the slowest in this test (this was run on the machine sage. ath. washington. edu). Because of the pexpect interface overhead, it is perhaps unfair to compare these to Sage, which is the fastest. 3. 5 Other IPython tricks As noted above, Sage uses IPython as its front end, and so you can use any of IPythonââ¬â¢s commands and features. You can read the full IPython documentation. Meanwhile, here are some fun tricks ââ¬â these are called ââ¬Å"Magic commandsâ⬠in IPython: â⬠¢ You can use %bg to run a command in the background, and then use jobs to access the results, as follows. 3. 5. Other IPython tricks 55 Sage Tutorial, Release 5. 3 The comments not tested are here because the %bg syntax doesnââ¬â¢t work well with S ageââ¬â¢s automatic testing facility. If you type this in yourself, it should work as written. This is of course most useful with commands which take a while to complete. ) sage: def quick(m): return 2*m sage: %bg quick(20) # not tested Starting job # 0 in a separate thread. sage: jobs. status() # not tested Completed jobs: 0 : quick(20) sage: jobs[0]. result # the actual answer, not tested 40 Note that jobs run in the background donââ¬â¢t use the Sage preparser ââ¬â see The Pre-Parser: Differences between Sage and Python for more information. One (perhaps awkward) way to get around this would be to run sage: %bg eval(preparse(ââ¬â¢quick(20)ââ¬â¢)) # not tested It is safer and easier, though, to just use %bg on commands which donââ¬â¢t require the preparser. â⬠¢ You can use %edit (or %ed or ed) to open an editor, if you want to type in some complex code. Before you start Sage, make sure that the EDITOR environment variable is set to your favorite editor (by putting export EDITOR=/usr/bin/emacs or export EDITOR=/usr/bin/vim or something similar in the appropriate place, like a . profile ? le). From the Sage prompt, executing %edit will open up the named editor. Then within the editor you can de? e a function: def some_function(n): return n**2 + 3*n + 2 Save and quit from the editor. For the rest of your Sage session, you can then use some_function. If you want to modify it, type %edit some_function from the Sage prompt. â⬠¢ If you have a computation and you want to modify its output for another use, perform the computation and type %rep: this will place the output from the previous command at the Sage prompt, ready for you to edit it. sage: f(x) = cos(x) sage: f(x). derivative(x) -sin(x) At this point, if you type %rep at the Sage prompt, you will get a new Sage prompt, followed by -sin(x), with the cursor at the end of the line. For more, type %quickref to get a quick reference guide to IPython. As of this writing (April 2011), Sage uses version 0. 9. 1 of IPython, and the documentation for its magic commands is available online. 3. 6 Errors and Exceptions When something goes wrong, you will usually see a Python ââ¬Å"exceptionâ⬠. Python even tries to suggest what raised the exception. Often you see the name of the exception, e. g. , NameError or ValueError (see the Python Reference Manual [Py] for a complete list of exceptions). For example, sage: 3_2 ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âFile ââ¬Å"â⬠, line 1 ZZ(3)_2 ^ SyntaxError: invalid syntax 6 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 sage: EllipticCurve([0,infinity]) ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â ââ¬âââ¬âââ¬âTraceback (most recent call last): TypeError: Unable to coerce Infinity () to Rational The interactive debugger is sometimes useful for understanding what went wrong. You can toggle it on or off using %pdb (the default is off). The prompt ipdb> appears if an exception is raised and the debugger is on. From within the debugger, you can print the state of any local variable, and move up and down the execution stack. For example, sage: %pdb Automatic pdb calling has been turned ON sage: EllipticCurve([1,infinity]) ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â Traceback (most recent call last) ipdb> For a list of commands in the debugger, type ? at the ipdb> prompt: ipdb> ? Documented commands (type help ): ======================================== EOF break commands debug h a bt condition disable help alias c cont down ignore args cl continue enable j b clear d exit jump whatis where Miscellaneous help topics: ========================== exec pdb Undocumented commands: ====================== retval rv list n next p pdef pdoc pinfo pp q quit r return s step tbreak u unalias up w Type Ctrl-D or quit to return to Sage. 3. 7 Reverse Search and Tab Completion Reverse search: Type the beginning of a command, then Ctrl-p (or just hit the up arrow key) t o go back to each line you have entered that begins in that way. This works even if you completely exit Sage and restart later. You can also do a reverse search through the history using Ctrl-r. All these features use the readline package, which is available on most ? avors of Linux. To illustrate tab completion, ? st create the three dimensional vector space V = Q3 as follows: sage: V = VectorSpace(QQ,3) sage: V Vector space of dimension 3 over Rational Field You can also use the following more concise notation: 3. 7. Reverse Search and Tab Completion 57 Sage Tutorial, Release 5. 3 sage: V = QQ^3 Then it is easy to list all member functions for V using tab completion. Just type V. , then type the [tab key] key on your keyboard: sage: V. [tab key] V. _VectorSpace_generic__base_field V. ambient_space V. base_field V. base_ring V. basis V. coordinates V. zero_vector If you type the ? st few letters of a function, then [tab key], you get only functions that begin as indicated. sage: V. i[tab key] V. is_ambient V. is_dense V. is_full V. is_sparse If you wonder what a particular function does, e. g. , the coordinates function, type V. coordinates? for help or V. coordinates for the source code, as explained in the next section. 3. 8 Integrated Help System Sage features an integrated help facility. Type a function name followed by ? for the documentation for that function. sage: V = QQ^3 sage: V. coordinates? Type: instancemethod Base Class: String Form: Namespace: Interactive File: /home/was/s/local/lib/python2. /site-packages/sage/modules/f ree_module. py Definition: V. coordinates(self, v) Docstring: Write v in terms of the basis for self. Returns a list c such that if B is the basis for self, then sum c_i B_i = v. If v is not in self, raises an ArithmeticError exception. EXAMPLES: sage: M = FreeModule(IntegerRing(), 2); M0,M1=M. gens() sage: W = M. submodule([M0 + M1, M0 ââ¬â 2*M1]) sage: W. coordinates(2*M0-M1) [2, -1] As shown above, the output tells you t he type of the object, the ? le in which it is de? ned, and a useful description of the function with examples that you can paste into your current session. Almost all of these examples are regularly automatically tested to make sure they work and behave exactly as claimed. 58 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 Another feature that is very much in the spirit of the open source nature of Sage is that if f is a Python function, then typing f displays the source code that de? nes f. For example, sage: V = QQ^3 sage: V. coordinates Type: instancemethod Source: def coordinates(self, v): ââ¬Å"â⬠â⬠Write $v$ in terms of the basis for self. ââ¬Å"â⬠â⬠return self. coordinate_vector(v). list() This tells us that all the coordinates function does is call the coordinate_vector function and change the result into a list. What does the coordinate_vector function do? sage: V = QQ^3 sage: V. coordinate_vector def coordinate_vector(self, v): return self. ambient_vector_space()(v) The coordinate_vector function coerces its input into the ambient space, which has the effect of computing the vector of coef? cients of v in terms of V . The space V is already ambient since itââ¬â¢s just Q3 . There is also a coordinate_vector function for subspaces, and itââ¬â¢s different. We create a subspace and see: sage: V = QQ^3; W = V. span_of_basis([V. 0, V. 1]) sage: W. coordinate_vector def coordinate_vector(self, v): ââ¬Å"â⬠â⬠ââ¬Å"â⬠â⬠# First find the coordinates of v wrt echelon basis. w = self. echelon_coordinate_vector(v) # Next use transformation matrix from echelon basis to # user basis. T = self. echelon_to_user_matrix() return T. linear_combination_of_rows(w) (If you think the implementation is inef? cient, please sign up to help optimize linear algebra. ) You may also type help(command_name) or help(class) for a manpage-like help ? le about a given class. age: help(VectorSpace) Help on class VectorSpace class VectorSpace(__builtin__. object) | Create a Vector Space. | | To create an ambient space over a field with given dimension | using the calling syntax : : When you type q to exit the help system, your session appears just as it was. The help listing does not clutter up your session, unlike the output of function_name? som etimes does. Itââ¬â¢s particularly helpful to type 3. 8. Integrated Help System 59 Sage Tutorial, Release 5. 3 help(module_name). For example, vector spaces are de? ned in sage. modules. free_module, so type help(sage. modules. ree_module) for documentation about that whole module. When viewing documentation using help, you can search by typing / and in reverse by typing ?. 3. 9 Saving and Loading Individual Objects Suppose you compute a matrix or worse, a complicated space of modular symbols, and would like to save it for later use. What can you do? There are several approaches that computer algebra systems take to saving individual objects. 1. Save your Game: Only support saving and loading of complete sessions (e. g. , GAP, Magma). 2. Uni? ed Input/Output: Make every object print in a way that can be read back in (GP/PARI). 3. Eval: Make it easy to evaluate arbitrary code in the interpreter (e. g. , Singular, PARI). Because Sage uses Python, it takes a different approach, which is that every object can be serialized, i. e. , turned into a string from which that object can be recovered. This is in spirit similar to the uni? ed I/O approach of PARI, except it doesnââ¬â¢t have the drawback that objects print to screen in too complicated of a way. Also, support for saving and loading is (in most cases) completely automatic, requiring no extra programming; itââ¬â¢s simply a feature of Python that was designed into the language from the ground up. Almost all Sage objects x can be saved in compressed form to disk using save(x, filename) (or in many cases x. save(filename)). To load the object back in, use load(filename). sage: sage: [ 15 [ 42 [ 69 sage: A = MatrixSpace(QQ,3)(range(9))^2 A 18 21] 54 66] 90 111] save(A, ââ¬â¢Aââ¬â¢) You should now quit Sage and restart. Then you can get A back: sage: sage: [ 15 [ 42 [ 69 A = load(ââ¬â¢Aââ¬â¢) A 18 21] 54 66] 90 111] You can do the same with more complicated objects, e. g. , elliptic curves. All data about the object that is cached is stored with the object. For example, sage: sage: sage: sage: E = EllipticCurve(ââ¬â¢11aââ¬â¢) v = E. nlist(100000) save(E, ââ¬â¢Eââ¬â¢) quit # takes a while The saved version of E takes 153 kilobytes, since it stores the ? rst 100000 an with it. ~/tmp$ ls -l E. sobj -rw-rââ¬ârââ¬â 1 was was 153500 2006-01-28 19:23 E. sobj ~/tmp$ sage [ ] sage: E = load(ââ¬â¢Eââ¬â¢) sage: v = E. anlist(100000) # instant! (In Pytho n, saving and loading is accomplished using the cPickle module. In particular, a Sage object x can be saved via cPickle. dumps(x, 2). Note the 2! ) 60 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 Sage cannot save and load individual objects created in some other computer algebra systems, e. . , GAP, Singular, Maxima, etc. They reload in a state marked ââ¬Å"invalidâ⬠. In GAP, though many objects print in a form from which they can be reconstructed, many donââ¬â¢t, so reconstructing from their print representation is purposely not allowed. sage: a = gap(2) sage: a. save(ââ¬â¢aââ¬â¢) sage: load(ââ¬â¢aââ¬â¢) Traceback (most recent call last): ValueError: The session in which this object was defined is no longer running. GP/PARI objects can be saved and loaded since their print representation is enough to reconstruct them. sage: a = gp(2) sage: a. save(ââ¬â¢aââ¬â¢) sage: load(ââ¬â¢aââ¬â¢) 2 Saved objects can be re-loaded later on computers with different architectures or operating systems, e. g. , you could save a huge matrix on 32-bit OS X and reload it on 64-bit Linux, ? nd the echelon form, then move it back. Also, in many cases you can even load objects into versions of Sage that are different than the versions they were saved in, as long as the code for that object isnââ¬â¢t too different. All the attributes of the objects are saved, along with the class (but not source code) that de? nes the object. If that class no longer exists in a new version of Sage, then the object canââ¬â¢t be reloaded in that newer version. But you could load it in an old version, get the objects dictionary (with x. __dict__), and save the dictionary, and load that into the newer version. 3. 9. 1 Saving as Text You can also save the ASCII text representation of objects to a plain text ? le by simply opening a ? le in write mode and writing the string representation of the object (you can write many objects this way as well). When youââ¬â¢re done writing objects, close the ? le. sage: sage: sage: sage: sage: R. = PolynomialRing(QQ,2) f = (x+y)^7 o = open(ââ¬â¢file. txtââ¬â¢,ââ¬â¢wââ¬â¢) o. write(str(f)) o. close() 3. 10 Saving and Loading Complete Sessions Sage has very ? xible support for saving and loading complete sessions. The command save_session(sessionname) saves all the variables youââ¬â¢ve de? ned in the current session as a dictionary in the given sessionname. (In the rare case when a variable does not support saving, it is simply not saved to the dictionary. ) The resulting ? le is an . sobj ? le and can be loaded just like any other object that was saved. When you load the objects saved in a session, you get a dictionary whose keys are the variables names and whose values are the objects. You can use the load_session(sessionname) command to load the variables de? ed in sessionname into the current session. Note that this does not wipe out variables youââ¬â¢ve already de? ned in your current session; instead, the two sessions are merged. First we start Sage and de? ne some variables. 3. 10. Saving and Loading Complete Sessions 61 Sage Tutorial, Release 5. 3 sage: sage: sage: sage: _4 = E = EllipticCurve(ââ¬â¢11aââ¬â¢) M = ModularSymbols(37) a = 389 t = M. T(2003). matrix(); t. charpoly(). factor() (x ââ¬â 2004) * (x ââ¬â 12)^2 * (x + 54)^2 Next we save our session, which saves each of the above variables into a ? le. Then we view the ? le, which is about 3K in size. age: save_session(ââ¬â¢miscââ¬â¢) Saving a Saving M Saving t Saving E sage: quit [ emailà protected]:~/tmp$ ls -l misc. sobj -rw-rââ¬ârââ¬â 1 was was 2979 2006-01-28 19:47 misc. sobj Finally we restart Sage, de? ne an extra variable, and load our saved session. sage: b = 19 sage: load_session(ââ¬â¢miscââ¬â¢) Loading a Loading M Loading E Loading t Each saved variable is again available. Moreover, the variable b was not overwritten. sage: M Full Modular Symbols space for Gamma_0(37) of weight 2 with sign 0 and dimension 5 over Rational Field sage: E Elliptic Curve defined by y^2 + y = x^3 ââ¬â x^2 ââ¬â 10*x ââ¬â 20 over Rational Field sage: b 19 sage: a 389 3. 1 The Notebook Interface The Sage notebook is run by typing sage: notebook() on the command line of Sage. This starts the Sage notebook and opens your default web browser to view it. The serverââ¬â¢s state ? les are stored in $HOME/. sage/sage\_notebook. Other options include: sage: notebook(ââ¬Å"directoryâ⬠) which starts a new notebook server using ? les in the given dir ectory, instead of the default directory $HOME/. sage/sage_notebook. This can be useful if you want to have a collection of worksheets associated with a speci? c project, or run several separate notebook servers at the same time. When you start the notebook, it ? st creates the following ? les in $HOME/. sage/sage_notebook: 62 Chapter 3. The Interactive Shell Sage Tutorial, Release 5. 3 nb. sobj objects/ worksheets/ (the notebook SAGE object file) (a directory containing SAGE objects) (a directory containing SAGE worksheets). After creating the above ? les, the notebook starts a web server. A ââ¬Å"notebookâ⬠is a collection of user accounts, each of which can have any number of worksheets. When you create a new worksheet, the data that de? nes it is stored in the worksheets/username/number directories. In each such directory there is a plain text ? le worksheet. xt ââ¬â if anything ever happens to your worksheets, or Sage, or whatever, that human-readable ? le contains ev erything needed to reconstruct your worksheet. From within Sage, type notebook? for much more about how to start a notebook server. The following diagram illustrates the architecture of the Sage Notebook: ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| | | | | firefox/safari | | | | javascript | | program | | | | | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| ^ | AJAX | V | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â| | | sage | | web | ââ¬âââ¬âââ¬âââ¬â> | server | pexpect | | | | ââ¬âââ¬âââ¬âââ¬âââ¬âââ¬âââ¬â- SAGE process 1 SAGE process 2 SAGE process 3 (Python processes) For help on a Sage command, cmd, in the notebook browser box, type cmd? ). and now hit (not For help on the keyboard shortcuts available in the notebook interface, click on the Help link. 3. 11. The Notebook Interface 63 Sage Tutorial, Release 5. 3 64 Chapter 3. The Interactive Shell CHAPTER FOUR INTERFACES A central facet of Sage is that it supports computation with objects in many different computer algebra systems ââ¬Å"under one roofâ⬠using a common interface and clean programming language. The console and interact methods of an interface do very different things. For example, using GAP as an example: 1. gap. onsole(): This opens the GAP console ââ¬â it transfers control to GAP. Here Sage is serving as nothing more than a convenient program launcher, similar to the Linux bash shell. 2. gap. interact(): This is a convenient way to interact with a running GAP instance that may be ââ¬Å"full ofâ⬠Sage objects. You can import Sage objects into this GAP session (even from the interactive interface), etc. 4. 1 GP/PARI PARI is a compact, very mature, highly optimized C program whose primary focus is number theory. There are two very distinct interfaces that you can use in Sage: â⬠¢ gp ââ¬â the ââ¬Å"G o P ARIâ⬠interpreter, and â⬠¢ pari ââ¬â the PARI C libraxry. For example, the following are two ways of doing the same thing. They look identical, but the output is actually different, and what happens behind the scenes is drastically different. sage: gp(ââ¬â¢znprimroot(10007)ââ¬â¢) Mod(5, 10007) sage: pari(ââ¬â¢znprimroot(10007)ââ¬â¢) Mod(5, 10007) In the ? rst case, a separate copy of the GP interpreter is started as a server, and the string ââ¬â¢znprimroot(10007)ââ¬â¢ is sent to it, evaluated by GP, and the result is assigned to a variable in GP (which takes up space in the child GP processes memory that wonââ¬â¢t be freed). Then the value of that variable is displayed. In the second case, no separate program is started, and the string ââ¬â¢znprimroot(10007)ââ¬â¢ is evaluated by a certain PARI C library function. The result is stored in a piece of memory on the Python heap, which is freed when the variable is no longer referenced. The objects have different types: sage: type(gp(ââ¬â¢znprimroot(10007)ââ¬â¢)) sage: type(pari(ââ¬â¢znprimroot(10007)ââ¬â¢)) So which should you use? It depends on what youââ¬â¢re doing. The GP interface can do absolutely anything you could do in the usual GP/PARI command line program, since it is running that program. In particular, you can load complicated PARI programs and run them. In contrast, the PARI interface (via the C library) is much more restrictive. First, not all 65 Sage Tutorial, Release 5. 3 member functions have been implemented. Second, a lot of code, e. g. , involving numerical integration, wonââ¬â¢t work via the PARI interface. That said, the PARI interface can be signi? cantly faster and more robust than the GP one. (If the GP interface runs out of memory evaluating a given input line, it will silently and automatically double the stack size and retry that input line. Thus your computation wonââ¬â¢t crash if you didnââ¬â¢t correctly anticipate the amount of memory that would be needed. This is a nice trick the usual GP interpreter doesnââ¬â¢t seem to provide. Regarding the PARI C library interface, it immediately copies each created object off of the PARI stack, hence the stack never grows. However, each object must not exceed 100MB in size, or the stack will over? ow when the object is being created. This extra copying does impose a slight performance penalty. ) In summary, Sage uses the PARI C library to provide functionality similar to that provided by the GP/PARI interpreter, except with different sophisticated memory management and the Python programming language. First we create a PARI list from a Python list. age: v = pari([1,2,3,4,5]) sage: v [1, 2, 3, 4, 5] sage: type(v) Every PARI object is of type py_pari. gen. The PARI type of the underlying object can be obtained using the type member function. sage: v. type() ââ¬â¢t_VECââ¬â¢ In PARI, to create an elliptic curve we enter ellinit([1,2,3,4,5]). Sage is similar, except that ellinit is a method th at can be called on any PARI object, e. g. , our t\_VEC v. sage: e = v. ellinit() sage: e. type() ââ¬â¢t_VECââ¬â¢ sage: pari(e)[:13] [1, 2, 3, 4, 5, 9, 11, 29, 35, -183, -3429, -10351, 6128487/10351] Now that we have an elliptic curve object, we can compute some things about it. age: e. elltors() [1, [], []] sage: e. ellglobalred() [10351, [1, -1, 0, -1], 1] sage: f = e. ellchangecurve([1,-1,0,-1]) sage: f[:5] [1, -1, 0, 4, 3] 4. 2 GAP Sage comes with GAP 4. 4. 10 for computational discrete mathematics, especially group theory. Hereââ¬â¢s an example of GAPââ¬â¢s IdGroup function, which uses the optional small groups database that has to be installed separately, as explained below. sage: G = gap(ââ¬â¢Group((1,2,3)(4,5), (3,4))ââ¬â¢) sage: G Group( [ (1,2,3)(4,5), (3,4) ] ) sage: G. Center() Group( () ) 66 Chapter 4. Interfaces Sage Tutorial, Release 5. 3 sage: G. IdGroup() [ 120, 34 ] sage: G. Order() 120 # requires optional database_gap package We can do the same computation in Sage without explicitly invoking the GAP interface as follows: sage: G = PermutationGroup([[(1,2,3),(4,5)],[(3,4)]]) sage: G. center() Subgroup of (Permutation Group with generators [(3,4), (1,2,3)(4,5)]) generated by [()] sage: G. group_id() # requires optional database_gap package [120, 34] sage: n = G. order(); n 120 (For some GAP functionality, you should install two optional Sage packages. Type sage -optional for a list and choose the one that looks like gap\_packages-x. . z, then type sage -i gap\_packages-x. y. z. Do the same for database\_gap-x. y. z. Some non-GPLââ¬â¢d GAP packages may be installed by downloading them from the GAP web site [GAPkg], and unpacking them in $SAGE_ROOT/local/lib/gap-4. 4. 10/pkg. ) 4. 3 Singular Singular provides a massive and mature library for Grobner bases, multivariate polynomial gcds, bases of RiemannRoch spaces of a plane curve, and factorizations, among other things. We illustrate multivariate polynomial factorization using the Sage interface to Singular (do not type the ): sage: R1 = singular. ing(0, ââ¬â¢(x,y)ââ¬â¢, ââ¬â¢dpââ¬â¢) sage: R1 // characteristic : 0 // number of vars : 2 // block 1 : ordering dp // : names x y // block 2 : ordering C sage: f = singular(ââ¬â¢9*y^8 ââ¬â 9*x^2*y^7 ââ¬â 18*x^3*y^6 ââ¬â 18*x^5*y^6 + 9*x^6*y^4 + 18*x^7*y^5 + 36*x^8*y^4 + 9*x^10*y^4 ââ¬â 18*x^11*y^2 ââ¬â 9*x^12*y^3 ââ¬â 18*x^13*y^2 + 9*x^16ââ¬â¢) Now that we have de? ned f , we print it and factor. sage: f 9*x^16-18*x^13*y^2-9*x^12*y^3+9*x^10*y^4-18*x^11*y^2+36*x^8*y^4+18*x^7*y^5-18*x^5*y^6+9*x^6*y^4-18*x^ sage: f. parent() Singular sage: F = f. factorize(); F [1]: _[1]=9 _[2]=x^6-2*x^3*y^2-x^2*y^3+y^4 _[3]=-x^5+y^2 [2]: 1,1,2 sage: F[1][2] x^6-2*x^3*y^2-x^2*y^3+y^4 As with the GAP example in GAP, we can compute the above factorization without explicitly using the Singular interface (however, behind the scenes Sage uses the Singular interface for the actual computation). Do not type the : 4. 3. Singular 67 Sage Tutorial, Release 5. 3 sage: sage: sage: (9) * x, y = QQ[ââ¬â¢x, yââ¬â¢]. gens() f = 9*y^8 ââ¬â 9*x^2*y^7 ââ¬â 18*x^3*y^6 ââ¬â 18*x^5*y^6 + 9*x^6*y^4 + 18*x^7*y^5 + 36*x^8*y^4 + 9*x^10*y^4 ââ¬â 18*x^11*y^2 ââ¬â 9*x^12*y^3 ââ¬â 18*x^13*y^2 + 9*x^16 factor(f) (-x^5 + y^2)^2 * (x^6 ââ¬â 2*x^3*y^2 ââ¬â x^2*y^3 + y^4) 4. 4 Maxima Maxima is included with Sage, as well as a Lisp implementation. The gnuplot package (which Maxima uses by default for plotting) is distributed as a Sage optional package. Among other things, Maxima does symbolic manipulation. Maxima can integrate and differentiate functions symbolically, solve 1st order ODEs, most linear 2nd order ODEs, and has implemented the Laplace tr
Subscribe to:
Comments (Atom)