<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shridhar Shende</title>
    <description>The latest articles on DEV Community by Shridhar Shende (@shri50).</description>
    <link>https://dev.to/shri50</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1347774%2F614256cd-6424-4a6e-bf2a-30e83bcdeb9a.jpeg</url>
      <title>DEV Community: Shridhar Shende</title>
      <link>https://dev.to/shri50</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shri50"/>
    <language>en</language>
    <item>
      <title>n-D arrays understanding with real life examples</title>
      <dc:creator>Shridhar Shende</dc:creator>
      <pubDate>Thu, 28 Nov 2024 05:55:57 +0000</pubDate>
      <link>https://dev.to/shri50/n-d-arrays-understanding-with-real-life-examples-5b5l</link>
      <guid>https://dev.to/shri50/n-d-arrays-understanding-with-real-life-examples-5b5l</guid>
      <description>&lt;p&gt;An n-dimensional array (or n-d array) is a mathematical structure used to represent data organized in multiple dimensions. In computer programming, an array is a structure for storing and retrieving data.&lt;/p&gt;

&lt;p&gt;but question rises why do we require n -d arrays in the first place&lt;/p&gt;

&lt;p&gt;let’s try an understand with real -life scenario’s&lt;/p&gt;

&lt;h2&gt;
  
  
  1-Dimesional Array (Vector)
&lt;/h2&gt;

&lt;p&gt;Example: Daily temparatures of a week.&lt;br&gt;
temp_of_a_week = [25, 27, 26, 28, 30, 24, 25]&lt;/p&gt;

&lt;h2&gt;
  
  
  2-Dimesional Array (Matrix)
&lt;/h2&gt;

&lt;p&gt;2-d array’s is like table&lt;/p&gt;

&lt;p&gt;image =&lt;br&gt;
[[ 1, 2, 3],&lt;br&gt;
[ 1, 2, 3],&lt;br&gt;
[ 1, 2, 3]]&lt;/p&gt;

&lt;p&gt;dimesions : 3 x 3&lt;/p&gt;

&lt;p&gt;e.g. black and white image (grayscale image)&lt;/p&gt;

&lt;p&gt;This is the image of the number 7 handwritten dataset from famous MNIST dataset. if you zoom in further the images are getting distorted and small square boxes on the image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3ee5yf3x0nnh1z6iy7o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg3ee5yf3x0nnh1z6iy7o.png" alt="Image description" width="416" height="413"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;these small boxes are called as Pixles. Each of these pixels is denoted as a numerical value, and these numbers are called Pixel Values. pixel values denote the intensity of the pixels. For a grayscale or b&amp;amp;w image, we have pixel values ranging from 0 to 255&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The smaller numbers closer to zero represent the darker shade while the larger numbers closer to 255 represent the lighter or the white shade.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsizuofswevmkupctqpro.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsizuofswevmkupctqpro.png" alt="Image description" width="568" height="568"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;every image in a computer is saved in this form matrix of numbers, and this matrix is also known as a Channel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoihj7f7gz5m5vi2icco.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyoihj7f7gz5m5vi2icco.png" alt="Image description" width="568" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;this is example is 28 x 28 vlaues of 2-d array&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3-Dimesional Array
&lt;/h2&gt;

&lt;p&gt;3-d array are collection of 2-d array’s placed in a queue .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnuq181q319spv3x6gkw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmnuq181q319spv3x6gkw.jpg" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;dimesions = 3 x 3 x 3&lt;br&gt;
e.g. RGB color image&lt;/p&gt;

&lt;p&gt;Data: Pixels with three color channels (Red, Green, Blue)&lt;/p&gt;

&lt;p&gt;Each pixel has a thee values&lt;br&gt;
like [255,0,0] for red.&lt;br&gt;
[0,0,255] for blue&lt;br&gt;
[255,255,0] for yellow likewise&lt;/p&gt;

&lt;p&gt;RGB represents Red, Green and Blue.It is an additive color model.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm71uouyevowboot29lfv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm71uouyevowboot29lfv.png" alt="Image description" width="639" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86yzh9n01pswnl6lf7b0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F86yzh9n01pswnl6lf7b0.png" alt="Image description" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some more examples of 3-D array:&lt;br&gt;
Medical imaging: MRI scans and CT scans&lt;br&gt;
Computer graphics: 3D models of objects&lt;/p&gt;

&lt;h2&gt;
  
  
  4-Dimensional Array
&lt;/h2&gt;

&lt;p&gt;4-d array are collection of 3-d array’s .&lt;/p&gt;

&lt;p&gt;e.g Video&lt;/p&gt;

&lt;p&gt;videos are nothing but collection of images&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffogrmxts4e9n66qgtjgn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffogrmxts4e9n66qgtjgn.png" alt="Image description" width="339" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1l7yfmku5qv8ddfrmzn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1l7yfmku5qv8ddfrmzn.png" alt="Image description" width="339" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now lets combine these two images to create a video&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn2yu579e3ftjwxmxnzhz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn2yu579e3ftjwxmxnzhz.gif" alt="Image description" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;remember RGB image is repesented in 3-d array now we have two 3-d array’s placed one above each other.&lt;/p&gt;

&lt;p&gt;in computer it can be represented like&lt;/p&gt;

&lt;p&gt;Videos represented as 4D arrays (frames, height, width, color channels), where each frame is an image.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9olnyb66lfzr10dbm4n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9olnyb66lfzr10dbm4n.png" alt="Image description" width="800" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;in computer 4-d can be represented in below manner.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1k0kvmtr6rnpczzk8gx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1k0kvmtr6rnpczzk8gx.png" alt="Image description" width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some more examples:&lt;br&gt;
Video games: game is rendered and player can move around the world&lt;br&gt;
Virtual reality: store the virtual world and user to interact with the virtual world in a realistic way&lt;/p&gt;

&lt;h2&gt;
  
  
  5-Dimensional Array
&lt;/h2&gt;

&lt;p&gt;5-d array is collection of 4-d array’s.&lt;/p&gt;

&lt;p&gt;e.g: In physics and chemistry, simulations of molecular dynamics or quantum mechanics to represent the positions and velocities of particles.&lt;/p&gt;

&lt;p&gt;it’s not possible as of now to visulize 5-d data we can only imagine for now.&lt;/p&gt;

&lt;p&gt;in computer engineering we can represent something like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kmnpzox6700ueiqsqdt.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kmnpzox6700ueiqsqdt.jpg" alt="Image description" width="647" height="581"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Conclusion:&lt;br&gt;
Hope you all now understand how arrays are used in computer to store the data.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
