This document discusses single dimensional arrays in NumPy. It explains how to create arrays using NumPy functions like array(), linspace(), logspace(), arange(), zeros(), ones() and perform vectorized operations on arrays. Mathematical operations like sin(), log(), abs() can be applied to arrays. Arrays can be compared using relational operators which return Boolean arrays. Functions like any() and all() help compare arrays.
Arrays in Python can hold multiple values and each element has a numeric index. Arrays can be one-dimensional (1D), two-dimensional (2D), or multi-dimensional. Common operations on arrays include accessing elements, adding/removing elements, concatenating arrays, slicing arrays, looping through elements, and sorting arrays. The NumPy library provides powerful capabilities to work with n-dimensional arrays and matrices.
NumPy is a Python library that provides multidimensional array and matrix objects, along with tools to work with these objects. It is used for working with arrays and matrices, and has functions for linear algebra, Fourier transforms, and matrices. NumPy was created in 2005 and provides fast operations on arrays and matrices.
This document discusses Python arrays and their methods. It begins by explaining that arrays are similar to lists but have constrained data types. Various array methods are described such as insert(), append(), remove(), and reverse(). Limitations of arrays include only supporting one-dimensional structures; NumPy must be used for multi-dimensional arrays. Example code is provided to create integer and float arrays and print their values.
NumPy provides two fundamental objects for multi-dimensional arrays: the N-dimensional array object (ndarray) and the universal function object (ufunc). An ndarray is a homogeneous collection of items indexed using N integers. The shape and data type define an ndarray. NumPy arrays have a dtype attribute that returns the data type layout. Arrays can be created using the array() function and have various dimensions like 0D, 1D, 2D and 3D.
This document provides information about arrays in C programming. It defines an array as a linear list of homogeneous elements stored in consecutive memory locations. It notes that arrays always start at index 0 and end at size-1. It describes one-dimensional and multi-dimensional arrays. For one-dimensional arrays, it provides examples of declaration, definition, accessing elements, and several programs for operations like input, output, finding the largest element, and linear search. For multi-dimensional arrays, it describes how they are represented and defined with multiple subscript variables. It also includes a program to add two matrices as an example of a two-dimensional array.
This document discusses arrays in C programming. It defines an array as a collection of variables of the same type that are referenced by a common name. It describes single-dimensional and multi-dimensional arrays. Single-dimensional arrays are comprised of finite, homogeneous elements while multi-dimensional arrays have elements that are themselves arrays. The document provides examples of declaring, initializing, accessing, and implementing arrays in memory for both single and double-dimensional arrays. It includes sample programs demonstrating various array operations.
This document discusses arrays in F# and provides examples of creating and manipulating arrays. It covers:
1. Three ways to create arrays - with semicolon separators, without separators, and using sequence expressions.
2. Accessing array elements using dot notation and indexes, and slice notation to access subranges.
3. Common functions for creating arrays like Array.create, Array.init, and Array.zeroCreate.
4. Other useful functions like Array.copy, Array.append, Array.map, Array.filter, and Array.reverse.
5. An example showing the Apartment type and creating an array of apartments to demonstrate array functions.
This document discusses arrays in C#, including declaring and creating arrays, accessing array elements, input and output of arrays, iterating over arrays using for and foreach loops, dynamic arrays using List<T>, and copying arrays. It provides examples of declaring, initializing, accessing, reversing, and printing arrays. It also covers reading arrays from console input, checking for symmetry, and processing arrays using for and foreach loops. Lists are introduced as a resizable alternative to arrays. The document concludes with exercises for practicing various array techniques.
Arrays are data structures that store a collection of data values of the same type in consecutive memory locations that can be individually referenced by their numeric index. Different representations of arrays are possible including using a single block of memory or a collection of elements. Common operations on arrays include retrieving or storing elements by their index and traversing the entire array sequentially.
This document discusses Python arrays. Some key points:
1) An array is a mutable object that stores a collection of values of the same data type. It stores homogeneous data and its size can be increased or decreased dynamically.
2) The array module provides various methods and classes to easily process arrays. Arrays are more memory and computationally efficient than lists for large amounts of data.
3) Arrays only allow homogeneous data types while lists can contain different data types. Arrays must be declared before use while lists do not require declaration.
Arrays are sequences of elements of the same type that can be accessed using an index. Multidimensional arrays have more than one index and are used to represent matrices. Dynamic arrays like lists can resize automatically when elements are added or removed. Common operations on arrays include initialization, accessing elements, iterating with for/foreach loops, and copying arrays.
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
Homework Assignment – Array Technical Document
Write a technical document that describes the structure and use of arrays. The document should
be 3 to 5 pages and include an Introduction section, giving a brief synopsis of the document and
arrays, a Body section, describing arrays and giving an annotated example of their use as a
programming construct, and a conclusion to revisit important information about arrays described
in the Body of the document. Some suggested material to include:
Declaring arrays of various types
Array pointers
Printing and processing arrays
Sorting and searching arrays
Multidimensional arrays
Indexing arrays of various dimension
Array representation in memory by data type
Passing arrays as arguments
If you find any useful images on the Internet, you can use them as long as you cite the source in
end notes.
Solution
Array is a collection of variables of the same type that are referenced by a common name.
Specific elements or variables in the array are accessed by means of index into the array.
If taking about C, In C all arrays consist of contiguous memory locations. The lowest address
corresponds to the first element in the array while the largest address corresponds to the last
element in the array.
C supports both single and multi-dimensional arrays.
1) Single Dimension Arrays:-
Syntax:- type var_name[size];
where type is the type of each element in the array, var_name is any valid identifier, and size is
the number of elements in the array which has to be a constant value.
*Array always use zero as index to first element.
The valid indices for array above are 0 .. 4, i.e. 0 .. number of elements - 1
For Example :- To load an array with values 0 .. 99
int x[100] ;
int i ;
for ( i = 0; i < 100; i++ )
x[i] = i ;
To determine to size of an array at run time the sizeof operator is used. This returns the size in
bytes of its argument. The name of the array is given as the operand
size_of_array = sizeof ( array_name ) ;
2) Initialisg array:-
Arrays can be initialised at time of declaration in the following manner.
type array[ size ] = { value list };
For Example :-
int i[5] = {1, 2, 3, 4, 5 } ;
i[0] = 1, i[1] = 2, etc.
The size specification in the declaration may be omitted which causes the compiler to count the
number of elements in the value list and allocate appropriate storage.
For Example :- int i[ ] = { 1, 2, 3, 4, 5 } ;
3) Multidimensional array:-
Multidimensional arrays of any dimension are possible in C but in practice only two or three
dimensional arrays are workable. The most common multidimensional array is a two
dimensional array for example the computer display, board games, a mathematical matrix etc.
Syntax :type name [ rows ] [ columns ] ;
For Example :- 2D array of dimension 2 X 3.
int d[ 2 ] [ 3 ] ;
A two dimensional array is actually an array of arrays, in the above case an array of two integer
arrays (the rows) each with three elements, and is stored row-wise in memory.
For Example :- Program to fill .
The document discusses arrays in C programming. Some key points include:
- An array is a collection of variables of the same type referred to by a common name. Each element has an index and arrays use contiguous memory locations.
- Arrays are declared with the type, name, and size. The first element is at index 0.
- One-dimensional arrays can be initialized, accessed, input from and output to the user. Multidimensional arrays like 2D arrays represent tables with rows and columns.
- Arrays can be passed to functions by passing the entire array or individual elements. Operations like searching, sorting and merging can be performed on arrays.
NumPy arrays can be created from Python lists by passing the list to the np.array() method. NumPy arrays differ from lists in that elements are stored contiguously in memory without comma separators. Multi-dimensional arrays can be created from nested lists. NumPy array attributes like shape and ndim provide information about array dimensions and elements. Individual elements can be accessed using indexes, and whole arrays or subsets of arrays can undergo vectorized operations for efficient processing.
C programming language allows for the declaration of arrays, which can store a fixed number of elements of the same data type. Arrays provide an efficient way to store and access related data sequentially in memory. Individual elements in an array are accessed via an index, and multi-dimensional arrays can model tables of data with multiple indices to access each element.
The Array class in ActionScript 3.0 allows you to create and manipulate arrays. Arrays can store any data type and are zero-indexed. You can create an Array using the new Array() constructor or array literal syntax ([]). Arrays are sparse, meaning they may have undefined elements. Array assignment is by reference. The Array class should not be used to create associative arrays, instead use the Object class.
In this chapter we are going to get familiar with some of the basic presentations of data in programming: lists and linear data structures. Very often in order to solve a given problem we need to work with a sequence of elements. For example, to read completely this book we have to read sequentially each page, i.e. to traverse sequentially each of the elements of the set of the pages in the book. Depending on the task, we have to apply different operations on this set of data. In this chapter we will introduce the concept of abstract data types (ADT) and will explain how a certain ADT can have multiple different implementations. After that we shall explore how and when to use lists and their implementations (linked list, doubly-linked list and array-list). We are going to see how for a given task one structure may be more convenient than another. We are going to consider the structures "stack" and "queue", as well as their applications. We are going to get familiar with some implementations of these structures.
The document discusses arrays and array data structures. It defines an array as a set of index-value pairs where each index maps to a single value. It then describes the common array abstract data type (ADT) with methods like create, retrieve, and store for manipulating arrays. The document also discusses sparse matrix data structures and provides an ADT for sparse matrices with methods like create, transpose, add, and multiply.
C programming language provides arrays as a data structure to store a fixed-size collection of elements of the same type. An array stores elements in contiguous memory locations. Individual elements in an array can be accessed using an index. Common array operations in C include declaration, initialization, accessing and modifying individual elements, and passing arrays to functions.
Third Review PPT that consists of the project d etails like abstract.Sowndarya6
CyberShieldX is an AI-driven cybersecurity SaaS web application designed to provide automated security analysis and proactive threat mitigation for business websites. As cyber threats continue to evolve, traditional security tools like OpenVAS and Nessus require manual configurations and lack real-time automation. CyberShieldX addresses these limitations by integrating AI-powered vulnerability assessment, intrusion detection, and security maintenance services. Users can analyze their websites by simply submitting a URL, after which CyberShieldX conducts an in-depth vulnerability scan using advanced security tools such as OpenVAS, Nessus, and Metasploit. The system then generates a detailed report highlighting security risks, potential exploits, and recommended fixes. Premium users receive continuous security monitoring, automatic patching, and expert assistance to fortify their digital infrastructure against emerging threats. Built on a robust cloud infrastructure using AWS, Docker, and Kubernetes, CyberShieldX ensures scalability, high availability, and efficient security enforcement. Its AI-driven approach enhances detection accuracy, minimizes false positives, and provides real-time security insights. This project will cover the system's architecture, implementation, and its advantages over existing security solutions, demonstrating how CyberShieldX revolutionizes cybersecurity by offering businesses a smarter, automated, and proactive defense mechanism against ever-evolving cyber threats.
This document provides information about arrays in C programming. It defines an array as a linear list of homogeneous elements stored in consecutive memory locations. It notes that arrays always start at index 0 and end at size-1. It describes one-dimensional and multi-dimensional arrays. For one-dimensional arrays, it provides examples of declaration, definition, accessing elements, and several programs for operations like input, output, finding the largest element, and linear search. For multi-dimensional arrays, it describes how they are represented and defined with multiple subscript variables. It also includes a program to add two matrices as an example of a two-dimensional array.
This document discusses arrays in C programming. It defines an array as a collection of variables of the same type that are referenced by a common name. It describes single-dimensional and multi-dimensional arrays. Single-dimensional arrays are comprised of finite, homogeneous elements while multi-dimensional arrays have elements that are themselves arrays. The document provides examples of declaring, initializing, accessing, and implementing arrays in memory for both single and double-dimensional arrays. It includes sample programs demonstrating various array operations.
This document discusses arrays in F# and provides examples of creating and manipulating arrays. It covers:
1. Three ways to create arrays - with semicolon separators, without separators, and using sequence expressions.
2. Accessing array elements using dot notation and indexes, and slice notation to access subranges.
3. Common functions for creating arrays like Array.create, Array.init, and Array.zeroCreate.
4. Other useful functions like Array.copy, Array.append, Array.map, Array.filter, and Array.reverse.
5. An example showing the Apartment type and creating an array of apartments to demonstrate array functions.
This document discusses arrays in C#, including declaring and creating arrays, accessing array elements, input and output of arrays, iterating over arrays using for and foreach loops, dynamic arrays using List<T>, and copying arrays. It provides examples of declaring, initializing, accessing, reversing, and printing arrays. It also covers reading arrays from console input, checking for symmetry, and processing arrays using for and foreach loops. Lists are introduced as a resizable alternative to arrays. The document concludes with exercises for practicing various array techniques.
Arrays are data structures that store a collection of data values of the same type in consecutive memory locations that can be individually referenced by their numeric index. Different representations of arrays are possible including using a single block of memory or a collection of elements. Common operations on arrays include retrieving or storing elements by their index and traversing the entire array sequentially.
This document discusses Python arrays. Some key points:
1) An array is a mutable object that stores a collection of values of the same data type. It stores homogeneous data and its size can be increased or decreased dynamically.
2) The array module provides various methods and classes to easily process arrays. Arrays are more memory and computationally efficient than lists for large amounts of data.
3) Arrays only allow homogeneous data types while lists can contain different data types. Arrays must be declared before use while lists do not require declaration.
Arrays are sequences of elements of the same type that can be accessed using an index. Multidimensional arrays have more than one index and are used to represent matrices. Dynamic arrays like lists can resize automatically when elements are added or removed. Common operations on arrays include initialization, accessing elements, iterating with for/foreach loops, and copying arrays.
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
Homework Assignment – Array Technical Document
Write a technical document that describes the structure and use of arrays. The document should
be 3 to 5 pages and include an Introduction section, giving a brief synopsis of the document and
arrays, a Body section, describing arrays and giving an annotated example of their use as a
programming construct, and a conclusion to revisit important information about arrays described
in the Body of the document. Some suggested material to include:
Declaring arrays of various types
Array pointers
Printing and processing arrays
Sorting and searching arrays
Multidimensional arrays
Indexing arrays of various dimension
Array representation in memory by data type
Passing arrays as arguments
If you find any useful images on the Internet, you can use them as long as you cite the source in
end notes.
Solution
Array is a collection of variables of the same type that are referenced by a common name.
Specific elements or variables in the array are accessed by means of index into the array.
If taking about C, In C all arrays consist of contiguous memory locations. The lowest address
corresponds to the first element in the array while the largest address corresponds to the last
element in the array.
C supports both single and multi-dimensional arrays.
1) Single Dimension Arrays:-
Syntax:- type var_name[size];
where type is the type of each element in the array, var_name is any valid identifier, and size is
the number of elements in the array which has to be a constant value.
*Array always use zero as index to first element.
The valid indices for array above are 0 .. 4, i.e. 0 .. number of elements - 1
For Example :- To load an array with values 0 .. 99
int x[100] ;
int i ;
for ( i = 0; i < 100; i++ )
x[i] = i ;
To determine to size of an array at run time the sizeof operator is used. This returns the size in
bytes of its argument. The name of the array is given as the operand
size_of_array = sizeof ( array_name ) ;
2) Initialisg array:-
Arrays can be initialised at time of declaration in the following manner.
type array[ size ] = { value list };
For Example :-
int i[5] = {1, 2, 3, 4, 5 } ;
i[0] = 1, i[1] = 2, etc.
The size specification in the declaration may be omitted which causes the compiler to count the
number of elements in the value list and allocate appropriate storage.
For Example :- int i[ ] = { 1, 2, 3, 4, 5 } ;
3) Multidimensional array:-
Multidimensional arrays of any dimension are possible in C but in practice only two or three
dimensional arrays are workable. The most common multidimensional array is a two
dimensional array for example the computer display, board games, a mathematical matrix etc.
Syntax :type name [ rows ] [ columns ] ;
For Example :- 2D array of dimension 2 X 3.
int d[ 2 ] [ 3 ] ;
A two dimensional array is actually an array of arrays, in the above case an array of two integer
arrays (the rows) each with three elements, and is stored row-wise in memory.
For Example :- Program to fill .
The document discusses arrays in C programming. Some key points include:
- An array is a collection of variables of the same type referred to by a common name. Each element has an index and arrays use contiguous memory locations.
- Arrays are declared with the type, name, and size. The first element is at index 0.
- One-dimensional arrays can be initialized, accessed, input from and output to the user. Multidimensional arrays like 2D arrays represent tables with rows and columns.
- Arrays can be passed to functions by passing the entire array or individual elements. Operations like searching, sorting and merging can be performed on arrays.
NumPy arrays can be created from Python lists by passing the list to the np.array() method. NumPy arrays differ from lists in that elements are stored contiguously in memory without comma separators. Multi-dimensional arrays can be created from nested lists. NumPy array attributes like shape and ndim provide information about array dimensions and elements. Individual elements can be accessed using indexes, and whole arrays or subsets of arrays can undergo vectorized operations for efficient processing.
C programming language allows for the declaration of arrays, which can store a fixed number of elements of the same data type. Arrays provide an efficient way to store and access related data sequentially in memory. Individual elements in an array are accessed via an index, and multi-dimensional arrays can model tables of data with multiple indices to access each element.
The Array class in ActionScript 3.0 allows you to create and manipulate arrays. Arrays can store any data type and are zero-indexed. You can create an Array using the new Array() constructor or array literal syntax ([]). Arrays are sparse, meaning they may have undefined elements. Array assignment is by reference. The Array class should not be used to create associative arrays, instead use the Object class.
In this chapter we are going to get familiar with some of the basic presentations of data in programming: lists and linear data structures. Very often in order to solve a given problem we need to work with a sequence of elements. For example, to read completely this book we have to read sequentially each page, i.e. to traverse sequentially each of the elements of the set of the pages in the book. Depending on the task, we have to apply different operations on this set of data. In this chapter we will introduce the concept of abstract data types (ADT) and will explain how a certain ADT can have multiple different implementations. After that we shall explore how and when to use lists and their implementations (linked list, doubly-linked list and array-list). We are going to see how for a given task one structure may be more convenient than another. We are going to consider the structures "stack" and "queue", as well as their applications. We are going to get familiar with some implementations of these structures.
The document discusses arrays and array data structures. It defines an array as a set of index-value pairs where each index maps to a single value. It then describes the common array abstract data type (ADT) with methods like create, retrieve, and store for manipulating arrays. The document also discusses sparse matrix data structures and provides an ADT for sparse matrices with methods like create, transpose, add, and multiply.
C programming language provides arrays as a data structure to store a fixed-size collection of elements of the same type. An array stores elements in contiguous memory locations. Individual elements in an array can be accessed using an index. Common array operations in C include declaration, initialization, accessing and modifying individual elements, and passing arrays to functions.
Third Review PPT that consists of the project d etails like abstract.Sowndarya6
CyberShieldX is an AI-driven cybersecurity SaaS web application designed to provide automated security analysis and proactive threat mitigation for business websites. As cyber threats continue to evolve, traditional security tools like OpenVAS and Nessus require manual configurations and lack real-time automation. CyberShieldX addresses these limitations by integrating AI-powered vulnerability assessment, intrusion detection, and security maintenance services. Users can analyze their websites by simply submitting a URL, after which CyberShieldX conducts an in-depth vulnerability scan using advanced security tools such as OpenVAS, Nessus, and Metasploit. The system then generates a detailed report highlighting security risks, potential exploits, and recommended fixes. Premium users receive continuous security monitoring, automatic patching, and expert assistance to fortify their digital infrastructure against emerging threats. Built on a robust cloud infrastructure using AWS, Docker, and Kubernetes, CyberShieldX ensures scalability, high availability, and efficient security enforcement. Its AI-driven approach enhances detection accuracy, minimizes false positives, and provides real-time security insights. This project will cover the system's architecture, implementation, and its advantages over existing security solutions, demonstrating how CyberShieldX revolutionizes cybersecurity by offering businesses a smarter, automated, and proactive defense mechanism against ever-evolving cyber threats.
This study will provide the audience with an understanding of the capabilities of soft tools such as Artificial Neural Networks (ANN), Support Vector Regression (SVR), Model Trees (MT), and Multi-Gene Genetic Programming (MGGP) as a statistical downscaling tool. Many projects are underway around the world to downscale the data from Global Climate Models (GCM). The majority of the statistical tools have a lengthy downscaling pipeline to follow. To improve its accuracy, the GCM data is re-gridded according to the grid points of the observed data, standardized, and, sometimes, bias-removal is required. The current work suggests that future precipitation can be predicted by using precipitation data from the nearest four grid points as input to soft tools and observed precipitation as output. This research aims to estimate precipitation trends in the near future (2021-2050), using 5 GCMs, for Pune, in the state of Maharashtra, India. The findings indicate that each one of the soft tools can model the precipitation with excellent accuracy as compared to the traditional method of Distribution Based Scaling (DBS). The results show that ANN models appear to give the best results, followed by MT, then MGGP, and finally SVR. This work is one of a kind in that it provides insights into the changing monsoon season in Pune. The anticipated average precipitation levels depict a rise of 300–500% in January, along with increases of 200-300% in February and March, and a 100-150% increase for April and December. In contrast, rainfall appears to be decreasing by 20-30% between June and September.
David Boutry - Mentors Junior DevelopersDavid Boutry
David Boutry is a Senior Software Engineer in New York with expertise in high-performance data processing and cloud technologies like AWS and Kubernetes. With over eight years in the field, he has led projects that improved system scalability and reduced processing times by 40%. He actively mentors aspiring developers and holds certifications in AWS, Scrum, and Azure.
Top Cite Articles- International Journal on Soft Computing, Artificial Intell...ijscai
International Journal on Soft Computing, Artificial Intelligence and Applications (IJSCAI) is an open access peer-reviewed journal that provides an excellent international forum for sharing knowledge and results in theory, methodology and applications of Artificial Intelligence, Soft Computing. The Journal looks for significant contributions to all major fields of the Artificial Intelligence, Soft Computing in theoretical and practical aspects. The aim of the Journal is to provide a platform to the researchers and practitioners from both academia as well as industry to meet and share cutting-edge development in the field.
May 2025: Top 10 Read Articles Advanced Information Technologyijait
International journal of advanced Information technology (IJAIT) is a bi monthly open access peer-reviewed journal, will act as a major forum for the presentation of innovative ideas, approaches, developments, and research projects in the area advanced information technology applications and services. It will also serve to facilitate the exchange of information between researchers and industry professionals to discuss the latest issues and advancement in the area of advanced IT. Core areas of advanced IT and multi-disciplinary and its applications will be covered during the conferences.
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSsamueljackson3773
In this paper, the author discusses the concerns of using various wireless communications and how to use
them safely. The author also discusses the future of the wireless industry, wireless communication
security, protection methods, and techniques that could help organizations establish a secure wireless
connection with their employees. The author also discusses other essential factors to learn and note when
manufacturing, selling, or using wireless networks and wireless communication systems.
First Review PPT gfinal gyft ftu liu yrfut goSowndarya6
CyberShieldX provides end-to-end security solutions, including vulnerability assessment, penetration testing, and real-time threat detection for business websites. It ensures that organizations can identify and mitigate security risks before exploitation.
Unlike traditional security tools, CyberShieldX integrates AI models to automate vulnerability detection, minimize false positives, and enhance threat intelligence. This reduces manual effort and improves security accuracy.
Many small and medium businesses lack dedicated cybersecurity teams. CyberShieldX provides an easy-to-use platform with AI-powered insights to assist non-experts in securing their websites.
Traditional enterprise security solutions are often expensive. CyberShieldX, as a SaaS platform, offers cost-effective security solutions with flexible pricing for businesses of all sizes.
Businesses must comply with security regulations, and failure to do so can result in fines or data breaches. CyberShieldX helps organizations meet compliance requirements efficiently.
Rearchitecturing a 9-year-old legacy Laravel application.pdfTakumi Amitani
An initiative to re-architect a Laravel legacy application that had been running for 9 years using the following approaches, with the goal of improving the system’s modifiability:
・Event Storming
・Use Case Driven Object Modeling
・Domain Driven Design
・Modular Monolith
・Clean Architecture
This slide was used in PHPxTKY June 2025.
https://phpxtky.connpass.com/event/352685/
11th International Conference on Data Mining (DaMi 2025)kjim477n
Welcome To DAMI 2025
Submit Your Research Articles...!!!
11th International Conference on Data Mining (DaMi 2025)
July 26 ~ 27, 2025, London, United Kingdom
Submission Deadline : June 07, 2025
Paper Submission : https://csit2025.org/submission/index.php
Contact Us : Here's where you can reach us : [email protected] or [email protected]
For more details visit : Webpage : https://csit2025.org/dami/index
A SEW-EURODRIVE brake repair kit is needed for maintenance and repair of specific SEW-EURODRIVE brake models, like the BE series. It includes all necessary parts for preventative maintenance and repairs. This ensures proper brake functionality and extends the lifespan of the brake system
3. Single Dimensional Arrays
Creating an Array
Syntax array_name = array(type_code, [elements])
Example-1 a = array(‘i’, [4, 6, 2, 9])
Example-2 a = array(‘d’, [1.5, -2.2, 3, 5.75])
4. Single Dimensional Arrays
Creating an Array
Typecode C Type Sizes
‘b’ signed integer 1
‘B’ unsigned integer 1
‘i’ signed integer 2
‘I’ unsigned integer 2
‘l’ signed integer 4
‘L’ unsigned integer 4
‘f’ floating point 4
‘d’ double precision floating point
8
‘u’ unicode character 2
5. Single Dimensional Arrays
Importing an Array Module
import array a = array.array(‘i’, [4, 6, 2, 9])
import array as ar a = ar.array(‘i’, [4, 6, 2, 9])
from array import * a = array(‘i’, [4, 6, 2, 9])
6. Importing an Array Module
Example-1
import array
#Create an array
a = array.array("i", [1, 2, 3, 4])
#print the items of an array
print("Items are: ")
for i in a:
print(i)
7. Importing an Array Module
Example-2
from array import *
#Create an array
a = array("i", [1, 2, 3, 4])
#print the items of an array
print("Items are: ")
for i in a:
print(i)
8. Importing an Array Module
Example-3
from array import *
#Create an array
a = array('u', ['a', 'b', 'c', 'd']) #Here, 'u' stands for
unicode character
#print the items of an array
print("Items are: ")
for ch in a:
print(ch)
9. Importing an Array Module
Example-4
from array import *
#Create firstarray
a = array('i', [1, 2, 3, 4])
#From first array create second
b = array(a.typecode, (i for i in a))
#print the second array items
print("Items are: ")
for i in b:
print(i)
#From first array create third
c = array(a.typecode, (i * 3 for i in a))
#print the second array items
print("Items are: ")
for i in c:
print(i)
10. Indexing & Slicing on Array
Example-1: Indexing
#To retrieve the items of an array using array index
from array import *
#Create an array
a = array('i', [1, 2, 3, 4])
#Get the length of the array n =
len(a)
#print the Items for i in
range(n):
print(a[i], end=' ')
11. Indexing & Slicing on Array
Example-2: Indexing
#To retrieve the items of an array using array index using while loop
from array import *
#Create an array
a = array('i', [1, 2, 3, 4])
#Get the length of the array n =
len(a)
#print the Items i = 0
while i < n:
print(a[i], end=' ') i += 1
12. Indexing & Slicing on Array
Slicing
Syntax arrayname[start: stop: stride]
Example arr[1: 4: 1]
Prints items from index 1 to 3 with the step size of 1
13. Indexing & Slicing on Array
Example-3: Slicing
#Create an array
x = array('i', [10, 20, 30, 40, 50, 60])
#Create array y with Items from 1st to 3rd from x y = x[1: 4]
print(y)
#Create array y with Items from 0th till the last Item in x y = x[0: ]
print(y)
#Create array y with Items from 0th till the 3rd Item in x y = x[: 4]
print(y)
#Create array y with last 4 Items in x y = x[-4: ]
print(y)
#Stride 2 means, after 0th Item, retrieve every 2nd Item from x y = x[0: 7: 2]
print(y)
#To display range of items without storing in an array for i in x[2: 5]:
print(i)
14. Indexing & Slicing on Array
Example-4: Slicing
#To retrieve the items of an array using array index using for loop
from array import *
#Create an array
a = array('i', [1, 2, 3, 4])
2nd
to 4th
only
#Display elements from for i
in a[2: 5]:
print(i)
15. Processing the Array
Method Description
a.append(x) Adds an element x at the end of the existing array a
a.count(x) Returns the numbers of occurrences of x in the array a
a.extend(x) Appends x at the end of the array a. ‘x’ can be another array or iterable object an
a.index(x) Returns the position number of the first occurrence of x in
array. Raises ‘ValueError’ if not found
the
a.insert(i, x) Inserts x in the position i in the array
16. Processing the Array
Method Description
a.pop(x) Removes the item x from the arry a and returns it
a.pop() Removes last item from the array a
a.remove(x) Removes the first occurrence of x in the array a. Raises ‘ValueError’ if not
found
a.reverse() Reverse the order of elements in the array a
a.tolist() Converts the array ‘a’ into a list
17. Processing the Array
Examples
from array import *
#Create an array
a = array('i', [1, 2, 3, 4, 5])
print(a)
#Append 6 to an array
a.append(6)
print(a)
#Insert 11 at position 1
a.insert(1,11)
print(a)
#Remove 11 from the array
a.remove(11)
print(a)
#Remove last item using pop() item =
a.pop()
print(a)
print("Item pop: ", item)
18. Processing the Array
Exercises
1. To store student’s marks into an array and find total marks and percentage of marks
2. Implement Bubble sort
3. To search for the positionof an item in an array using sequential search
4. To search for the positionof an element in an array using index() method
21. Single Dimensional Arrays
Importing an numpy
import numpy a = numpy.array([4, 6, 2, 9])
import numpy as np a = np.array([4, 6, 2, 9])
from numpy import * a = array([4, 6, 2, 9])
22. Single Dimensional Arrays
Creating an Array: numpy-array()
Example-1: To create an array of int datatype
a = array([10, 20, 30, 40, 50], int)
Example-2: To create an array of float datatype
a = array([10.1, 20.2, 30.3, 40.4, 50.5], float)
Example-2: To create an array of float datatype
a = array([10.1, 20.2, 30.3, 40.4, 50.5], float)
Example-3: To create an array of float datatype without specifying the float datatype
a = array([10, 20, 30.3, 40, 50])
Note: If one item in the array is of float type, then Python interpreter converts remaining items into the float
datatype
Example-4: To create an array of char datatype
a = array([‘a’, ‘b’, ‘c’, ‘d’])
Note: No need to specify explicitly the char datatype
23. Single Dimensional Arrays
Creating an Array: numpy-array()
Program-1: To create an array of char datatype
from numpy import *
a = array(['a', 'b', 'c', 'd']) print(a)
Program-2: To create an array of str datatype
from numpy import *
a = array(['abc', 'bcd', 'cde', 'def'], dtype=str) print(a)
24. Single Dimensional Arrays
Creating an Array: numpy-array()
Program-3: To create an array from another array using numpy
from numpy import *
a = array([1, 2, 3, 4, 5]) print(a)
#Create another array using array() method b = array(a)
print(a)
#Create another array by just copy c = a
print(a)
25. Single Dimensional Arrays
Creating an Array: numpy-linspace()
Syntax linspace(start, stop, n)
Example
Description
a = linspace(0, 10, 5)
Create an array ‘a’ with starting element 0 and ending 10. This range is divide
into 5 equal parts
Hence, items are 0, 2.5, 5, 7.5, 10
Program-1: To create an array with 5 equal points using linspace
from numpy import *
#Divide 0 to 10 into 5 parts and take those points in the array a = linspace(0, 10, 5)
print(a)
26. Single Dimensional Arrays
Creating an Array: numpy-logspace()
Syntax logspace(start, stop, n)
Example
Description
a = logspace(1, 4, 5)
Create an array ‘a’ with starting element 10^1 and ending 10^4. This range is divide
into 5 equal parts
Hence, items are 10. 56.23413252 316.22776602 1778.27941004 10000.
Program-1: To create an array with 5 equal points using logspace
from numpy import *
#Divide the range 10^1 to 10^4 into 5 equal parts a = logspace(1,
4, 5)
print(a)
27. Single Dimensional Arrays
Creating an Array: numpy-arange()
Syntax arange(start, stop, stepsize)
Example-1 arange(10) Produces items from 0 - 9
Example-2 arange(5, 10) Produces items from 5 - 9
Example-3 arange(1, 10, 3) Produces items from 1, 4, 7
Example-4 arange(10, 1, -1) Produces items from [10 9 8 7 6 5 4 3 2]
Example-5 arange(0, 10, 1.5) Produces [0. 1.5 3. 4.5 6. 7.5 9.]
Program-1: To create an array with even number upto 10
from numpy import *
a = arange(2, 11, 2)
print(a)
28. Single Dimensional Arrays
Creating Array: numpy-zeros() & ones()
Syntax zeros(n, datatype)
ones(n, datatype)
Example-1
Example-2
Example-3
zeros(5)
zeros(5, int)
ones(5, float)
Produces items [0. 0. 0. 0. 0.]
Default datatype is float
Produces items [0 0 0 0 0]
Produces items [1. 1. 1. 1. 1.]
Program-1: To create an array using zeros() and ones()
from numpy import *
a = zeros(5, int)
print(a)
b = ones(5) #Default datatype is float print(b)
29. Single Dimensional Arrays
Vectorized Operations
Example-1 a = array([10, 20 30.5, -40])
a = a + 5 #Adds 5 to each item of an array
Example-2 a1 = array([10, 20 30.5, -40])
a2 = array([1, 2, 3, 4])
a3 = a1 + a2 #Adds each item of a1 and a2
Importance of vectorized operations
1. Operations are faster
- Adding two arrays in the form a + b is faster than taking corresponding items of both arrays and then adding them.
2. Syntactically clearer
- Writing a + b is clearer than using the loops
3. Provides compact code
30. Single Dimensional Arrays
Mathematical Operations
sin(a)
arcsin(a)
Calculates sine value of each item in the array a
Calculates sine inverse value of each item in the array a
log(a) Calculates natural log value of each item in the array a
abs(a) Calculates absolute value of each item in the array a
sqrt(a) Calculates square root value of each item in the array a
power(a, n) Calculates a ^ n
exp(a) Calculates exponential value of each item in the array a
sum(a) Calculates sum of each item in the array a
prod(a) Calculates product of each item in the array a
min(a) Returns min value in the array a
max(a) Returns max value in the array a
31. Single Dimensional Arrays
Comparing Arrays
Relational operators are used to compare arrays of same size
These operators compares corresponding items of the arrays and return another array with Boolean values
Program-1: To compare two arrays and display the resultant Boolean type array
from numpy import *
a = array([1, 2, 3])
b = array([3, 2, 3])
c = a == b
print(c)
c = a > b
print(c)
c = a <= b
print(c)
32. Single Dimensional Arrays
Comparing Arrays
any(): Used to determine if any one item of the array is True
all(): Used to determine if all items of the array are True
Program-2: To know the effects of any() and all()
from numpy import *
a = array([1, 2, 3])
b = array([3, 2, 3])
c = a > b
print(c)
print("any(): ", any(c))
print("all(): ", all(c))
if (any(a > b)):
print("a contains one item greater than those of b")
33. Single Dimensional Arrays
Comparing Arrays
logical_and(), logical_or() and logical_not() are useful to get the Boolean array as a
result of comparing the compound condition
Program-3: To understand the usage of logical functions
from numpy import *
a = array([1, 2, 3])
b = array([3, 2, 3])
c = logical_and(a > 0, a < 4) print(c)
34. Single Dimensional Arrays
Comparing Arrays
where(): used to create a new array based on whether a given condition is True or False
Syntax: a = where(condition, exp1, exp2)
If condition is True, the exp1 is evaluated, the result is stored in array
a, else exp2 will be evaluated
Program-4: To understand the usage of where function
from numpy import *
a = array([1, 2, 3], int)
c = where(a % 2 == 0, a, 0) print(c)
35. Single Dimensional Arrays
Comparing Arrays
where(): used to create a new array based on whether a given condition is True or False
Syntax: a = where(condition, exp1, exp2)
If condition is True, the exp1 is evaluated, the result is stored in array
a, else exp2 will be evaluated
Exercise-1: To retrieve the biggest item after comparing two arrays using where()
36. Single Dimensional Arrays
Comparing Arrays
nonzero(): used to know the positions of items which are non-zero
Returns an array that contains the indices of the items of the array which are non-zero
Syntax: a = nonzero(array)
Program-5: To retrieve non zero items from an array
from numpy import *
a = array([1, 2, 0, -1, 0, 6], int) c = nonzero(a)
#Display the indices for i
in c:
print(i)
#Display the items
print(a[c])
37. Single Dimensional Arrays
Aliasing Arrays
‘Aliasing means not copying’. Means another name to the existing object
Program-1: To understand the effect of aliasing
from numpy import *
a = arange(1, 6)
b = a
print(a)
print(b)
#Modify 0th Item
b[0] = 99
print(a)
print(b)
38. Single Dimensional Arrays
Viewing & Copying
view(): To create the duplicate array
Also called as ‘shallow copying’
Program-1: To understand the view()
from numpy import *
a = arange(1, 6)
b = a.view() #Creates new array print(a)
print(b)
#Modify 0th Item b[0]
= 99
print(a)
print(b)
39. Single Dimensional Arrays
Viewing & Copying
copy(): To create the copy the original array
Also called as ‘deep copying’
Program-1: To understand the view()
from numpy import *
a = arange(1, 6)
b = a.copy() #Creates new array print(a)
print(b)
#Modify 0th Item b[0]
= 99
print(a)
print(b)
41. Multi Dimensional Arrays
Creating an Array
Example-1: To create an 2D array with 2 rows and 3 cols
a = array([[1, 2, 3],
[4, 5, 6]]
Example-2: To create an array of float datatype
a = array([10.1, 20.2, 30.3, 40.4, 50.5], float)
Example-2: To create an 3D array with 2-2D arrays with each 2 rows and 3 cols
a = array([[[1, 2, 3],[4, 5, 6]]
[[1, 1, 1], [1, 0, 1]]]
42. Multi Dimensional Arrays
Attributes of an Array: The ndim
The ‘ndim’ attribute represents the number of dimensions or axes of an array
Example-2: To understand the usage of the ndim attribute
a = array([[[1, 2, 3],[4, 5, 6]]
[[1, 1, 1], [1, 0, 1]]]
print(a.ndim)
●
● The number of dimensions are also called as ‘rank’
Example-1: To understand the usage of the ndim attribute
a = array([1, 2, 3])
print(a.ndim)
43. Multi Dimensional Arrays
Attributes of an Array: The shape
The ‘shape’ attribute gives the shape of an array
Example-2: To understand the usage of the ‘shape’ attribute
a = array([[1, 2, 3],[4, 5, 6]])
print(a.shape)
Outputs: (2, 3)
●
● The shape is a tuple listing the number of elements along eachdimensions
Example-1: To understand the usage of the ‘shape’ attribute
a = array([1, 2, 3])
print(a.shape)
Outputs: (5, )
Example-3: To ‘shape’ attribute also changes the rows and cols
a = array([[1, 2, 3],[4, 5, 6]]) Outputs:
a.shape = (3, 2) [[1 2]
[3 4]
print(a) [5 6]]
44. Multi Dimensional Arrays
Attributes of an Array: The size
The ‘size’ attribute gives the total number of items in an array
Example-2: To understand the usage of the ‘size’ attribute
a = array([[1, 2, 3],[4, 5, 6]])
print(a.size)
Outputs: 6
●
Example-1: To understand the usage of the ‘size’ attribute
a = array([1, 2, 3])
print(a.size)
Outputs: 5
45. Multi Dimensional Arrays
Attributes of an Array: The itemsize
The ‘itemsize’ attribute gives the memory size of an array element in bytes
Example-2: To understand the usage of the ‘size’ attribute
a = array([1.1, 2.3])
print(a.itemsize)
Outputs: 8
●
Example-1: To understand the usage of the ‘itemsize’ attribute
a = array([1, 2, 3, 4, 5])
print(a.itemsize)
Outputs: 4
46. Multi Dimensional Arrays
Attributes of an Array: The dtype
The ‘dtype’ attribute gives the datatype of the elements in the array
Example-2: To understand the usage of the ‘dtype’ attribute
a = array([1.1, 2.3])
print(a.dtype)
Outputs: float64
●
Example-1: To understand the usage of the ‘dtype’ attribute
a = array([1, 2, 3, 4, 5])
print(a.dtype)
Outputs: int32
47. Multi Dimensional Arrays
Attributes of an Array: The nbytes
The ‘nbytes’ attribute gives the total number of bytes occupied by an array
Example-2: To understand the usage of the ‘nbytes’ attribute
a = array([1.1, 2.3])
print(a.nbytes)
Outputs: 16
●
Example-1: To understand the usage of the ‘nbytes’ attribute
a = array([1, 2, 3, 4, 5])
print(a.nbytes)
Outputs: 20
48. Multi Dimensional Arrays
Methods of an Array: The reshape()
The ‘reshape’ method is useful to change the shape of an array
Example-2: To understand the usage of the ‘reshape’ method
#Change the shape to 5 rows, 2 cols Outputs:
a = a.reshape(5, 2)
[[0 1]
print(a) [2 3]
[4 5]
[6 7]
[8 9]]
●
Example-1: To understand the usage of the ‘reshape’ method
a = arange(10) Outputs:
#Change the shape as 2 Rows, 5 Cols a =
a.reshape(2, 5)
[[0 1 2 3 4]
[5 6 7 8 9]]
print(a)
49. Multi Dimensional Arrays
Methods of an Array: The flatten()
The ‘flatten’ method is useful to return copy of an array collapsedinto one dimension
●
Example-1: To understand the usage of the ‘flatten’ method
#flatten() method
a = array([[1, 2], [3, 4]])
print(a)
Outputs:
[1 2 3 4]
#Change to 1D array a =
a.flatten() print(a)
50. Multi Dimensional Arrays
Methods of creating an 2D-Array
● Using array() function
● Using ones() and zeroes() functions
● Uisng eye() function Using
reshape() function
●
53. Multi Dimensional Arrays
Creation of an 2D-Array: The eye()
Syntax
Description
eye(n, dtype=datatype)
- Creates ‘n’ rows & ‘n’ cols
- Default datatype is float
Example-1 a = eye(3) - Creates 3 rows and 3 cols
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
● The eye() function creates 2D array and fills the items in the diagonal with1’s
54. Multi Dimensional Arrays
Creation of an 2D-Array: The reshape()
Syntax
Description
reshape(arrayname, (n, r, c))
arrayname – Represents the name of the array whose elements converted
n – Numbers of arrays in the resultant array r, c –
Number of rows & cols respectively
to be
Example-1 a = array([1, 2, 3, 4, 5, 6]) Outputs:
b = reshape(a, (2, 3)) [[1 2 3]
[4 5 6]]
print(b)
● Used to convert 1D into 2D or nD arrays
55. Multi Dimensional Arrays
Creation of an 2D-Array: The reshape()
Syntax
Description
reshape(arrayname, (n, r, c))
arrayname – Represents the name of the array whose elements converted
n – Numbers of arrays in the resultant array r, c –
Number of rows & cols respectively
to be
Example-2 a = arange(12) Outputs:
b = reshape(a, (2, 3, 2)) [[0 1]
[2 3]
print(b) [4 5]]
[[6 7]
[8 9]
[10 11]]
● Used to convert 1D into 2D or nD arrays
56. Multi Dimensional Arrays
Indexing of an 2D-Array
Program-1: To understand indexing of 2D arrays
from numpy import *
#Create an 2D array with 3 rows, 3 cols a = [[1, 2,
3], [4, 5, 6], [7, 8, 9]]
#Display only rows
for i in range(len(a)): print(a[i])
#display item by item for i in
range(len(a)):
for j in range(len(a[i])):
print(a[i][j], end=' ')
57. Multi Dimensional Arrays
Slicing of an 2D-Array
#Create an array
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
a = reshape(a, (3, 3)) print(a)
Produces:
[[1 2 3]
[4 5 6]
[7 8 9]]
a[:, :] Produces:
a[:]
a[: :] [[1 2 3]
[4 5 6]
[7 8 9]]
#Display 0th
row
a[0, :]
#Display 0th
col a[:,
0]
#To get 0th
row, 0th
col item a[0:1,
0:1]
59. Matrices in Numpy
Syntax matrix-name = matrix(2D Array or String)
Example-1 a = [[1, 2, 3], [4, 5, 6]] Outputs:
a = matrix(a) [[1 2 3]
[4 5 6]]
print(a)
Example-2 a = matrix([[1, 2, 3], [4, 5, 6]]) Outputs:
[[1 2 3]
[4 5 6]]
Example-3 a = ‘1 2; 3 4; 5 6’ [[1 2]
[3 4]
b = matrix(a) [5 6]]
60. Matrices in Numpy
Getting Diagonal Items
Function diagonal(matrix)
Example-1 #Create 3 x 3 matrix
a = matrix("1 2 3; 4 5 6; 7 8 9")
#Find the diagonal items d =
diagonal(a)
print(d)
Outputs:
[1 5 9]
61. Matrices in Numpy
Finding Max and Min Items
Function max()
min()
Example-1 #Create 3 x 3 matrix
a = matrix("1 2 3; 4 5 6; 7 8 9")
#Print Max + Min Items big =
a.max()
small = a.min()
print(big,small)
Outputs:
9 1
62. Matrices in Numpy
Exercise
1. To find sum, average of elements in 2D array
2. To sort the Matrix row wise and column wise
3. To find the transpose of the matrix
4. To accept two matrices and find thier sum
5. To accept two matrices and find their product
Note: Read the matrices from the user and make the program user friendly