Integration of Piecewise Continuous Functions Michel Beaudin, Frédérick Henri, Geneviève Savard ÉTS, Montréal, Canada ACA 2013 Applications of Computer.

Slides:



Advertisements
Similar presentations
The Game of Algebra or The Other Side of Arithmetic The Game of Algebra or The Other Side of Arithmetic © 2007 Herbert I. Gross by Herbert I. Gross & Richard.
Advertisements

Beginning Programming for Engineers
1 TIME 2012 Technology and its Integration in Mathematics Education 12th ACDCA Summer Academy July 10-14, Tartu, Estonia Adopting TI-Nspire CAS technology.
Overview  About ETS: our students, our tools.  What’s New with TI-Npsire CAS?  Different Objects in the Same 2D Plot Window.  Why is Parametric 3D.
Technology and its Integration into Mathematics Education July 6 th -10 th, 2010 E. T. S. I. Telecomunicaciones, Málaga, Spain.
INFINITE SEQUENCES AND SERIES
INTEGRALS The Substitution Rule In this section, we will learn: To substitute a new variable in place of an existing expression in a function,
Laplace Transforms Important analytical method for solving linear ordinary differential equations. - Application to nonlinear ODEs? Must linearize first.
INFINITE SEQUENCES AND SERIES
TECHNIQUES OF INTEGRATION
Matlab Matlab is a powerful mathematical tool and this tutorial is intended to be an introduction to some of the functions that you might find useful.
TIME 2014 Technology in Mathematics Education July 1 st - 5 th 2014, Krems, Austria.
ACA 2014 Applications of Computer Algebra Session: Integration: implementation and applications Fordham University New York, NY, USA, July 9-12.
Solving Linear Equations
Chapter 1 Overall Review of Chapter Expressions and Formulas Students Will Be Able To: Use Order of Operations to Evaluate Expressions Use Formulas.
Chapter 1 Equations, Inequalities, and Mathematical Models 1.4 Complex Numbers.
Introduction To Logarithms. Logarithms were originally developed to simplify complex arithmetic calculations. They were designed to transform multiplicative.
TIME 2014 Technology in Mathematics Education July 1 st - 5 th 2014, Krems, Austria.
ACA 2014 Applications of Computer Algebra Session: Computer Algebra in Education Fordham University New York, NY, USA, July 9-12.
Techniques of Integration
College Algebra Fifth Edition James Stewart Lothar Redlin Saleem Watson.
Integrals 5. Integration Using Tables and Computer Algebra Systems 5.8.
ORDINARY DIFFERENTIAL EQUATION (ODE) LAPLACE TRANSFORM.
Unit 11, Part 2: Introduction To Logarithms. Logarithms were originally developed to simplify complex arithmetic calculations. They were designed to transform.
Sistem Kontrol I Kuliah II : Transformasi Laplace Imron Rosyadi, ST 1.
A Review of Recursion Dr. Jicheng Fu Department of Computer Science University of Central Oklahoma.
More U-Substitution February 17, Substitution Rule for Indefinite Integrals If u = g(x) is a differentiable function whose range is an interval.
5.5 The Substitution Rule In this section, we will learn: To substitute a new variable in place of an existing expression in a function, making integration.
TIME 2012 Technology and its Integration in Mathematics Education 10 th Conference for CAS in Education & Research July 10-14, Tartu, Estonia.
Chapter 1 Equations, Inequalities, and Mathematical Models
Jon Curwin and Roger Slater, QUANTITATIVE METHODS: A SHORT COURSE ISBN © Cengage Chapter 2: Basic Sums.
INTEGRATION ANTIDERIVATIVE: If F ' ( x ) = f ( x ), then F ( x ) is an antiderivative of f ( x ). If F ( x ) and G ( x ) are both antiderivatives of a.
Simultaneous Equations By Dr J.P.M. Whitty
SECOND-ORDER DIFFERENTIAL EQUATIONS Series Solutions SECOND-ORDER DIFFERENTIAL EQUATIONS In this section, we will learn how to solve: Certain.
Solving Linear Equations = 13 What number would make this equation true? That is, what value of would make the left side equal to the right side?
Copyright © Cengage Learning. All rights reserved. 17 Second-Order Differential Equations.
What toolbox is necessary for building exercise environments for algebraic transformations Rein Prank University of Tartu
WEEK 8 SYSTEMS OF EQUATIONS DETERMINANTS AND CRAMER’S RULE.
Chapter P Prerequisites: Fundamental Concepts of Algebra P.4: Polynomials.
Minnesota Mathematics Standards Standards Solving Equations of One Variable Stephanie Woldum, EDHD 5007.
1 Section 5.5 Solving Recurrences Any recursively defined function ƒ with domain N that computes numbers is called a recurrence or recurrence relation.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
Distribution of Student Mistakes between Three Stages of Solution Steps in Case of Action-Object-Input Solution Scheme Dmitri Lepp University of Tartu.
Prepared by Mrs. Azduwin Binti Khasri
Logarithmic, Exponential, and Other Transcendental Functions 5 Copyright © Cengage Learning. All rights reserved.
Section 4.1 – Antiderivatives and Indefinite Integration.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
In section 11.9, we were able to find power series representations for a certain restricted class of functions. Here, we investigate more general problems.
First, a little review: Consider: then: or It doesn’t matter whether the constant was 3 or -5, since when we take the derivative the constant disappears.
INTEGRALS The Substitution Rule In this section, we will learn: To substitute a new variable in place of an existing expression in a function,
Verifying Trigonometric Identities What is an Identity? An identity is a statement that two expressions are equal for every value of the variable. Examples:
TECHNIQUES OF INTEGRATION Integration Using Tables and Computer Algebra Systems In this section, we will learn: How to use tables and computer.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
Copyright © Cengage Learning. All rights reserved. 7 Techniques of Integration.
Verifying Trigonometric Identities Math 25 Marie Bruley Merced College.
5.1 The Natural Logarithmic Function: Differentiation.
Advanced Engineering Mathematics, 7 th Edition Peter V. O’Neil © 2012 Cengage Learning Engineering. All Rights Reserved. CHAPTER 4 Series Solutions.
Representations of Functions as Power Series INFINITE SEQUENCES AND SERIES In this section, we will learn: How to represent certain functions as sums of.
TIME 2012 Technology and its Integration in Mathematics Education 10 th Conference for CAS in Education & Research July 10-14, Tartu, Estonia.
Math for CS Fourier Transforms
DYNAMIC BEHAVIOR OF PROCESSES :
Week 1 Real Numbers and Their Properties (Section 1.6, 1.7, 1.8)
Laplace Transforms.
Advanced Engineering Mathematics 6th Edition, Concise Edition
Using the Real Power of Computer Algebra
SIGMA INSTITUTE OF ENGINEERING
Using Algebra Tiles to Solve Equations, Combine Like Terms, and use the Distributive Property Objective: To understand the different parts of an equation,
Solving Third Degree Polynomial Equations
Subscript and Summation Notation
7 TECHNIQUES OF INTEGRATION.
Presentation transcript:

