/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/ /* [ Created with wxMaxima version 12.04.0 ] */ /* [wxMaxima: comment start ] Use -1 (-1 on the Mac) to insert a text cell where the cursor is. Otherwise, just start typing where the cursor is to create an input cell. Use -Enter to evaluate a cell. End a cell with $ if you don't want to see the output of a cell. End with semicolon to display the cell evaluation. For a single line cell, the semicolon is added automatically For multiple lines in a cell, use Enter at the end of each line and -Enter to evaluate all of them. There are wxMaxima buttons that make it convenient to do certain things. Use Maxima->Panes->Insert Cell and Maxima->Panes->General Math to display the buttons. The expression % refers to the output of the last evaluation. You can refer to a previous output by, for example, %o54. [wxMaxima: comment end ] */ /* [wxMaxima: comment start ] You can suppress output (end line with $) or display it (end with ; or nothing at all for a single line) [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 500*12$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 500*12; 2^10; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Evaluate some expressions. If you use integers or predefined values such as %e and %pi, wxMaxima will treat the expression as exact. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 2/6; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 3^5; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ log(%e); cos(%pi); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ sqrt(120); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 1/4 + 1/3 + 1/5; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ factor(60); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ factor(100!); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Using a number like 120.0 will cause a "floating point" evaluation by default. The standard precision is about 15-16 digits (standard double precision). The floating point value is normally not exact. It can represent numbers with magnitudes between approximately 10^(-324) to 10^(308). A mixture of exact expressions and floating point is converted to floating point. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sqrt(120.0); sqrt(120); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 1/4.0 + 1/3 + 1/5; 1/4 + 1/3 + 1/5; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can also force evaluation to floating point with the "numer" (short for numeric) suffix. The float function can also be used to force a floating point evaluation. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 1/4 + 1/3 + 1/5, numer; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ float(1/4 + 1/3 + 1/5); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ sqrt(120), numer; %pi, numer; float(1/5); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can create some *big* numbers [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 5^(3^4); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can use the built-in constants. There are other constants like inf (infinity) and minf (-infinity), which are used in integrations and limits. Make a list by enclosing a list of comma-delimited values in square brackets, e.g. [1, 2, %pi, float(%e^5)]. You can use float to get a floating point value of an expression. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ list1 : [%e, %pi, %i, %phi, %gamma]; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Use the append function to append another list to a list [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ list2 : append(list1, [minf, inf]); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ float(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ float(100!); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can also create and evaluate algebraic and other expressions [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 1/(x-1) + 1/(x+1); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ x^4 - 2*x^2 + 1; %, x=10; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ sin(x)*cos(x)^2 + exp(x); %, x=%pi/2; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Trig, inverse trig, exponential and log functions [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ sin(0.8); asin(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ theta: 0.6; tan(theta); sin(theta)/cos(theta); atan(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ exp(2.5); log(%); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can do substitution using a suffix [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ x^2 - 5*x + 7, x=a+b; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ %, expand; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can assign an expressions to a variable using : (equal sign is *not* used for assignment in wxMaxima) We define the variable g below. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g : x^2 - 5*x + 7; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 2*g; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ g, x=a+b; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Create a function with arguments using := A function with arguments allows anything to be used as one of the arguments. An expression is fixed to the actual expression entered with the variables as written. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ff(x) := sin(x)^2; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Calculate some values with this function. wxMaxima treats exact and floating point values differently. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ff(5); ff(5.0); ff(%pi); ff(a), a=5; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can also define a function with define(). There are situations when you need to do it this way. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ define(ff2(x), sin(x)^2); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ff2(5.0); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can factor integers and expressions [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ factor(100!); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ factor(x^2-2*x-15); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Factoring can be applied to previously defined expressions and functions [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ g : x^2 - 2*x - 15; h(x) := x^2 - 2*x - 15; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ factor(g); factor(h(x)); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] You can add factor as a suffix modifier to an expression [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 100!, factor; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] Take the 12th derivative of exp(-x^2) and factor the resulting expression [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ diff(exp(-x^2), x, 12), factor; %, x=0; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] The opposite of factor is expand. You can also use expand as a function or as modifier to an expression [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ expand( (x-5)*(x+3) ); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ (x-5)*(x+3), expand; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ (x-1)^10, expand; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ %, factor; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ (x^2-9) * (x^4-1) * (x+5) * (x^2-6), expand; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ %, factor; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 1/(x^2-1); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ factor(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ expand(%); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] trigexpand transforms trig expressions to terms with sin(x)^n and cos(x)^n trigreduce transforms trig expressions to terms involving sin(n*x) and cos(n*x) [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ trigexpand(sin(4*x) + cos(4*x)); %, trigreduce; %, factor; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] ratsimp makes a common denominator. expand is the approximate opposite of ratsimp [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ ratsimp(1/a + 1/b); ratsimp(1/a + 1/b + 1/c); expand(%); /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ 1/(x-1) + 1/(x+1) + 1; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ ratsimp(%); factor(%); /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] ************ Obscure wxMaxima topic ************* Sometimes not all the digits are displayed for huge exact numbers. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ 70!; /* [wxMaxima: input end ] */ /* [wxMaxima: comment start ] To show all the digits, use set_display(ascii). To go back to hiding digits, use set_display(xml). Yes, this drives me crazy too. [wxMaxima: comment end ] */ /* [wxMaxima: input start ] */ set_display(ascii); 70!; /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ set_display(xml); 70!; /* [wxMaxima: input end ] */ /* Maxima can't load/batch files which end with a comment! */ "Created with wxMaxima"$