Example: marketing

Maxima by Example: Ch.4: Solving Equations

Maxima by Example: : Solving Equations Edwin L. WoollettJanuary 29, 2009 Contents4 Solving Equation or Expression: Symbolic Solution or Roots .. Maxima Function solve .. with Expressions or Functions & the multiplicities List .. Quadratic Equation or Function .. Solutions with subst or ev and a Do Loop .. One Argument Form of solve .. disp, display, and print .. Solutions using map .. Code: %% .. an Expression Rather than a Function with Solve .. Escape Speed from the Earth .. Cubic Equation or Expression .. Trigonometric Equation or Expression .. Equation or Expression Containing Logarithmic Functions .. Equation Numerical Solutions: allroots, realroots, ndroot.

4 Solving Equations Maxima has several functions which can be used for solving sets of algebraic equations and for nding the roots of an expression. These are described in the Maxima manual, Sec. 21, and listed under Contents under Equations . This chapter gives examples of the following Maxima functions:

Tags:

  Solving, Equations, Solving equations

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Maxima by Example: Ch.4: Solving Equations

1 Maxima by Example: : Solving Equations Edwin L. WoollettJanuary 29, 2009 Contents4 Solving Equation or Expression: Symbolic Solution or Roots .. Maxima Function solve .. with Expressions or Functions & the multiplicities List .. Quadratic Equation or Function .. Solutions with subst or ev and a Do Loop .. One Argument Form of solve .. disp, display, and print .. Solutions using map .. Code: %% .. an Expression Rather than a Function with Solve .. Escape Speed from the Earth .. Cubic Equation or Expression .. Trigonometric Equation or Expression .. Equation or Expression Containing Logarithmic Functions .. Equation Numerical Solutions: allroots, realroots, ndroot.

2 Of realroots with allroots .. Points of Two Polynomials .. Equations and Roots: ndroot .. ndroot: Quote that Function! .. or More Equations : Symbolic and Numerical Solutions .. or Symbolic Linear Equations with solve or linsolve .. Methods for Linear Equation Sets: linsolvebylu .. Linear Equation Solutions: Matrix Methods .. Solutions from Multiple Right Hand Sides .. Linear Equation Example .. rat Messages: ratprint .. Polynomial Equations .. Sets of Nonlinear Equations : eliminate, mnewton .. of Two Circles: implicitplot .. Using Draw for Implicit Plots .. Another Example .. Error Messages and Do It Yourself Mnewton .. Automated Code for mymnewton.

3 45 This version uses Maxima This is a live document. woollett/for the latestversion of these notes. Send comments and suggestions AND DISTRIBUTION POLICYThis document is part of a series of notes titled Maxima by Example and is made availablevia the author's woollett/to aid new users of the Maxima com-puter algebra PRINTING AND DISTRIBUTION IS may make copies of this document and distribute them to others as long as you charge no more than thecosts of notes (with some modi cations) will be published in book form eventually via in an ar-rangement which will continue to allow unlimited free download of the pdf les as well as the option of orderinga low cost paperbound version of these Solving EquationsMaxima has several functions which can be used for Solving sets of algebraic Equations and for nding theroots of an expression.

4 These are described in the Maxima manual, Sec. 21, and listed under Contents under Equations .This chapter gives examples of the following Maxima functions: solvesolves a system of simultaneous linear or nonlinear polynomial Equations for the speci ed vari-able(s) and returns a list of the solutions. linsolvesolves a system of simultaneous linear Equations for the speci ed variables and returns a list ofthe solutions. ndrootuses a combination of binary search and Newton-Raphson methods for univariate functionsand will nd a root when provided with an interval containing at least one root. allroots nds all the real and complex roots of a real univariate polynomial. realroots nds all of the real roots of a univariate polynomial within a speci ed tolerance.

5 Eliminateeliminates variables from a set of Equations or expressions. linsolvebylusolves a system of linear algebraic Equations by the matrix method known as LU decom-position , and provides a Maxima method to work with a set of linear Equations in terms of the matrix ofcoef cients. newton, naive univariate Newton-Raphson, andmnewton, multivariate Newton-Raphson, can deal withnonlinear function(s).We also encourage the use of two dimensional plots to approximately locate chapter does not yet include Solving Recurrence Relations , and Solving One Hundred Equations . One Equation or Expression: Symbolic Solution or The Maxima Function solveMaxima's ability to solve Equations is limited, but progress is being made in this area.