Integration of Piecewise Continuous Functions Michel Beaudin, Frédérick Henri, Geneviève Savard ÉTS, Montréal, Canada ACA 2013 Applications of Computer Algebra Session: Applications and Libraries Development in Derive and TI-Nspire Malaga, Spain, July 2-6

Abstract Piecewise functions are important in applied mathematics and engineering students need to deal with them often. In Nspire CAS, templates are an easy way to define piecewise functions; in DERIVE, linear combination of indicator functions can be used. Nspire CAS integrates symbolically any piecewise continuous function ─ and returns, as expected, an everywhere continuous antiderivative ─ as long as this function is not multiplied by another expression. DERIVE knows how to integrate sign(a x + b) f(x) where f is an arbitrary function, a and b real numbers and “sign” stands for the signum function: this is why products of a piecewise function with any other expression can be integrated symbolically. This will be the first part of our talk. In the second part of this talk, we will show some implementations that will allow Nspire CAS to integrate symbolically products of piecewise functions with expressions: the starting point was the discovery of a non-documented function of Nspire CAS. Examples of various operations between two piecewise functions will be given. As a final example, we will show how we have defined a Fourier series function in Nspire CAS that performs as well as DERIVE’s built-in “Fourier” function. Keywords: Piecewise functions, integration, Fourier series. 2

