Entrance Announcement
MICTE
2080
2080 Magh 07
Please contact us
Editing
User:Niraj/Teaching-17
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
'''Teaching lesson plan 17 Subject: Python programming''' '''Date: 2 Feb 2024''' '''Time: 60 minutes''' '''Period: 3rd''' '''Teaching Item: Universal Array Functions in NumPy''' '''Class: Bachelor''' '''Objective:''' Students will learn about universal array functions (ufuncs) in NumPy, understand their role in performing element-wise operations on arrays, and apply them to manipulate array data efficiently. '''Materials Needed:''' * Python interpreter with NumPy installed or IDE * Projector '''1. Introduction to Universal Array Functions (10 mins)''' * Define universal array functions (ufuncs): ** Ufuncs are functions in NumPy that operate element-wise on arrays. ** They provide efficient vectorized operations for array manipulation. * Discuss the importance of ufuncs in numerical computing and array-oriented programming. '''2. Basic Ufuncs (15 mins)''' * Introduce basic ufuncs for arithmetic operations: ** Addition: <code>numpy.add()</code> ** Subtraction: <code>numpy.subtract()</code> ** Multiplication: <code>numpy.multiply()</code> ** Division: <code>numpy.divide()</code> ** Exponentiation: <code>numpy.power()</code> * Demonstrate how to use these ufuncs to perform element-wise operations on arrays with examples. '''3. Trigonometric Ufuncs (10 mins)''' * Explore trigonometric ufuncs for mathematical functions: ** Sine: <code>numpy.sin()</code> ** Cosine: <code>numpy.cos()</code> ** Tangent: <code>numpy.tan()</code> ** Arcsine: <code>numpy.arcsin()</code> ** Arccosine: <code>numpy.arccos()</code> ** Arctangent: <code>numpy.arctan()</code> * Show examples of applying trigonometric functions to arrays of angles. '''4. Exponential and Logarithmic Ufuncs (10 mins)''' * Discuss exponential and logarithmic ufuncs: ** Exponential: <code>numpy.exp()</code> ** Natural logarithm: <code>numpy.log()</code> ** Base-10 logarithm: <code>numpy.log10()</code> ** Base-2 logarithm: <code>numpy.log2()</code> * Demonstrate how to use these ufuncs to compute exponentials and logarithms of array elements. '''5. Comparison Ufuncs (10 mins)''' * Introduce comparison ufuncs for element-wise comparisons: ** Equal to: <code>numpy.equal()</code> ** Not equal to: <code>numpy.not_equal()</code> ** Greater than: <code>numpy.greater()</code> ** Greater than or equal to: <code>numpy.greater_equal()</code> ** Less than: <code>numpy.less()</code> ** Less than or equal to: <code>numpy.less_equal()</code> * Show examples of using comparison ufuncs to perform element-wise comparisons and generate boolean arrays. '''6. Exercise (15 mins)''' * Provide a programming exercise where students: ** Write code to create arrays and apply different ufuncs to perform element-wise operations. ** Experiment with various mathematical functions, trigonometric functions, exponentials, logarithms, and comparisons. ** Explore the behavior of ufuncs with arrays of different shapes and data types. '''7. Conclusion (5 mins)''' * Recap the key points covered in the lesson: ** Universal array functions (ufuncs) in NumPy provide efficient element-wise operations on arrays. ** Ufuncs include basic arithmetic operations, trigonometric functions, exponential functions, logarithmic functions, and comparison operations. ** Ufuncs enable vectorized computations, improving performance and readability of array manipulation code. * Encourage students to practice using ufuncs in their own projects and to explore additional ufuncs and their capabilities.
Summary:
Please note that all contributions to ICTED-WIKI may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
ICTED-WIKI:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
User page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
User contributions
Logs
View user groups
Special pages
Page information