6 The Maxima man-ual has an extensive entry for the important functionsolve, which you can view in Maxima with the input? solve(no semicolon) followed by (Enter), or the equivalent command:describe(solve)$. The in-putexample(solve)$will show you the manual examples without the manual syntax material. We willpresent some examples of the use ofsolveand not try to cover everything .solvetries to nd exact solutions. Ifsolve(f(x),x)cannot nd an exact solution,solvetries to return asimpli ed version of the original problem. Sometimes the simpli ed version can be useful:(%i1) f(x);(%o1) f(x)(%i2) solve( f(x) 2-1 , x );(%o2) [f(x) = - 1, f(x) = 1]Since Maxima 's idea of what is simpler may not agree with your own, often the returned version is of no Maxima manualsolvesyntax discussion relevant to Solving one equation is:Function:solve(expr, x)Function:solve(expr)Solves the algebraic equationexprfor the variablexand returns a list of solution Equations inx.

7 Ifexpris not an equation, the equationexpr = 0is assumed in its be a function ( (x)), orother non-atomic expression except a sum or be omitted ifexprcontains only one be a rational expression, and may contain trigonometric functions, exponentials, causesolveto express the solutions of cubic or quartic Equations as singleexpressions rather than as made up of several common subexpressions which is the be set to a list of the multiplicities of the individual solutions returned bysolve,realroots, (solve)for the switches which then by used on theindividual switch names if their purpose is not is important to recognise that the rst argument tosolveis either an equation such asf(x) = g(x)(orh(x) = 0), or simplyh(x); in the latter case,solveunderstands that you mean the equationh(x) = 0,and the problem is to nd the roots ofh(x), ie.

8 , values ofxsuch that the equationh(x) = 0is satis we follow the manual suggestion about usingaproposanddescribe:(%i1) apropos(solve);(%o1) [solve, solvedecomposes, solveexplicit, solvefactors, solvenullwarn,solveradcan, solvetrigwarn, solve_inconsistent_error](%i2) describe(solveradcan)$-- Option variable: solveradcanDefault value: `false'When `solveradcan' is `true', `solve' calls `radcan' which makes`solve' slower but will allow certain problems containingexponentials and logarithms to be solved.(%i3) describe(solvetrigwarn)$-- Option variable: solvetrigwarnDefault value: `true'When `solvetrigwarn' is `true', `solve' may print a message sayingthat it is using inverse trigonometric functions to solve theequation, and thereby losing solve with Expressions or Functions & the multiplicities ListLet's start with a simple example where the expected answers are obvious and check the behavior ofsolve.

9 Inparticular we want to checksolve's behavior with both an expression and a function (de ned via:=). We alsowant to check how the system listmultiplicitiesis created and maintained. We include the use ofrealrootsandallrootsin this comparison, even though we will not have to use these latter two functions for a while.(%i1) multiplicities;(%o1) not_set_yet(%i2) ex1 : x 2 - 2*x + 1;2(%o2) x - 2 x + 14(%i3) factor(ex1);2(%o3) (x - 1)(%i4) g(x) := x 2 - 2*x + 1$(%i5) g(y);2(%o5) y - 2 y + 1(%i6) solve(ex1);(%o6) [x = 1](%i7) multiplicities;(%o7) [2](%i8) solve(g(y));(%o8) [y = 1](%i9) multiplicities;(%o9) [2](%i10) realroots(ex1);(%o10) [x = 1](%i11) multiplicities;(%o11) [2](%i12) allroots(ex1).

10 (%o12) [x = , x = ](%i13) multiplicities;(%o13) [2]We see that we can use either an expression or a function withsolve, and you can check that this also appliestorealrootsandallroots. It is not clear from our use ofallrootsabove howallrootsaffectsmultiplicities,althoug h, as we will see later, the manual does not assert any connection, and we would not expect there to be aconnection becauseallrootsreturns multiple roots explicitly in%o12. Just to make sure, let's restart Maximaand use onlyallroots:(%i1) multiplicities;(%o1) not_set_yet(%i2) allroots(x 2 - 2*x + 1);(%o2) [x = , x = ](%i3) multiplicities;(%o3) not_set_yetAs we expected,allrootsdoes not affectmultiplicities; onlysolveandrealrootsset its General Quadratic Equation or FunctionTo get our feet wet, lets turn on the machinery with a general quadratic equation or expression.


Related search queries