Overview 1. Integration of piecewise continuous functions: some problems with Nspire 2. No problem with DERIVE! Why? 3. Our solution: Programming new functions in Nspire 4. Some applications: Fourier Series and deSolve 5. Conclusion 3 I II

Integration of Piecewise Continuous Functions: Problems with Nspire 4

5 Nspire adjusts the constants of integration such that f2 is a continuous function. Nspire has a nice template that helps the user define piecewise continuous functions. Symbolic integration of this kind of function will be performed by Nspire CAS. What Nspire does well :

6 Integration of Piecewise Continuous Functions: Problems with Nspire

7 A problem arises when ∞ appears in one of the subdomains. Nspire can’t compute the antiderivative of this function nor this function. Integration of Piecewise Continuous Functions: Problems with Nspire

8 A problem occurs when the piecewise function is multiplied by another function (even a very simple one). Nspire can’t find the antiderivative. Integration of Piecewise Continuous Functions: Problems with Nspire

9 Nspire can’t compute the exact value… because it does not simplify the product into a single piecewise function. A problem occurs when we multiply 2 piecewise functions. Integration of Piecewise Continuous Functions: Problems with Nspire

No Problem with DERIVE! Why? Defining piecewise functions with some built-in functions (CHI, SIGN, STEP) A very useful integration rule 10

Instead of templates, we may use indicator functions to define piecewise functions in DERIVE. In DERIVE, Indicator (CHI), Signum (SIGN) and Heaviside (STEP) functions are built-in; in Nspire CAS, only sign is implemented. No problem with DERIVE! Why? 11 Defining Piecewise Functions

12 No problem with DERIVE! Why? Defining Piecewise Functions DERIVE uses the following definitions:

13 No problem with DERIVE! Why? Defining Piecewise Functions Even though STEP and CHI are not built-in in Nspire, one can easily define them.

For example, if we need the piece of f(x) between -2 and 1, we just multiply f(x) by CHI(-2, x, 1): Values at the extremities of the subintervals are irrelevant, as far as integration is concerned. 14 No problem with DERIVE! Why? Defining Piecewise Functions We define piecewise functions in DERIVE as a combination of CHI functions.

An other example : 15 No problem with DERIVE! Why? Defining Piecewise Functions

16 Nspire DERIVE No problem with DERIVE! Why? Integrating Piecewise Functions Both systems can integrate the piecewise function f1(x).

17 DERIVE As you can see, the constants of integration differ. No problem with DERIVE! Why? Integrating Piecewise Functions Nspire

18 We have seen that Nspire CAS is unable to integrate symbolically a product of a piecewise function with another expression. No problem with DERIVE! Why? Integrating Product with Piecewise Functions Can DERIVE find the antiderivative?

19 DERIVE is able to compute the antiderivative of f1(x)cos(x). No problem with DERIVE! Why? Integrating Product with Piecewise Functions

20 No problem with DERIVE! Why? Integrating Product of 2 Piecewise Functions We have seen that Nspire CAS is unable to integrate symbolically a product of 2 piecewise function.

21 Let’s compute the same integration with DERIVE. The exact value. DERIVE unifies the product into a combination of SIGN functions. No problem with DERIVE! Why? Integrating Product of 2 Piecewise Functions

The reasons: 1. Piecewise functions are defined as a combination of CHI functions (and this simplifies to SIGN functions). 2. DERIVE knows the rule 22 R1 No problem with DERIVE! Why?

