{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Glossary of commands\n", "\n", "This file holds a list of all the commands used in MATH1110 Calculus 1.\n", "\n", "\n", "Remember that if you are unsure of how to use a command, you can type its name with a ? and Sage will recall information regarding the command." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### *Contents:*\n", "\n", "\n", "* abs\n", "\n", "* clear_vars\n", "\n", "* derivative\n", "* desolve\n", "* diff\n", "\n", "* expand\n", "\n", "* factor\n", "* factorial\n", "* find_local_minimum\n", "* find_root\n", "* function\n", "\n", "* implicit_plot\n", "* infinity\n", "* integral / integrate\n", "\n", "* lim / limit\n", "* line\n", "* ln / log\n", "\n", "* N\n", "\n", "* Operators (various)\n", "\n", "* parametric_plot\n", "* plot\n", "* point\n", "* polar_plot\n", "* print\n", "\n", "* reset\n", "* round\n", "\n", "* show\n", "* solve\n", "* sqrt\n", "* sum\n", "\n", "* Trigonometry functions (various)\n", "\n", "* var" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### A" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "abs ~ absolute value of a number or expression.\n", "\n", " sage: abs( -7 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### C" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "clear_vars ~ used to reset all previously ran and stored variables. \n", "\n", "$\\hspace{0.6cm}$ No arguments needed. If variables specified, only those within the parentheses will be cleared.\n", "\n", " sage: clear_vars()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### D" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "derivative ~ compute the derivative of a function.\n", "\n", "$\\hspace{0.6cm}$ Required argument: (1) function that is being differentiated.\n", "\n", "$\\hspace{0.6cm}$ Second and third arguments: (2) the variable that is being differentiated with respect two, (3) the order of the derivative.\n", "\n", " sage: derivative(f, x, 1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "desolve ~ solve a differential equation for the function being derived.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) differential equation, (2) function that is being solved for\n", "\n", "$\\hspace{0.6cm}$ Additional argument: (3) initial conditions given for the variable and the function\n", "\n", " sage: desolve( eqn, y, ics = [1, 2] )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "diff ~ alternative for derivative (see above).\n", "\n", " sage: diff(f, x, 1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### E" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "expand ~ expand a factored expression.\n", "\n", "$\\hspace{0.6cm}$ Required argument: expression that is being expanded.\n", "\n", " sage: expand( (x-1)*(x+1) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### F" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "factor ~ factor an expression.\n", "\n", "$\\hspace{0.6cm}$ Required argument: expression that is being factored.\n", "\n", " sage: factor( x^2 - 1 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "factorial ~ takes the factorial (!) of a number or expression.\n", "\n", " sage: factorial(4)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "find_local_minimum ~ find the local minimum value of a function in a given range.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) expression/function, (2) lower bound, and (3) upper bound within which the minimum is being located.\n", "\n", " sage: find_local_minimum( f, 0, 10 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "find_root ~ find the roots of an expression (i.e. where the function is equal to zero).\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) expression for which the roots are being located, (2) lower bound, and (3) upper bound within which a root is being located.\n", "\n", " sage: find_root( f, -5, 0 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "function ~ define a symbol as a function.\n", "\n", "$\\hspace{0.6cm}$ Required argument: symbol that is being defined as a function.\n", "\n", "$\\hspace{0.6cm}$ In the example below, f is defined as a function of a (previously defined) variable x.\n", "\n", " sage: f = function('f')(x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### I" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "infinity ~ positive infinity, also denoted 'oo'.\n", "\n", " sage: infinity" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Implicit_plot ~ plot an implicitly defined curve.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) the equation that is being plotted, (2) the first variable and its domain, (3) the second variable and its domain.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: see options listed for the 'plot' funciton.\n", "\n", " sage: implicit_plot( x*y^3 == tan(y) , (x, -10, 10), (y, -10, 10) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "integral ~ compute the integral of a function.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) the function that is being integrated, (2) the variable that is being integrated with respect to.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: (3) the lower bound of the definite integral, (4) the upper bound of the definite integral.\n", "\n", " sage: integral(f, x)\n", " \n", "\n", "integrate ~ alternative for integral (see above).\n", "\n", " sage: integrate(f, x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### L" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "lim ~ alterative for limit (see below).\n", "\n", " sage: lim(f, x = oo)\n", " \n", "limit ~ take the limit of an expression.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) the function for which the limit is being evaluated, (2) the independent variable assigned to the value which it is approaching.\n", "\n", " sage: limit(f, x = oo)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "line ~ create a line between two points.\n", "\n", "$\\hspace{0.6cm}$ Required argument: the location of the start and end of the line, represented as two ordered pairs in a larger set of square brackets.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: linestyle, color, alpha, and soforth.\n", "\n", " sage: line( [(-pi, 5), (pi, 5)], color = 'green' )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ln ~ the natural logarithm function.\n", "\n", " sage: ln(x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "log ~ the logarithmic function.\n", "\n", "$\\hspace{0.6cm}$ The default base is $e$, **not** base 10, making it equivalent to the natural logarithm.\n", "\n", "$\\hspace{0.6cm}$ Required argument: number or expression within the logarithm.\n", "\n", "$\\hspace{0.6cm}$ Second argument: the base.\n", "\n", " sage: log(x, 10)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### N" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "N ~ express a number as a decimal.\n", "\n", "$\\hspace{0.6cm}$ Additional argument: number of digits desired.\n", "\n", " sage: N( pi, digits = 4 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### O" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Operators, assorted\n", "\n", " * \\+ is the addition operator\n", " * \\- is the subtraction operator\n", " * \\* is the multiplication operator\n", " * / is the division operator\n", " * ^ (or \\*\\*) is the exponent operator\n", " * sqrt(\\_) is the square root operator\n", " \n", " \n", " * (), [], {} are parentheses, square brackets, and curly brackets\n", " \n", " \n", " * = is the assignment operator\n", " * == is an equality\n", " * \\> is greater than\n", " * \\< is less than\n", " * \\>= is greater than or equal to\n", " * \\<= is less than or equal to" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### P" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "parametric_plot ~ plot a parametrically defined curve.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) parametric functions, (2) parameter (variable) and its domain.\n", "\n", "$\\hspace{0,6cm}$ Additional arguments: see options listed for the 'plot' function.\n", "\n", " sage: parametric_plot( (sin(t), cos(t)), (t, -pi, pi) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "plot ~ create a graph of an expression.\n", "\n", "$\\hspace{0.6cm}$ Required argument: (1) function that is being plotted.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: (2) independent variable, (3) the lower bound of domain, (4) the upper bound of domain, and the scaling on the y-axis (ymin / ymax).\n", "\n", "$\\hspace{1cm}$ Graphs can be customized with titles, legends, text, and lines of different colours, styles, thicknesses, etc.\n", "\n", "$\\hspace{1cm}$ See https://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot.html for more options.\n", "\n", " sage: plot(f, x, -10, 10, ymin = -10, ymax = 10, color = 'violet', title = 'Plot of a function')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "point ~ create a point or multiple points on a plot.\n", "\n", "$\\hspace{0.6cm}$ Required argument: location of point(s), inputted as an ordered pair.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: color, size, and shape of the point.\n", "\n", "$\\hspace{0.6cm}$ In the first example, only one point is made at (1, 1). The second example demonstrates correct syntax when creating multiple points.\n", "\n", " sage: point( [1, 1], size = 30, color = 'red')\n", " sage: point( [ [1, 1], [2, 2], [3, 3] ], size = 40, color = 'black')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "polar_plot ~ plot a curve in polar coordinates.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) the expression being plotted, (2) the independent variables with its domain.\n", "\n", "$\\hspace{0.6cm}$ Additional arguments: see options listed for the 'plot' function.\n", "\n", " sage: ploar_plot( sin(theta), (theta, -2*pi, 2*pi) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "print ~ print desired numbers, symbols, or text in the code output.\n", "\n", " sage: print('This is a piece of text.')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### R" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "reset ~ wipe any stored meaning of a previously defined symbol(s).\n", "\n", "$\\hspace{0.6cm}$ No required arguments. If none are specified, all previously defined symbols will be cleared. In the example below, only the variable $x$ will be wiped.\n", "\n", " sage: reset('x')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "round ~ round a number to a specified decimal place.\n", "\n", "$\\hspace{0.6cm}$ Required argument: the number being rounded.\n", "\n", "$\\hspace{0.6cm}$ Second argument: the number of decimal places desired.\n", "\n", " sage: round( sqrt(2), 3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### S" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "show ~ display input in nicer script.\n", "\n", " sage: show( f(x) )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "solve ~ solve an equation for one variable.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) equation, (2) variable to be isolated.\n", "\n", " sage: solve( x^2 - 1 == 0, x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "sqrt ~ take the square root of a number and/or variable.\n", "\n", "$\\hspace{0.6cm}$ Required argument: item being rooted.\n", "\n", " sage: sqrt( 81 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "sum ~ add a sequence of terms together.\n", "\n", "$\\hspace{0.6cm}$ Required arguments: (1) the expression to be summed, (2) the variable, (3) starting value, (4) ending value.\n", "\n", " sage: sum( x^2, x, 0, 10 )" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### T" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Trigonometry functions, assorted\n", "\n", " sin(x), cos(x), tan(x)\n", " \n", " csc(x), sec(x), cot(x)\n", " \n", " arcsin(x), arccos(x), arctan(x)\n", " \n", " arccsc(x), arcsec(x), arccot(x)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### V" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "var ~ define a symbol as a variable.\n", "\n", "$\\hspace{0.6cm}$ Required argument: symbol that is being defined as a variable\n", "\n", " sage: x = var('x')" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.0", "language": "sage", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 2 }