Recent Changes

Sunday, June 2

  1. page Least Squares Approximation edited ... Function Approximation of Survey Data with Least Squares - Example 1B: Linear Function Approx…
    ...
    Function Approximation of Survey Data with Least Squares - Example 1B: Linear
    Function Approximation with Least Squares - Example 1C: Quadratic
    Function Approximation with Least Squares - Example 1D: Polynomial
    Function Approximation with Least Squares - Example 2: Non-Linear
    Function Approximation with Least Squares - Example 3: Non-Linear
    ...
    In least squares approximation, the "matrix" equation AX=B is non-square. So you CANNOT use "left-division" A\B (as in MatLab). You must use the numpy.linalg command LstSq(A,B).
    All of the matrices except A have one dimension that is 1. Sage (and Python and most programming languages) can determine whether you want to use the row or column form of such matrices. So we can use sage lists or 1xn numpy arrays.
    ...
    an nx2 (or nx3 or nx4) matrix and
    References (linkable):
    NumPy LinAlg Command LstSq - Syntax
    (view changes)
    9:19 am
  2. page Least Squares Approximation edited ... Function Approximation with Least Squares - Example 1: Linear Function Approximation of Surve…
    ...
    Function Approximation with Least Squares - Example 1: Linear
    Function Approximation of Survey Data with Least Squares - Example 1B: Linear
    Function Approximation with Least Squares - Example 1C: Quadratic
    Function Approximation with Least Squares - Example 2: Non-Linear
    Function Approximation with Least Squares - Example 3: Non-Linear
    (view changes)
    12:43 am

Tuesday, April 30

Wednesday, February 20

  1. page home edited ... environment for secondary and college engineering It seeks to be clear and understandabl…

    ...
    environment for secondary and college engineering
    It seeks to be clear and understandable and not complete.
    <--- Search here
    (view changes)
    2:19 am

Saturday, February 16

  1. 5:46 am
  2. page var edited ... Variables must be declared using the command var (see x in example 1). Object names do not ha…
    ...
    Variables must be declared using the command var (see x in example 1).
    Object names do not have to be declared (see h in example 1)
    YouTube Video - pdf
    Syntax: var('x') or var('theta rho z') where x or theta, rho and z are (sample) names that will be used to define function arguments or constants.
         After declaring a variable name, the name can be used to define a function.
    ...
    Result:
    [-2.00000000000000, 2.00000000000000, 8.00000000000000, 16.0000000000000, 26.0000000000000, 38.0000000000000]
    Example 2
    #Look carefully at this. x is the variable in the function. w is just a "variable name". We need to declare both.
    #Here we define a explicit (regular) function f(x) with one independent variable x, a constant w and then evaluate it at x=4.
    var('x w')
    f(x)=w*x*sqrt(x)
    a=f(4)
    print a
    Result:
    8*w

    Keywords: variable, object, name, object name, declare
    (view changes)
    5:42 am

Friday, February 15

  1. page Functions Math edited Home ->Getting Started -> Functions -> Functions Math STOP HERE EXAMPLES ON MY SAGE P…

    Home ->Getting Started -> Functions -> Functions Math
    STOP HERE
    EXAMPLES ON MY SAGE PAGE: Functions in Sage
    Here we are looking at Math Functions. They are two types: built-in or user defined. (See also: Functions Programming and Commands.)
    Definition: A mathematical function is a function that has 1, 2, 3 or more independent variables. You must declare each of the independent variables using the command var before defining or using your function. When you substitute values (numbers) for these variables, the function yields a value.
    (A built-in math function has no options and one parameter. For example, cos(x) is a built-in math function. See list and use at bottom of this page.)
    A user-defined math function can be defined as explicit: f(x)=3x^2 or vector-parametric: r=vector((sin(t),cos(t),t)). It can also be used as implicit: x^2+y^2==0
    Example 1
    # You must declare the variables used in your functions
    #Here we define a explicit (regular) function f(x) with one independent variable x and then evaluate it at x=4.
    var('x')
    f(x)=3*x*sqrt(x)
    a=f(4)
    print a
    Result:
    24
    Example 2
    #Look carefully at this. x is the variable in the function. w is just a "variable name". We need to declare both.
    #Here we define a explicit (regular) function f(x) with one independent variable x, a constant w and then evaluate it at x=4.
    var('x w')
    f(x)=w*x*sqrt(x)
    a=f(4)
    print a
    Result:
    8*w
    Example 3
    #Notice that there is no r(t) at left. There is just r. But with explicit functions you must write f(x).
    #(I think this means you cannot have "constants" in your vector-parametric function.)
    #Notice the double parenthesis around the vector-parametric function.
    var('t')
    r=vector((cos(t),sin(t),t))
    a=f(x=4)
    print a
    Result:
    [-4, 0, 4]
    Built-in Math Functions in Sage
    Function
    Returns the ****  of the argument
    abs(x)
    absolute value
    sqrt(x)
    square root
    exp(x)
     e^x
    log(x)
    natural logarithm
    log(x,10)
    logarithm base 10
    sin(x)
    sine
    cos(x)
    cosine
    tan(x)
    tangent
    asin(x)
    arcsine
    acos(x)
    arccosine
    atan(x)
    arctangent
    cosh(x)
    hyperbolic cosine
    coth(x)
    hyperbolic cotangent
    ceil(x)
    ceiling
    floor(x)
    floor
    int(x)
    integer part
    round(x)
    rounds to whole number
    random()
    random number in the interval [0, 1)

    Pages about Types of Math Functions and Using them in Sage
    {blank15.png}
    (view changes)
    1:43 pm
  2. tag_add var tagged commands2
    1:40 pm
  3. page var edited ... Syntax: var('x') or var('theta rho z') where x or theta, rho and z are (sample) names that wil…
    ...
    Syntax: var('x') or var('theta rho z') where x or theta, rho and z are (sample) names that will be used to define function arguments or constants.
         After declaring a variable name, the name can be used to define a function.
    ...
    a function $f(x)=x^2+3x-2$. Create$f(x)=x^2+3x-2$ and an object named h with value 0.51. Create/print a
    var('x')
    f(x)=x^2+3*x-2
    h=0.5h=1.
    list_f=[f(j) for j in [0..5,step=h] ]
    print list_f
    Result:
    [-2.00000000000000, -0.250000000000000, 2.00000000000000, 4.75000000000000, 8.00000000000000, 11.7500000000000,
    16.0000000000000, 20.7500000000000,
    16.0000000000000, 26.0000000000000, 31.7500000000000, 38.0000000000000]

    Keywords: variable, object, name, object name, declare

    (view changes)
    1:39 pm
  4. page var edited ... Object names do not have to be declared (see h in example 1) YouTube Video ... z are (sam…
    ...
    Object names do not have to be declared (see h in example 1)
    YouTube Video
    ...
    z are (sample) names that
    ...
    arguments or arbitrary constants.
         After declaring a variable name, the name can be used to define a function.
    Example 1 - Create a function $f(x)=x^2+3x-2$. Create an object named h with value 0.5 Create/print a list of values of f(x) for x=0 to 5 step h.
    (view changes)
    1:36 pm

More