This rule is combined with the following rule when DERIVE computes an integral involving an absolute value. For example, 23 No problem with DERIVE! Why? R1

24 Our Solution: Programming New Functions in Nspire

25 Because Nspire CAS is able to integrate symbolically a unique piecewise function (as long as no infinity appears in the domain!) we thought : a)to transform the product f1(x)f2(x) into a single piecewise function, b)to “remove” every occurence of “infinity” in the domain, c)and to use the built-in integrator to compute definite or indefinite integrals. Programming New Functions in Nspire

26 We want Nspire CAS to continue using its own − attractive − templates instead of using indicator functions. Programming New Functions in Nspire

27 Our colleague Frédérick Henri (“Fred”) has programmed some simple but quite efficient functions. a) grouper_fct groups in a single piecewise function an expression that contains one or more piecewise subexpressions. b) fct_sans_infini removes every occurence of ∞ or -∞ in the domain. c) integral_mcx symbolically integrates (indefinite integral) and integral_mcx_d computes exactly the definite integral using the built-in integrator. Programming New Functions in Nspire

28 Programming New Functions in Nspire A few examples… grouper_fct return a single piecewise function Nspire is unable to unify the product.

29 Programming New Functions in Nspire Without Fred’s package : no exact value. integral_mcx_d computes exactly the definite integral. A few examples…

30 Programming New Functions in Nspire We observe the same result when using DERIVE.

31 integral_mcx integrates symbolically (indefinite integral). Programming New Functions in Nspire grouper_fct also works with exponentiation.

32 Let’s explain some simple algorithms and show some code. First of all, in order to manipulate piecewise functions, we need a command to extract pieces of the function. Extraction is not documented into Nspire CAS user guide, but the following “discovery” saved us! Programming New Functions in Nspire part()

33 Programming New Functions in Nspire

34 part() is similar to Maple’s op() Programming New Functions in Nspire 8x8x + 9yz + * 8x * z * 9y

35 unifier_fcts(f1(x), "/", f2(x), x) Programming New Functions in Nspire

36 Then fct_sans_infini(f3(x)) Programming New Functions in Nspire

grouper_fct(f, x) : generalizes unifier_fcts by working recursively (in case of more complicated functions). 37 Programming New Functions in Nspire

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 38 Programming New Functions in Nspire * part(f, 0 ) part(f,1)part(f,2) f part(f,1)

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 39 Programming New Functions in Nspire * part(f, 0 ) part(f,1)part(f,2) f f 6x6x 1 + f doesn’t contain piecewise subexp. Return 6x+1

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 40 Programming New Functions in Nspire * part(f,0) 6x+1 f1(x) part(f,2) f f 5 part(f,1) part(f,2) +

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 41 Programming New Functions in Nspire * part(f,0) part(f,2) f f 6x+1 f1(x) 5 part(f,1) part(f,2) +

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 42 Programming New Functions in Nspire * part(f, 0 ) 6x+1 f1(x) f2(x) f f

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 43 Programming New Functions in Nspire * part(f,0) f 6x+1 f1(x) f2(x)

grouper_fct(f, x) := operator := part(f, 0) If f doesn’t contain a piecewise subexpression Then Return f Else f1(x):= grouper_fct(part(f, 1), x) f2(x):= grouper_fct(part(f, 2), x) Return unifier_fcts(f1(x), operator, f2(x), x) Endif 44 Programming New Functions in Nspire f

45 Some Applications: Fourier Series and deSolve with Nspire

46 Let us recall that if an expression f of the variable t is defined over the interval t1 < t < t2 and extended outside the interval by periodicity (the period being P = t2 - t1), then the Fourier polynomial of order n of f is the following trigonometric polynomial: Some Applications: Fourier Series

47 And this is DERIVE’s definition from the library “Applications of Integration”. Some Applications: Fourier Series

