MaplePrimes Posts

MaplePrimes Posts are for sharing your experiences, techniques and opinions about Maple, MapleSim and related products, as well as general interests in math and computing.

Latest Post
  • Latest Posts Feed
  • I'm back from presenting work in the "23rd Conference on Applications of Computer Algebra -2017" . It was a very interesting event. This fourth presentation, about "The FunctionAdvisor: extending information on mathematical functions with computer algebra algorithms", describes the FunctionAdvisor project at Maple, a project I started working during 1998, where the key idea I am trying to explore is that we do not need to collect a gazillion of formulas but just core blocks of mathematical information surrounded by clouds of algorithms able to derive extended information from them. In this sense this is also unique piece of software: it can derive properties for rather general algebraic expressions, not just well known tabulated functions. The examples illustrate the idea.

    At the end, there is a link to the presentation worksheet, with which one could open the sections and reproduce the presentation examples.
     

    The FunctionAdvisor: extending information on mathematical functions

    with computer algebra algorithms

     

    Edgardo S. Cheb-Terrab

    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    Abstract:

    A shift in paradigm is happening, from: encoding information into a database, to: encoding essential blocks of information together with algorithms within a computer algebra system. Then, the information is not only searchable but can also be recreated in many different ways and actually used to compute. This talk focuses on this shift in paradigm over a real case example: the digitizing of information regarding mathematical functions as the FunctionAdvisor project of the Maple computer algebra system.

    The FunctionAdvisor (basic)

       

    Beyond the concept of a database

     
      

    " Mathematical functions, are defined by algebraic expressions. So consider algebraic expressions in general ..."

    Formal power series for algebraic expressions

       

    Differential polynomial forms for algebraic expressions

       

    Branch cuts for algebraic expressions

       

    The nth derivative problem for algebraic expressions

       

    Conversion network for mathematical and algebraic expressions

       

    References

       


     

    Download FunctionAdvisor.mw

    Download FunctionAdvisor.pdf

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

    I'm back from presenting work in the "23rd Conference on Applications of Computer Algebra -2017" . It was a very interesting event. This third presentation, about "Computer Algebra in Theoretical Physics", describes the Physics project at Maplesoft, also my first research project at University, that evolved into the now well-known Maple Physics package. This is a unique piece of software and perhaps the project I most enjoy working.

    At the end, there is a link to the presentation worksheet, with which one could open the sections and reproduce the presentation examples.
     

     

     

    Computer Algebra in Theoretical Physics

     

    Edgardo S. Cheb-Terrab

    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    Abstract:

     

    Generally speaking, physicists still experience that computing with paper and pencil is in most cases simpler than computing on a Computer Algebra worksheet. On the other hand, recent developments in the Maple system have implemented most of the mathematical objects and mathematics used in theoretical physics computations, and have dramatically approximated the notation used in the computer to the one used with paper and pencil, diminishing the learning gap and computer-syntax distraction to a strict minimum.

     

    In this talk, the Physics project at Maplesoft is presented and the resulting Physics package is illustrated by tackling problems in classical and quantum mechanics, using tensor and Dirac's Bra-Ket notation, general relativity, including the equivalence problem, and classical field theory, deriving field equations using variational principles.

     

     

     

     

    ... and why computer algebra?

     

    We can concentrate more on the ideas instead of on the algebraic manipulations

     

    We can extend results with ease

     

    We can explore the mathematics surrounding a problem

     

    We can share results in a reproducible way

     

    Representation issues that were preventing the use of computer algebra in Physics

       

    Classical Mechanics

     

    *Inertia tensor for a triatomic molecule

       

    Quantum mechanics

     

    *The quantum operator components of  `#mover(mi("L",mathcolor = "olive"),mo("→",fontstyle = "italic"))` satisfy "[L[j],L[k]][-]=i `ε`[j,k,m] L[m]"

       

    *Unitary Operators in Quantum Mechanics

     

    *Eigenvalues of an unitary operator and exponential of Hermitian operators

       

    *Properties of unitary operators

     

     

    Consider two set of kets " | a[n] >" and "| b[n] >", each of them constituting a complete orthonormal basis of the same space.

    *Verify that "U=(&sum;) | b[k] >< a[k] |" , maps one basis to the other, i.e.: "| b[n] >=U | a[n] >"

       

    *Show that "U=(&sum;) | b[k] > < a[k] | "is unitary

       

    *Show that the matrix elements of U in the "| a[n] >" and  "| b[n] >" basis are equal

       

    Show that A and `&Ascr;` = U*A*`#msup(mi("U"),mo("&dagger;"))`have the same spectrum (eigenvalues)

       

    Schrödinger equation and unitary transform

       

    Translation operators using Dirac notation

       

    *Quantization of the energy of a particle in a magnetic field

       

    Classical Field Theory

     

    The field equations for the lambda*Phi^4 model

       

    *Maxwell equations departing from the 4-dimensional Action for Electrodynamics

       

    *The Gross-Pitaevskii field equations for a quantum system of identical particles

       

    General Relativity

     

    Exact Solutions to Einstein's Equations  Lambda*g[mu, nu]+G[mu, nu] = 8*Pi*T[mu, nu]

       

    *"Physical Review D" 87, 044053 (2013)

       

    The Equivalence problem between two metrics

       

    *On the 3+1 split of the 4D Einstein equations

       

    Tetrads and Weyl scalars in canonical form

       

     

     


     

    Download Physics.mw

    Download Physics.pdf

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

    I'm back from presenting work in the "23rd Conference on Applications of Computer Algebra - 2017" . It was a very interesting event. This second presentation, about "Differential algebra with mathematical functions, symbolic powers and anticommutative variables", describes a project I started working in 1997 and that is at the root of Maple's dsolve and pdsolve performance with systems of equations. It is a unique approach. Not yet emulated in any other computer algebra system.

    At the end, there is a link to the presentation worksheet, with which one could open the sections and reproduce the presentation examples.
     

    Differential algebra with mathematical functions,

    symbolic powers and anticommutative variables

     

    Edgardo S. Cheb-Terrab

    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    Abstract:
    Computer algebra implementations of Differential Algebra typically require that the systems of equations to be tackled be rational in the independent and dependent variables and their partial derivatives, and of course that A*B = A*B, everything is commutative.

     

    It is possible, however, to extend this computational domain and apply Differential Algebra techniques to systems of equations that involve arbitrary compositions of mathematical functions (elementary or special), fractional and symbolic powers, as well as anticommutative variables and functions. This is the subject of this presentation, with examples of the implementation of these ideas in the Maple computer algebra system and its ODE and PDE solvers.

     

     

    restartwith(PDEtools); interface(imaginaryunit = i)

    sys := [diff(xi(x, y), y, y) = 0, -6*(diff(xi(x, y), y))*y+diff(eta(x, y), y, y)-2*(diff(xi(x, y), x, y)) = 0, -12*(diff(xi(x, y), y))*a^2*y-9*(diff(xi(x, y), y))*a*y^2-3*(diff(xi(x, y), y))*b-3*(diff(xi(x, y), x))*y-3*eta(x, y)+2*(diff(eta(x, y), x, y))-(diff(xi(x, y), x, x)) = 0, -8*(diff(xi(x, y), x))*a^2*y-6*(diff(xi(x, y), x))*a*y^2+4*(diff(eta(x, y), y))*a^2*y+3*(diff(eta(x, y), y))*a*y^2-4*eta(x, y)*a^2-6*eta(x, y)*a*y-2*(diff(xi(x, y), x))*b+(diff(eta(x, y), y))*b-3*(diff(eta(x, y), x))*y+diff(eta(x, y), x, x) = 0]

     

    declare((xi, eta)(x, y))

    xi(x, y)*`will now be displayed as`*xi

     

    eta(x, y)*`will now be displayed as`*eta

    (1)

    for eq in sys do eq end do

    diff(diff(xi(x, y), y), y) = 0

     

    -6*(diff(xi(x, y), y))*y+diff(diff(eta(x, y), y), y)-2*(diff(diff(xi(x, y), x), y)) = 0

     

    -12*(diff(xi(x, y), y))*a^2*y-9*(diff(xi(x, y), y))*a*y^2-3*(diff(xi(x, y), y))*b-3*(diff(xi(x, y), x))*y-3*eta(x, y)+2*(diff(diff(eta(x, y), x), y))-(diff(diff(xi(x, y), x), x)) = 0

     

    -8*(diff(xi(x, y), x))*a^2*y-6*(diff(xi(x, y), x))*a*y^2+4*(diff(eta(x, y), y))*a^2*y+3*(diff(eta(x, y), y))*a*y^2-4*eta(x, y)*a^2-6*eta(x, y)*a*y-2*(diff(xi(x, y), x))*b+(diff(eta(x, y), y))*b-3*(diff(eta(x, y), x))*y+diff(diff(eta(x, y), x), x) = 0

    (2)

    casesplit(sys)

    `casesplit/ans`([eta(x, y) = 0, diff(xi(x, y), x) = 0, diff(xi(x, y), y) = 0], [])

    (3)

    NULL

    Differential polynomial forms for mathematical functions (basic)

       

    Differential polynomial forms for compositions of mathematical functions

       

    Generalization to many variables

       

    Arbitrary functions of algebraic expressions

       

    Examples of the use of this extension to include mathematical functions

       

    Differential Algebra with anticommutative variables

       


     

    Download DifferentialAlgebra.mw

    Download DifferentialAlgebra.pdf

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    I'm back from presenting work in the "23rd Conference on Applications of Computer Algebra - 2017" . It was a very interesting event. This first presentation, about "Active Learning in High-School Mathematics using Interactive Interfaces", describes a project I started working 23 years ago, which I believe will be part of the future in one or another form. This is work actually not related to my work at Maplesoft.

    At the end, there is a link to the presentation worksheet, with which one could open the sections and reproduce the presentation examples.
     

     

    Active learning in High-School mathematics using Interactive Interfaces

     

    Edgardo S. Cheb-Terrab

    Physics, Differential Equations and Mathematical Functions, Maplesoft

     

    Abstract:


    The key idea in this project is to learn through exploration using a web of user-friendly Highly Interactive Graphical Interfaces (HIGI). The HIGIs, structured as trees of interlinked windows, present concepts using a minimal amount of text while maximizing the possibility of visual and analytic exploration. These interfaces run computer algebra software in the background. Assessment tools are integrated into the learning experience within the general conceptual map, the Navigator. This Navigator offers students self-assessment tools and full access to the logical sequencing of course concepts, helping them to identify any gaps in their knowledge and to launch the corresponding learning interfaces. An interactive online set of HIGIS of this kind can be used at school, at home, in distance education, and both individually and in a group.

     

     

    Computer algebra interfaces for High-School students of "Colegio de Aplicação"  (UERJ/1994)

       

    Motivation

     

     

    When we are the average high-school student facing mathematics, we tend to feel

     

    • 

    Bored, fragmentarily taking notes, listening to a teacher for 50 or more minutes

    • 

    Anguished because we do not understand some math topics (too many gaps accumulated)

    • 

    Powerless because we don't know what to do to understand (don't have any instant-tutor to ask questions and without being judged for having accumulated gaps)

    • 

    Stressed by the upcoming exams where the lack of understanding may become evident

     

    Computer algebra environments can help in addressing these issues.

     

     

    • 

    Be as active as it can get while learning at our own pace.

    • 

    Explore at high speed and without feeling judged. There is space for curiosity with no computational cost.

    • 

    Feel empowered by success. That leads to understanding.

    • 

    Possibility for making of learning a social experience.

     

    Interactive interfaces

     

     

     

    Interactive interfaces do not replace the teacher - human learning is an emotional process. A good teacher leading good active learning is a positive experience a student will never forget

     

     

    Not every computer interface is a valuable resource, at all. It is the set of pedagogical ideas implemented that makes an interface valuable (the same happens with textbooks)

     

     

    A course on high school mathematics using interactive interfaces - the Edukanet project

     

     

    – 

    Brazilian and Canadian students/programmers were invited to participate - 7 people worked in the project.

     

    – 

    Some funding provided by the Brazilian Research agency CNPq.

    Tasks:

    -Develop a framework to develop the interfaces covering the last 3 years of high school mathematics (following the main math textbook used in public schools in Brazil)

    - Design documents for the interfaces according to given pedagogical guidelines.

    - Create prototypes of Interactive interfaces, running Maple on background, according to design document and specified layout (allow for everybody's input/changes).

     

    The pedagogical guidelines for interactive interfaces

       

    The Math-contents design documents for each chapter

     

    Example: complex numbers

       

    Each math topic:  a interactive interrelated interfaces (windows)

     

     

    For each topic of high-school mathematics (chapter of a textbook), develop a tree of interactive interfaces (applets) related to the topic (main) and subtopics

     

    Example: Functions

     

    • 

    Main window

     

    • 

    Analysis window

    • 

     

    • 

    Parity window

    • 

    Visualization of function's parity

    • 

    Step-by-Step solution window

    The Navigator: a window with a tile per math topic

     

     

     

    • 

    Click the topic-tile to launch a smaller window, topic-specific, map of interrelated sub-topic tiles, that indicates the logical sequence for the sub-topics, and from where one could launch the corresponding sub-topic interactive interface.

    • 

    This topic-specific smaller window allows for identifying the pre-requisites and gaps in understanding, launching the corresponding interfaces to fill the gaps, and tracking the level of familiarity with a topic.

     

     

     

     

     

    The framework to create the interfaces: a version of NetBeans on steroids ...

       

    Complementary classroom activity on a computer algebra worksheet

     

     

    This course is organized as a guided experience, 2 hours per day during five days, on learning the basics of the Maple language, and on using it to formulate algebraic computations we do with paper and pencil in high school and 1st year of undergraduate science courses.

     

    Explore. Having success doesn't matter, using your curiosity as a compass does - things can be done in so many different ways. Have full permission to fail. Share your insights. All questions are valid even if to the side. Computer algebra can transform the learning of mathematics into interesting understanding, success and fun.

    1. Arithmetic operations and elementary functions

       

    2. Algebraic Expressions, Equations and Functions

       

    3. Limits, Derivatives, Sums, Products, Integrals, Differential Equations

       

    4. Algebraic manipulation: simplify, factorize, expand

       

    5. Matrices (Linear Algebra)

       

     

    Advanced students: guiding them to program mathematical concepts on a computer algebra worksheet

       

    Status of the project

     

     

    Prototypes of interfaces built cover:

     

    • 

    Natural numbers

    • 

    Functions

    • 

    Integer numbers

    • 

    Rational numbers

    • 

    Absolute value

    • 

    Logarithms

    • 

    Numerical sequences

    • 

    Trigonometry

    • 

    Matrices

    • 

    Determinants

    • 

    Linear systems

    • 

    Limits

    • 

    Derivatives

    • 

    Derivative of the inverse function

    • 

    The point in Cartesian coordinates

    • 

    The line

    • 

    The circle

    • 

    The ellipse

    • 

    The parabole

    • 

    The hyperbole

    • 

    The conics

    More recent computer algebra frameworks: Maple Mobius for online courses and automated evaluation

       

     


     

    Download Computer_Algebra_in_Education.mw

    Download Computer_Algebra_in_Education.pdf

    Edgardo S. Cheb-Terrab
    Physics, Differential Equations and Mathematical Functions, Maplesoft

    We have just released an update to Maple. Maple 2017.2 includes updated translations for Japanese, Traditional Chinese, Simplified Chinese, Brazilian Portuguese, French, and Spanish. It also contains improvements to the MapleCloud, physics, limits, and PDEs. This update is available through Tools>Check for Updates in Maple, and is also available from our website on the Maple 2017.2 download page.

     Eithne


     

    A geometric construction for the Summer Holiday

     
    Does every plane simple closed curve contain all four vertices of some square?

     This is an old classical conjecture. See:
    https://en.wikipedia.org/wiki/Inscribed_square_problem

    Maybe someone finds a counterexample (for non-analytic curves) using the next procedure and becomes famous!

     

    SQ:=proc(X::procedure, Y::procedure, rng::range(realcons), r:=0.49)
    local t1:=lhs(rng), t2:=rhs(rng), a,b,c,d,s;
    s:=fsolve({ X(a)+X(c) = X(b)+X(d),
                Y(a)+Y(c) = Y(b)+Y(d),
                (X(a)-X(c))^2+(Y(a)-Y(c))^2 = (X(b)-X(d))^2+(Y(b)-Y(d))^2,
                (X(a)-X(c))*(X(b)-X(d)) + (Y(a)-Y(c))*(Y(b)-Y(d)) = 0},
              {a=t1..t1+r*(t2-t1),b=rng,c=rng,d=t2-r*(t2-t1)..t2});  #lprint(s);
    if type(s,set) then s:=rhs~(s)[];[s,s[1]] else WARNING("No solution found"); {} fi;
    end:

     

    Example

     

    X := t->(10-sin(7*t)*exp(-t))*cos(t);
    Y := t->(10+sin(6*t))*sin(t);
    rng := 0..2*Pi;

    proc (t) options operator, arrow; (10-sin(7*t)*exp(-t))*cos(t) end proc

     

    proc (t) options operator, arrow; (10+sin(6*t))*sin(t) end proc

     

    0 .. 2*Pi

    (1)

    s:=SQ(X, Y, rng):
    plots:-display(
       plot([X,Y,rng], scaling=constrained),
       plot([seq( eval([X(t),Y(t)],t=u),u=s)], color=blue, thickness=2));

     

    It appears google doesn't know about the haversine formula.  Huh?  Well at least google can't draw the proper path for it.  I typed in google "distance from Pyongyang to NewYork city"  and got 10,916km.  Ok that's fine but then it drew a map

    The map path definitely did not look right.  Pulled out my globe traced a rough path of the one google showed and I got 13 inches (where 1 inch=660miles) -> 8580 miles = 13808 km .. clearly looks like google goofed. 

    So we need Maple to show us the proper path.
     

    with(DataSets):
    with(Builtin):
    m := WorldMap();
    AddPath(m, [-74.0059, 40.7128], [125.7625, 39.0392]):
    Display(m):
    

    Ok so you say that really doesn't look like the shortest path.  Well, lets visualize that on the globe projection

    Display(m, projection = Globe, orientation = [-180, 0, 0])

    Ah, now it is clear
    Pyonyang_to_NewYork.mw

     

    As a momentary diversion, I threw together a package that downloads map images into Maple using the Google Static Maps API.

    If you have Maple 2017, you can install the package using the MapleCloud Package Manager or by executing PackageTools:-Install("5769608062566400").

    This worksheet has several examples, but I thought I'd share a few below .

    Here's the Maplesoft office

     

    Let's view a roadmap of Waterloo, Ontario.

     

    The package features over 80 styles for roadmaps. These are examples of two styles (the second is inspired by the art of Piet Mondrian and the De Stijl movement)

     

    You can also find the longitude and latitude of a location (courtesy of Google's Geocoding API). Maple returns a nested list if it finds multiple locations.

     

    The geocoding feature can also be used to add points to Maple 2017's built-in world maps.

     

    Let me know what you think!

    The representation of the tangent plane in the form of a square with a given length of the side at any point on the surface.

    The equation of the tangent plane to the surface at a given point is obtained from the condition that the tangent plane is perpendicular to the normal vector. With the aid of any auxiliary point not lying on this normal to the surface, we define the direction on the tangent plane. From the given point in this direction, we lay off segments equal to half the length of the side of our square and with the help of these segments we construct the square itself, lying on the tangent plane with the center at a given point.

    An examples of constructing tangent planes at points of the same intersection line for two surfaces.
    Tangent_plane.mw

    This app is used to study the behavior of water in its different properties besides air. Also included is the study of the fluids in the state of rest ie the pressure generated on a flat surface. Integral developed in Maple for the community of users in space to the civil engineers.

    App_for_fluids_in_flat_state_of_rest.mw

    Lenin Araujo Castillo

    Ambassador of Maple

     

    Yahoo Finance recently discontinued their (largely undocumented) historical stock quote API.

    Previously, you simply send a HTTP:-Get request like this…

    HTTP:-Get(“http://ichart.yahoo.com/table.csv?s=AAPL&a=00&b=1&c=2016&d=00&e=1&f=2017&g=d&ignore=.csv")

    …and get historical OHLCV (open, high, low, close, trading volume) data in your worksheet (in this case for AAPL between 1 January 2016 and 1 January 2017).

    This no longer works! Yahoo shut the door on this easy-to-use and widely disseminated API.

    You can still download historical stock quotes from Yahoo Finance into Maple, but the process is now somewhat more involved. My complete code in this worksheet but I'll step through the process below.

    If you visit the updated Yahoo Finance website and download historical data for a ticker, you see a URL like this in the status bar of your browser

    https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1497727945&period2=1500319945&interval=1d&events=history&crumb=C9luNcNjVkK

    Let's examine how ths URL is constructed.

    • period1 and period2 are Unix time stamps for your start and end date
    • interval is the data retrieval interval (this can be either 1d, 1w or 1m)
    • crumb is an alphanumeric code that’s periodically regenerated every time you download new historical data from from the Yahoo Finance website using your browser. Moreover, crumb is paired with a cookie that’s stored by your browser.

    Here’s how to extract and supply the cookie-crumb pair to Yahoo Finance so you can still use Maple to retrieve historical stock quotes

    Send a dummy request to get a cookie-crumb pair

    res:=HTTP:-Get("https://finance.yahoo.com/lookup?s=bananas"):

    Grab the crumb from the response

    i:=StringTools:-Search("CrumbStore\":{\"crumb\":\"",res[2]):
    crumbValue := res[2][i+22..i+32]
                      crumbValue := "btW01FWTBn3"

    Store the cookie from the response

    cookieHeader:=res[3]["Set-Cookie"]
        cookieHeader := "B=702eqhdcmq7cl&b=3&s=0t; expires=Mon,17-Jul-2018 20:27:01 GMT; path=/; domain=.yahoo.com

    Construct the URL

    • Your desired start and end dates have to be defined as Unix time stamps. Converting a human readable date (like 1st January 2017) to a Unix timestamp is simple, so I won't cover it here.
    • The previously retrieved crumb has to be added to the URL.
    ticker:="AAPL":
    p1 := 1497709183:
    p2 := 1500301183:
    url:=cat("https://query1.finance.yahoo.com/v7/finance/download/",ticker,"?period1=",p1,"&period2=",p2,"&interval=1d&events=history&crumb=", crumbValue):

    Send the request to Yahoo Finance, including the cookie in the header

    data:=HTTP:-Get(url,headers = ["Cookie" = cookieHeader])

    Your historical data is now returned

    The historical data is now easily parsed into a matrix.

    Please note that any use of Yahoo Finance has to be consistent with their terms of service.

    The Lattice package to investigate particle accelerator magnet lattices (original post) has been updated to V1.1. This is a significant update, addressing a number of inaccuracies and bugs of V1.0 as well as introducing new elements: Octupole, Fringe effect in dipoles, a MatchedSection allowing to insert a piece of beamline when the details are irrelevant, and a few experimental elements like WireQuad. New functions include the 6th synchrotron-radiation integral I6x, momentum compaction alphap and TaylorMap, which allows to compute the Taylor expansion of  the non-linear map to any degree.

    The code and documentation are available in the Application Center.

    U. Wienands, aka Mac Dude

     

    A couple of weeks ago, I recorded a short video that discussed various applications for the Statistics:-Fit command. One of the more interesting examples examined how manually adjusting the number of parameters used for a regression model affected the resulting adjusted r-squared value.

    I won’t go into detail about r-squared here, but to briefly summarize: In a linear regression model, r-squared measures the proportion of the variation in a model's dependent variable explained by the independent variables. Basically, r-squared gives a statistical measure of how well the regression line approximates the data. R-squared values usually range from 0 to 1 and the closer it gets to 1, the better it is said that the model performs as it accounts for a greater proportion of the variance (an r-squared value of 1 means a perfect fit of the data). When more variables are added, r-squared values typically increase. They can never decrease when adding a variable; and if the fit is not 100% perfect, then adding a variable that represents random data will increase the r-squared value with probability 1. The adjusted r-squared attempts to account for this phenomenon by adjusting the r-squared value based on the number of independent variables in the model.

    The formula for the adjusted r-squared is:

    Where:

    n is the number of points in the data sample

    k is the number of independent variables in the model excluding the constant

    By taking the number of independent variables into consideration, the adjusted r-squared behaves different than r-squared; adding more variables doesn’t necessarily produce better fitting models. In many cases, more variables can often lead to lower adjusted r-squared values. In particular, if you add a variable representing random data, the expected change in the adjusted r-squared is 0.

    As such, the adjusted r-squared has a slightly different interpretation than the r-squared. While r-squared is perceived to give an indication of the measure of fit for a chosen regression model, the adjusted r-squared is perceived more as a comparative tool that can be useful for picking variables and designing models that may require less predictors than other models. The science of “gaming” models is a broad topic, so I won’t go into any more detail here, but there’s lots of great information out there if you are looking to learn more (here’s a good place to start).

    The following example adjusts a fitted model by adding or removing variables in order to find better adjusted r-squared values.

    with(Statistics):

    The Import command reads a datafile into a new DataFrame.

    ExperimentalData := Import(FileTools:-JoinPath(["Excel", "ExperimentalData.xls"], base = datadir));

    The dataset has seven variables: time and experimental readings for 6 various concentrations. Removing “time” from our variable set, the convert command converts the values in the DataFrame to a Matrix of values.

    ExMat := convert( ExperimentalData, Matrix )[..,2..7];

    We start by fitting a model that includes predicting variables for each of the columns of data. We mark “Concentration A” as our dependent variable.

    Fit( C + C2*v + C3*w + C4*x + C5*y + C6*z, ExMat[..,2..6], ExMat[..,1], [v,w,x,y,z], summarize=embed ):

    From the above, we can observe that both the r-squared and adjusted r-squared are reasonably high, however only one of the coefficient values has a significant p-value, C3.

    Note: Maple shows all p-values less than 0.05 in bold.

    Let's try to fit the data again, this time keeping the two coefficients with the lowest p-values and the intercept.

    Fit( C + C3*v + C5*w, ExMat[..,[3,5]], ExMat[..,1], [v,w], summarize=embed ):

    From the above, we can see that the r-squared value does go down, however the adjusted r-squared goes up! Let's fit the model one last time to see if removing C5 increases or decreases the adjusted r-squared.

    Fit( C + C3*v, ExMat[..,3], ExMat[..,1], [v], summarize=embed ):

    We can see that the final adjusted r-squared value is lower than the previous two, so we are probably better to keep the additional C5 coefficient value.

    You can see this example as well as a couple of other examples of using the Fit command in the following video:

    You can download the worksheet here: https://www.maplesoft.com/applications/view.aspx?SID=154246

    We have just released the 3rd edition of the Mathematics Survival Kit – Maple Edition.

    The Math Survival Kit helps students get unstuck when they are stuck. Sometimes students are prevented from solving a problem, not because they haven’t understood the new concept, but because they forget how to do one of the steps, like completely the square, or dealing with log properties.  That’s where this interactive e- book comes in. It gives students the opportunity to review exactly the concept or technique they are stuck on, work through an example, practice as much (or as little) as they want using randomly generated, automatically graded questions on that exact topic, and then continue with their homework.

    This book covers over 150 topics known to cause students grief, from dividing fractions to integration by parts. This 3rd edition contains 31 additional topics, deepening the coverage of mathematical topics at every level, from pre-high school to university.

    See the Mathematics Survival Kit for more information about this updated e-book, including the complete list of topics.

    eithne

    First 48 49 50 51 52 53 54 Last Page 50 of 300