48 At ETS, when students need to compute the Fourier coefficients of a periodic signal, they use their TI-Nspire CX CAS handheld to compute the integrals (for the Fourier coefficients). Then, they store the coefficients and are able to produce any partial sum in exact arithmetic. Some Applications: Fourier Series

49 The signal is neither odd nor even. So, using Nspire CAS, we compute the Fourier coefficients, splitting the integrals ourselves into two parts! Here is an example. Students are asked to find the Fourier series of the following 2 - periodic signal. Some Applications: Fourier Series

50 We split the integrals into two parts. Then we “inform” Nspire CAS that “n” is an integer (in order to simplify the Fourier coefficients). Some Applications: Fourier Series

51 Some Applications: Fourier Series

52 As mathematics teachers, we are comfortable with this procedure and don’t see any reason to stop using it. But on the computer algebra side, being able to automate this procedure is something interesting. We are still teaching some integration techniques despite the fact that the CAS system has a built-in integrator! So, why not define, in Nspire CAS, a “Fourier” function like the one DERIVE has? Some Applications: Fourier Series

53 The main goal is to have a Fourier series function able to work in exact mode for piecewise signals. This is where the function integral_mcx_d will be useful, replacing the TI’s built-in integrator. So, we have defined a “Fourier series function” in Nspire CAS. Using the same syntax as DERIVE and replacing the built-in TI integrator by the integral_mcx_d function. Let’s check the result. Some Applications: Fourier Series

54 Some Applications: Fourier Series

55 Let us mention another interesting application. With the command “deSolve”, Nspire CAS can easily solve second order differential equations with constant coefficients … as long as the RHS of the differential equation consists of a single piece. Nspire CAS solves a linear second order ODE by using the method of variation of parameters. This method involves computing integrals. Some Applications: deSolve

56 For example, if we try to find a general solution to We will find this: Observe the two integrals that Nspire CAS can’t compute. Some Applications: deSolve

57 When the RHS of an ODE is piecewise, Laplace transforms are usually used. But in this example, t can accept negative values. With its command “DSOLVE2”, DERIVE can solve the former ODE because DERIVE can compute the last integrals. So, we have programmed our own desolve2_gen command. Some Applications: deSolve

58 Our method is still using the variation of parameters but the built-in integrator of Nspire CAS is replaced by Fred’s function integral_mcx_d. Let us do the example once more. Some Applications: deSolve

59 Some Applications: deSolve This command is able to find a general solution to the ODE y’’ + 5y + 6y = f(t). It’s always important to verify the answer!

Conclusion 60

Conclusion 61 At ÉTS, we have adopted TI technology. It started in 1999 with the TI-92 Plus; then V200 in 2002 and Nspire CAS CX since in The CAS system is appropriate for engineering mathematics at the undergraduate level. But many mathematics teachers are still using CAS software like Maple or DERIVE; as a consequence, they often want Nspire CAS to be able to perform as well as these systems!

Conclusion 62 In the past two years, we have been asking TI to launch a new OS version of their CAS system. For the moment, most of their efforts have been on the side of the overall interface of Nspire CAS. This is correct. But, for mathematicians, the CAS engine should be ranked first. “If you want something done right, do it yourself”.

Conclusion 63 The mathematicians needed the help of a programmer. Frédérick Henri started to work with us. A new team of researchers was formed. In this talk, we showed some results of our collaboration. With these new functions programmed by Frédérick Henri, the built-in integrator of Nspire CAS can now be extended to products of piecewise functions.

Conclusion 64 One consequence we showed was the definition of a “Fourier function” similar to DERIVE’s one. And when the TI built-in integrator will be able to integrate symbolically piecewise expressions, its “deSolve” command will become better.

Conclusion 65 The tns file “Kit_ETS_FH” is available for download at The Website also contains many examples for using TI-Nspire CAS for undergraduate engineering studies.

66 Thank You! Michel Beaudin, Frédérick Henri, Geneviève Savard ÉTS, Montréal, Canada