<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jiya Shrimalani on Medium]]></title>
        <description><![CDATA[Stories by Jiya Shrimalani on Medium]]></description>
        <link>https://medium.com/@jiashrimalani11?source=rss-9f23abf3ff47------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MPdsEAh-H6dkPA7keyZ8Xw.jpeg</url>
            <title>Stories by Jiya Shrimalani on Medium</title>
            <link>https://medium.com/@jiashrimalani11?source=rss-9f23abf3ff47------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 08:50:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jiashrimalani11/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your AI Prompt Just Woke Up a Data Center]]></title>
            <link>https://medium.com/@jiashrimalani11/your-ai-prompt-just-woke-up-a-data-center-e6f003e2d738?source=rss-9f23abf3ff47------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6f003e2d738</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[parallel-computing]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai-infrastructure]]></category>
            <dc:creator><![CDATA[Jiya Shrimalani]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 09:57:31 GMT</pubDate>
            <atom:updated>2026-03-09T09:57:31.500Z</atom:updated>
            <content:encoded><![CDATA[<p>A few years ago the biggest thing developers worried about was whether their code would compile. Today the bigger question might be whether the AI model behind it is quietly burning through thousands of dollars in compute.</p><p>The conversation around artificial intelligence has mostly been about models. GPT versus Gemini, Claude versus Llama. Every few months a new model appears with more parameters, better benchmarks, and more impressive demos.</p><p>But behind all those model launches, something much bigger is happening. The real race in AI is slowly shifting from <strong>who builds the smartest model</strong> to <strong>who can actually afford to run them</strong>.</p><h3>The GPU Problem</h3><p>Training modern AI models requires enormous GPU clusters. Companies use specialized chips like NVIDIA H100 or AMD MI300 accelerators to perform the heavy linear algebra operations required by deep learning models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*2kLEgcjXNs4VHyPn" /></figure><p>Most modern AI systems rely on <strong>transformer architectures</strong>, where training involves repeated matrix multiplications across billions of parameters. To train these models at scale, companies distribute the workload across thousands of GPUs using techniques like <strong>data parallelism, model parallelism, and pipeline parallelism</strong>.</p><p>Even with these optimizations, a frontier training run can involve <strong>tens of thousands of GPUs running for weeks</strong>, pushing the cost into the hundreds of millions of dollars.</p><p>And that’s only the beginning.</p><h3>Training Is Expensive. Inference Never Stops.</h3><p>Once a model is trained, it still needs to answer millions of user queries every day.</p><p>Each prompt you send to an AI assistant runs through dozens of transformer layers containing attention mechanisms and feedforward networks. These steps require large matrix multiplications executed on GPUs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*u8uByOBzaHd7Owdl" /></figure><p>At global scale, inference becomes a massive engineering challenge. Systems must process requests in milliseconds while managing huge compute loads. This is why techniques like <strong>quantization, batching, key-value caching, and tensor parallelism</strong> are used to reduce latency and compute costs.</p><p>Without these optimizations, most AI products simply wouldn’t be economically viable.</p><h3>The Rise of the AI Data Center</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ok4iLfXankNbnlkb" /></figure><p>All of this computation happens inside enormous data centers filled with GPU clusters connected by ultra-high bandwidth networks.</p><p>Modern AI facilities require advanced cooling systems, high-capacity power delivery infrastructure, and specialized networking technologies like <strong>InfiniBand</strong> to move data between thousands of GPUs.</p><p>Some next-generation AI data centers are expected to consume <strong>hundreds of megawatts of electricity</strong>, comparable to the output of a small power plant.</p><p>In other words, artificial intelligence is becoming one of the most energy-intensive technologies ever deployed.</p><h3>The Real AI Moat</h3><p>The interesting implication is that the future of AI may depend less on algorithms and more on infrastructure.</p><p>The companies best positioned to win the AI race may not necessarily be the ones with the smartest researchers.</p><p>They might be the ones that control the <strong>GPU supply chains, hyperscale data centers, and power infrastructure needed to run these models at scale</strong>.</p><p>So while everyone is arguing about which AI model is smartest, the real race might already be happening somewhere less visible: inside massive buildings filled with humming GPUs, where intelligence is being powered one megawatt at a time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6f003e2d738" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Every App Suddenly Has AI (And the Systems Making It Possible)]]></title>
            <link>https://medium.com/@jiashrimalani11/why-every-app-suddenly-has-ai-and-the-systems-making-it-possible-c912ead07912?source=rss-9f23abf3ff47------2</link>
            <guid isPermaLink="false">https://medium.com/p/c912ead07912</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Jiya Shrimalani]]></dc:creator>
            <pubDate>Fri, 06 Mar 2026 11:18:46 GMT</pubDate>
            <atom:updated>2026-03-06T11:23:54.254Z</atom:updated>
            <content:encoded><![CDATA[<p>Three years ago, if an app said it had “AI,” it usually meant one of two things: either it had a very enthusiastic marketing team, or it had a chatbot that could barely tell the difference between “hello” and “help.”</p><p>Today, the situation is very different. Your email writes itself, your IDE finishes your functions before you think of them, and your notes app suddenly thinks it’s a research assistant.</p><p>Somewhere along the way, artificial intelligence stopped being a feature and quietly became infrastructure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/0*-ndwVnPUX-kptaAj.jpg" /></figure><p>At first glance, this rapid proliferation can appear sudden or even chaotic. However, the widespread adoption of artificial intelligence across software systems is the result of several technological developments converging at roughly the same time. Advances in model architecture, large-scale training methodologies, inference infrastructure, and developer-accessible APIs have collectively transformed artificial intelligence from a research discipline into a deployable software component.</p><p>Understanding this shift requires examining the technical mechanisms that enabled it.</p><h3>Transformer Architectures and the Modern Language Model</h3><p>Most modern AI systems that process natural language rely on the Transformer architecture introduced in the 2017 paper <a href="https://arxiv.org/abs/1706.03762"><em>Attention Is All You Need</em>.</a> Prior to transformers, sequence modeling tasks were typically handled using recurrent neural networks (RNNs) or long short-term memory networks (LSTMs). These models processed text sequentially, token by token, which limited their ability to capture long-range dependencies and significantly constrained parallel computation during training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ls3niyG1ryhhKuNJ.png" /><figcaption>Most modern AI systems that process natural language rely on the Transformer architecture introduced in the 2017 paper Attention Is All You Need.</figcaption></figure><p>Transformers addressed these limitations through the introduction of the attention mechanism. Instead of processing tokens sequentially, transformers analyze entire sequences simultaneously and dynamically assign importance to different tokens within the input. This allows the model to learn contextual relationships between words regardless of their distance within the sentence.</p><p>The core attention mechanism can be expressed mathematically as</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*DYNS32nYZy5kdnnNslZ-Jw.png" /></figure><p>where Q, K, and V represent the query, key, and value matrices derived from the token embeddings. The attention function computes a weighted combination of values based on the similarity between queries and keys, effectively enabling the model to focus on relevant contextual information during inference.</p><p>Because transformers process sequences in parallel rather than sequentially, they are highly compatible with modern GPU and TPU architectures. This parallelism dramatically accelerates training and enables the scaling of models to billions or even hundreds of billions of parameters.</p><h3>The Role of Scaling Laws</h3><p>Another major factor contributing to the widespread success of modern language models is the discovery of <a href="https://arxiv.org/abs/2001.08361">scaling laws</a> in deep learning. Research conducted by OpenAI and other organizations demonstrated that model performance improves predictably when three factors increase simultaneously: the number of parameters in the model, the volume of training data, and the amount of computational resources used during training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kVtMbsHTOmWbxtp_.png" /></figure><p>Large language models such as GPT-3, PaLM, and LLaMA contain billions of parameters and are trained on enormous corpora of text drawn from books, academic papers, websites, and code repositories. The relationship between scale and performance has proven sufficiently consistent that model capabilities can often be estimated before training even begins.</p><p>However, scaling models introduces substantial engineering challenges. Training a large model requires massive distributed systems composed of thousands of GPUs or specialized accelerators, coordinated through frameworks such as<a href="https://www.deepspeed.ai/"> DeepSpeed</a>,<a href="https://arxiv.org/abs/1909.08053"> Megatron-LM</a>, or <a href="https://pytorch.org/tutorials/intermediate/ddp_tutorial.html">PyTorch</a> distributed training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sI9wA69ledpCN4yE.png" /><figcaption><strong>Figure: Large language models are trained using distributed GPU clusters that implement data parallelism, model parallelism, and pipeline parallelism.</strong></figcaption></figure><p>A typical large-scale training run involves multiple forms of parallelism. Data parallelism distributes training data across many compute nodes, while model parallelism divides the neural network itself across hardware devices when it becomes too large to fit within the memory of a single GPU. In many systems, pipeline parallelism is also used to distribute sequential layers across hardware clusters, allowing different stages of computation to execute simultaneously.</p><h3>Inference Infrastructure and Latency Optimization</h3><p>While training large models is computationally expensive, deploying them in real-time applications presents a separate set of challenges. Each inference request requires passing input tokens through dozens of neural network layers composed primarily of matrix multiplications and nonlinear transformations. When millions of users interact with a model simultaneously, the infrastructure required to serve these requests becomes extremely complex.</p><p>Several techniques have emerged to reduce inference latency and computational cost. One widely used approach is <a href="https://youtu.be/80bIUggRJf4?si=uf8wmCZGAHLwxscI">key-value caching</a>, in which previously computed attention values are stored during text generation. Because language models generate tokens sequentially, caching intermediate representations prevents the system from recomputing attention scores for earlier tokens during each generation step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*Z-M9ddwMUsYgPVVO.gif" /></figure><p>Another important optimization technique is quantization. Neural network weights are often stored using high-precision floating-point numbers such as 32-bit floats. By reducing the precision of these weights to 16-bit or 8-bit representations, systems can significantly reduce memory usage and accelerate inference without dramatically degrading model accuracy.</p><p>Modern inference systems also rely heavily on tensor parallelism and optimized GPU kernels. Libraries such as CUDA, TensorRT, and specialized inference frameworks enable highly optimized matrix operations that allow large models to respond to user queries within seconds rather than minutes.</p><h3>The Emergence of AI as a Platform API</h3><p>Although large language models are technically impressive, their widespread adoption across software applications was ultimately enabled by a different development: the emergence of AI as an accessible platform service. Instead of requiring every company to train and deploy its own model, organizations can now access advanced AI capabilities through cloud APIs.</p><p>These APIs abstract away the complexity of distributed training, inference optimization, and hardware management. From the perspective of a developer integrating AI into an application, interacting with a language model can be as simple as issuing a single request.</p><p>For example, a typical integration might resemble the following Python code:</p><pre>response = client.responses.create(<br>    model=&quot;gpt-4&quot;,<br>    input=&quot;Explain the transformer architecture in simple terms&quot;<br>)</pre><p>Behind this single API call lies an extensive distributed infrastructure responsible for tokenization, prompt processing, model inference, and response generation. By providing this functionality through simple programmatic interfaces, AI platforms have dramatically lowered the barrier to entry for developers.</p><p>As a result, artificial intelligence has transitioned from a specialized research tool into a general-purpose software component.</p><h3>Feedback Loops and the Rapid Spread of AI Features</h3><p>The rapid spread of AI features across applications is also influenced by product design and user behavior analytics. <a href="https://research.google/pubs/pub45530/">Modern software platforms rely heavily on recommendation</a> and ranking systems to determine which features receive visibility within user interfaces.</p><p>When users interact frequently with AI-driven features, metrics such as session duration, task completion rate, and user retention improve. These signals are detected by internal analytics systems and often lead product teams to prioritize and expand AI functionality. The result is a feedback loop in which increased user engagement drives further integration of AI capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v9m7FMDPIUVu2Okn" /><figcaption>Figure: Engagement signals create a feedback loop that encourages product teams to expand AI features across applications.</figcaption></figure><p>Consequently, the proliferation of artificial intelligence across software ecosystems is not solely a result of technological capability but also of product optimization strategies designed to maximize user engagement.</p><h3>Conclusion</h3><p>The sudden appearance of artificial intelligence across modern software did not happen overnight. It is the visible result of years of research in deep learning, distributed systems, and large-scale computing gradually reaching a point where the technology became practical to deploy at scale.</p><p>Transformer architectures made language modeling dramatically more effective. Scaling laws revealed how model capability grows with compute and data. Advances in GPU infrastructure and inference optimization made real-time interaction feasible. Finally, cloud-based AI APIs turned these complex systems into accessible building blocks for developers.</p><p>When those pieces aligned, the transition from “AI tools” to “AI-powered software” became inevitable.</p><p>So if it feels like artificial intelligence suddenly appeared everywhere, it’s because we are seeing the moment when a decade of machine learning research crossed the threshold from experimental technology to everyday infrastructure.</p><p>And once infrastructure changes, the entire software ecosystem changes with it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c912ead07912" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Some Audios Loop in Your Head (and Feed)]]></title>
            <link>https://medium.com/gdg-vit/why-some-audios-loop-in-your-head-and-feed-6986dcb2fd2c?source=rss-9f23abf3ff47------2</link>
            <guid isPermaLink="false">https://medium.com/p/6986dcb2fd2c</guid>
            <category><![CDATA[recommendation-algorithms]]></category>
            <category><![CDATA[spectrogram-analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[audio-fingerprinting]]></category>
            <category><![CDATA[machine-learning-in-music]]></category>
            <dc:creator><![CDATA[Jiya Shrimalani]]></dc:creator>
            <pubDate>Wed, 01 Oct 2025 15:29:54 GMT</pubDate>
            <atom:updated>2025-10-01T15:29:54.280Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXsoWGmJO9BXNDBdySPnEA.png" /></figure><p>Let’s be honest, if you’re consuming a steady diet of TikToks, Reels, and Shorts, your brain’s regular programming has probably been hijacked. I know mine has.</p><p>One minute I’m trying to think of something important, the next, my internal monologue is just the “meow meow meow” version of Billie Eilish’s “What Was I Made For?” on a loop. That, or the “Rock that Body” trend. It’s an endless stream, whether I’m in an exam or just talking to a friend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/0*FPKZCup0vsIONTiD" /><figcaption>I just know you can hear this picture.</figcaption></figure><p>But have you ever stopped to wonder why these sounds are the ones that go global? It’s not an accident.</p><h3>Anatomy of a Viral Bop</h3><p>Those sounds living rent-free in your head aren’t a random coincidence. In fact, they’re practically engineered to get stuck there. Here’s the formula:</p><p><strong>A) The Earworm Factor</strong></p><p>Viral audios are designed to be addictive. They’re short, simple, and repetitive, a perfect formula for the 15-second Reel format that rewards tiny dopamine hits. Take the infamous “meow meow meow” audio. It’s simple, hypnotic, and just weird enough to latch onto your brain and refuse to let go.</p><p><strong>B) The Meme-ability Factor</strong></p><p>The best audios aren’t just sounds; they’re prompts. They lay down a framework for that invasive species we call “influencers” to spin up a dance, a transition, or a painfully “relatable” situation. The “dame un grr” trend, for example, was less a sound and more a fill-in-the-blank template, practically handing cash to anyone willing to milk its obvious format.</p><p><strong>C) The Nostalgia Bait</strong></p><p>They say nostalgia is a powerful drug, and social media is the dealer. Often, a trending sound is just a sped-up or remixed hit from the beloved 90s or early 2000s, back when music was more than just heavily auto-tuned ad-libs over a beat (no shade to the Playboi Carti fans, of course). Tapping into the “good old days” is a guaranteed way to make a sound connect emotionally, making it instantly shareable.</p><h3>From Soundwave to Algorithm: The Tech Behind the Trend</h3><p>So, we know a viral bop needs to be catchy, meme-able, and maybe hit you with a dose of nostalgia. But how does an app like Instagram or TikTok actually <em>know</em> when a sound has that magic spark? It’s not a person in a control room, it’s a sophisticated AI pipeline.</p><p>Let’s break it down.</p><h4>Step 1: Giving Sound a “Fingerprint”</h4><p>Before an algorithm can judge a sound, it needs to understand it. When an audio is uploaded, it’s not just stored as a file; it’s analyzed.</p><p>This process is called <strong>audio fingerprinting</strong>. Think of it like Shazam on a massive scale. The platform’s AI creates a unique digital signature, a fingerprint, for every sound. This allows it to:</p><ul><li>Identify the song instantly, no matter who uploads it.</li><li>Track every single video that uses that specific audio.</li><li>Recognize remixes and sped-up versions, linking them back to the original.</li></ul><p>The AI also converts the sound into a <strong>Mel spectrogram</strong>, a visual heatmap of the audio’s frequencies. It turns the sound into a picture that the AI can “see,” making it easier to analyze the beat, pitch, and energy.</p><p><strong>Under the Hood: Generating a Spectrogram</strong></p><p>For those curious about the actual code, generating a spectrogram is surprisingly straightforward using Python libraries like librosa. Here’s a simplified snippet of what the backend might be doing:</p><p>Python</p><pre>import librosa<br>import librosa.display<br>import matplotlib.pyplot as plt<br>import numpy as np<br><br># Load a sample audio file (e.g., a clip of a song)<br>audio_file = r&quot;The_Weeknd_ft_Playboi_Carti_-_Timeless.wav&quot;<br>y, sr = librosa.load(audio_file)<br># Generate the Mel spectrogram<br>mel_spectrogram = librosa.feature.melspectrogram(y=y, sr=sr)<br># Convert to decibels (dB) for a more human-readable visualization<br>mel_spectrogram_db = librosa.power_to_db(mel_spectrogram, ref=np.max)<br># Display the spectrogram<br>fig, ax = plt.subplots()<br>img = librosa.display.specshow(mel_spectrogram_db, x_axis=&#39;time&#39;, y_axis=&#39;mel&#39;, ax=ax)<br>fig.colorbar(img, ax=ax, format=&#39;%+2.0f dB&#39;)<br>ax.set_title(&#39;Mel Spectrogram&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*MpLoDBwO_a4lf79Ed-PZ3A.png" /><figcaption>Mel Spectrogram generated from the track “Timeless” by the Weeknd and Playboi Carti</figcaption></figure><p>This is the visual fingerprint of Weeknd’s “Timeless.” The most striking feature is the thick, bright yellow band at the very bottom, representing the song’s iconic, heavy 808 bass which is present almost continuously. The dense, textured area in the middle shows Carti’s ad-lib heavy vocals and synth melodies, while the finer, rhythmic vertical lines in the upper regions are the track’s rapid-fire hi-hats.</p><h4>Step 2: The AI’s Brain (aka The Machine Learning Core)</h4><p>Once the sound is a visual fingerprint, the heavy-duty AI models get to work. Platforms typically use a combination of two types:</p><ul><li><strong>Convolutional Neural Networks (CNNs):</strong> Think of these as the AI’s eyes. They scan the spectrogram “image” to identify key patterns, like a heavy bass drop at the 7-second mark or a specific vocal hook. They’re looking for the sonic details that make a sound catchy. Sabrina Carpenter’s Espresso would be a perfect example, a groovy bassline underlining the catchy vocal hook.</li><li><strong>Long Short-Term Memory Networks (LSTMs):</strong> Think of these as the AI’s ears. They analyze the sequence of the sound over time. LSTMs understand the flow, rhythm, and progression of the audio, determining if it has a satisfying loop or a memorable structure.</li></ul><p>Together, these models condense the entire essence of the sound into a compact <strong>vector</strong> of numbers, a sort of “musical DNA.”</p><p>Think of the CNN’s job like this: A small window, or “filter,” slides across the spectrogram image, looking for one specific thing at a time. One filter might be trained to find the sharp vertical lines of a drum hit, while another looks for the horizontal bands of a long vocal note. By combining the findings from hundreds of these filters, the AI builds a complete picture of the audio’s texture and key moments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/0*Jf23yfjCZN94OQlK.png" /></figure><p><strong>Input (Original Audio → Log-Mel Spectrogram): </strong>The raw audio waveform is converted into a Log-Mel spectrogram, which is essentially a heatmap of frequencies over time. This is the visual form of audio that neural nets can process.</p><p><strong>Attention Mechanism (Top part of diagram): </strong>The system generates two types of attention spectrograms:</p><p><strong>Frequency Attention (Fw):</strong> Highlights which frequencies (bass, vocals, beats) matter most for the sound’s identity.</p><p><strong>Temporal Attention (Tw):</strong> Focuses on when those features occur (like a hook at the 7s mark).</p><p>These are combined into a T-F Attention Spectrogram that captures both “what” the sound is and “when” it happens.</p><p><strong>CNN Backbone (Bottom part of diagram):</strong>Multiple convolutional layers (Conv1 → Conv6) extract higher-level features like rhythm, melody, or repeated beats.</p><p>MaxPooling layers compress info while keeping the strongest signals.Finally, Fully Connected (FC) layers classify or embed the sound into a vector representation.</p><p><strong>Softmax Output: </strong>The model either classifies the sound (e.g., genre, mood, vibe) or creates an embedding vector that can be compared to other audios in FAISS/ANNOY for similarity search.</p><h4>Step 3: Finding the Viral Clones</h4><p>Now that every audio has its own unique DNA, How does a platform find similar strands of music out of millions of others in the blink of an eye? A linear search for similar songs would take forever.</p><p>Enter: a brilliantly named tool from Spotify called ANNOY (Approximate Nearest Neighbors Oh Yeah). You can think of the ANNOY tool as an extremely efficient librarian for sound. Instead of one long shelf, it organizes sounds in a complex tree of “neighborhoods” relative to a sound’s DNA. So, when you like a song, the algorithm doesn’t go through all the music. Instead, it goes to the right neighborhood to find similar-sounding tracks in almost real-time.</p><p>The magic is in the word ‘Approximate.’ ANNOY does not promise the single most perfect match for the best track in the library. It promises you a bunch of really close matches, and it does this so quickly, you don’t even realize it.</p><p><strong>Visualizing the ANNOY Index</strong></p><p>The “tree-like structure” ANNOY builds isn’t like an oak tree; it’s more like a series of cuts that divide up the entire library of sounds. Imagine every sound is a dot in space. ANNOY repeatedly slices this space in half until every dot is in its own tiny neighborhood with its closest sonic relatives.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/0*AU1oTa3ZRtEcsbZM" /></figure><p>The diagram shows how platforms rank viral audios by comparing <strong>query vectors</strong> (the audio a user uploads or listens to) against <strong>base vectors</strong> (the existing pool of indexed viral sounds).</p><ul><li>Each audio track is converted into a <strong>vector embedding.</strong></li><li>When a new audio is uploaded, the system builds its query vector and feeds it, along with base vectors of already indexed sounds, into a <strong>neural ranking network</strong>.</li><li>The network outputs a <strong>ranking score</strong>, which tells how closely the new track resembles existing viral candidates.</li></ul><p>In other words, this is the <strong>engine behind “is this sound similar enough to a trend?”</strong> If the score is high, the platform knows the audio might ride the same wave of virality and can push it harder in recommendations.</p><p><strong>Under the Hood: ANNOY in Action</strong></p><p>The Python code for using ANNOY is just as clever and efficient as the idea itself. Here’s a basic example of how a developer might index and search for similar sound vectors.</p><p>Python</p><pre>from annoy import AnnoyIndex<br># Assume our sound &#39;vectors&#39; have 40 dimensions<br>dimensions = 40<br># We&#39;ll use cosine distance to measure similarity<br>metric = &#39;angular&#39; <br># Create the index<br>annoy_index = AnnoyIndex(dimensions, metric)<br># Imagine we have thousands of sound vectors we add to the index<br>for i, vector in enumerate(all_sound_vectors):<br>    annoy_index.add_item(i, vector)<br># Build the tree for fast searching (10 trees give a good balance of speed/accuracy)<br>annoy_index.build(10) <br># Now, find the 5 closest sounds to a new vector (e.g., your liked video&#39;s audio)<br>similar_items = annoy_index.get_nns_by_vector(new_sound_vector, 5)<br>print(f&quot;The 5 most similar sounds are at indices: {similar_items}&quot;)</pre><h4>Step 4: Predicting the Next Viral Sound</h4><p>Here’s the wild part: the algorithm isn’t just sitting back, watching what’s already popular. It’s out there gambling on the future, trying to guess which sound will become tomorrow’s viral bop before you even hear it.</p><p><strong>Historical Trends</strong></p><p>Platforms borrow from time-series forecasting tools like <a href="https://facebook.github.io/prophet/docs/quick_start.html">Facebook Prophet</a> to spot seasonal patterns. Holiday jingles like “All I Want for Christmas is You” creep back into the feed every December, “summer vibes” explode in June, and sad-girl acoustics tend to peak right before exam season (don’t quote me, but the correlation feels too real). The algorithm looks at last year’s data, the year before that, and projects what’s statistically likely to trend again.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/0*iRnocUg--MxJFZD3" /></figure><p>The core idea of a tool like Prophet can be boiled down to a simple formula that decomposes a time series:</p><p><strong>y(t)=g(t)+s(t)+h(t)+ϵt​</strong></p><p>Where:</p><ul><li>y(t) is the trend we’re trying to predict (e.g., number of uses of a sound).</li><li>g(t) is the <strong>growth</strong> function, showing the general upward or downward trend.</li><li>s(t) is the <strong>seasonality</strong> function, which models weekly or yearly patterns (like the June summer vibes).</li><li>h(t) represents the effects of <strong>holidays</strong> or special events.</li><li>ϵt​ is the error term, accounting for any random noise the model can’t explain.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*e_rlP2iGa75xEyMCa-SyRg.png" /></figure><p>By breaking a trend down into these components, the algorithm can make surprisingly accurate forecasts about what’s coming next.</p><h3>How the Algorithm Manufactures a Trend</h3><p>By combining historical data with real-time analysis, the algorithm doesn’t just react to trends; it actively manufactures them. It does this by looking for two key types of signals: the inherent qualities of the sound itself and the way it travels through social networks.</p><h4>Signal 1: The Sound’s DNA (Pattern Spotting)</h4><p>First, the algorithm analyzes the audio’s structure. Virality often follows a formula. Shorter audios (<strong>under 15 seconds</strong>) are favored as they fit the fast-paced format of Reels and TikToks. The most reliable predictor is a structural sweet spot: a bass drop, catchy hook, or key punchline landing around the <strong>7-second mark</strong>. This is the point where viewers are most likely to loop the video, sending a powerful “addictive” signal to the algorithm.</p><h4>Signal 2: The Social Trajectory (Graph Neural Networks)</h4><p>A catchy sound isn’t enough; its pattern of spreading is even more important. This is where <strong>Graph Neural Networks (GNNs)</strong> come in. GNNs don’t just count likes; they map the social fabric of the platform to see <em>how</em> a sound travels from person to person.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PuoCuZI-I6ktMyEb2_SX8g.png" /></figure><p>The following image illustrates how the algorithm views users as a network of interconnected communities.</p><ul><li>Each <strong>circle (node)</strong> is a user.</li><li>The different colored clusters represent distinct communities (e.g., gamers, foodies, fashion influencers).</li><li>The <strong>red nodes</strong> show the path of a new sound as it spreads.</li></ul><p>The key viral indicator isn’t just a sound getting popular within one community. The algorithm flags a sound as having high potential when it <strong>jumps between separate, well-connected communities</strong> — like from gamers to dancers. This “cross-network” jump signals that the audio has broad appeal, making it a prime candidate for a global trend.</p><h3>The Feedback Loop: Test, Measure, and Boost</h3><p>Once a sound shows promise from these structural and network signals, the algorithm places a bet on it. It initiates a powerful feedback loop to test its potential and amplify it if it succeeds.</p><ol><li><strong>Test:</strong> The system pushes the sound to a small, random sample of users.</li><li><strong>Measure:</strong> It then closely watches key engagement metrics. <strong>Active signals</strong> like reusing the audio in a new video or sharing it are weighted much more heavily than passive signals like simply listening to it.</li><li><strong>Boost:</strong> If engagement exceeds a certain threshold, the algorithm enters a reinforcement cycle. It boosts the audio, pushing it to a larger audience.</li></ol><p>This <strong>Test -&gt; Measure -&gt; Boost -&gt; Retest</strong> cycle continues, scaling the content’s reach adaptively. This process allows the algorithm to turn a small spark into a viral wildfire, propelling the audio straight into your feed.</p><h3>Conclusion</h3><p>Think you’re in control of your feed? That’s cute.</p><p>The truth is, every single viral sound you hear has been through a ruthless vetting process. It was fingerprinted, its sonic DNA was analyzed, and it survived a brutal, data-driven Hunger Games of A/B testing before the algorithm decided it was worthy of your attention. The system’s entire purpose is to be a matchmaker, pairing a perfectly engineered earworm with a brain it knows is susceptible. Your listening habits, your friend network, your soft spot for 90s remixes; it was all part of the profile.</p><p>So the next time a song from a Reel gets stuck in your head, don’t fight it. Just smile.</p><p>Because you didn’t find the bop. It found you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6986dcb2fd2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/why-some-audios-loop-in-your-head-and-feed-6986dcb2fd2c">Why Some Audios Loop in Your Head (and Feed)</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simulating the Universe on your Computer]]></title>
            <link>https://medium.com/gdg-vit/simulating-the-universe-on-your-computer-8ce964d7d5a1?source=rss-9f23abf3ff47------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ce964d7d5a1</guid>
            <category><![CDATA[astrophysics]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[computational-physics]]></category>
            <category><![CDATA[matplotlib]]></category>
            <dc:creator><![CDATA[Jiya Shrimalani]]></dc:creator>
            <pubDate>Fri, 25 Apr 2025 12:36:16 GMT</pubDate>
            <atom:updated>2025-04-25T12:36:16.468Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pDMo3NHhWP5qim7DMi8anw.png" /></figure><p><em>“We used to look up at the sky and wonder at our place in the stars. Now, we just look down and worry about our place in the dirt.”</em><br> — Cooper, <em>Interstellar</em></p><p>Humanity once built pyramids to touch the heavens, navigated oceans by starlight and launched metal boxes full of apes into the void, just to see if we could. Now?</p><p>We’ve gone from <em>“One small step for man”</em> to <em>“One more scroll before bed.”</em></p><p>But I’m not here to take a dig at your screen time, I’m here to spark the dormant spirit of curiosity and maybe ignite the Dora the Explorer inside you, except this time Dora is headed for the stars.</p><p>The universe isn’t just an entity out there, it’s in your hands. With just a few lines of code and a little understanding of physics, You can simulate gravitational systems. No cosmic mysteries, just particles moving under Newton’s laws. It’s simpler than you think.</p><p>So let’s begin!</p><h3>Am I delusional or are we actually doing this?</h3><p>Let’s be real, we’re not actually simulating the entire universe. That would be ridiculous. But using basic physics rules (gravity, motion) and some Python code, we can model simplified cosmic interactions.</p><p>We will build a working N-body simulation, the same fundamental tool researchers use to study everything from planets to galaxies. It’s simpler than it sounds, and way cooler than whatever show you’re currently binge-watching.</p><p>At its core, the <strong>N-body simulation</strong> is a model designed to simulate the movement and interaction of particles (or “bodies”) in a gravitational system.</p><p>In these simulations, each body has a mass, position, and velocity. The simulation works by calculating how every body in the system influences every other body, using the basic principles of gravity.</p><h3>Setting Up</h3><p>Start off by creating a python file in your preferred text editor then and import the given libraries. This implementation uses NumPy for numerical computation and SymPy for deriving equations of motion, combining numerical efficiency with mathematical rigor in a physics simulation.</p><pre>import numpy as np<br>import sympy as sp</pre><h4>Defining the Vector Classes</h4><p>For incorporating gravitational interactions in N-body simulations, we need a reliable way to handle basic vector operations like addition, subtraction, dot products, and magnitude calculations. While libraries like NumPy offer vector utilities, defining a simple custom class gives us more control and clarity.</p><p>Here’s a compact version of a 2D vector class that we’ll be using throughout our simulation.</p><pre>class Vec2:<br>    def __init__(self, x, y):<br>        self.x = x<br>        self.y = y<br><br>    def __str__(self):<br>        return f&quot;({self.x}, {self.y})&quot;<br><br>    def __add__(self, v):<br>        return Vec2(self.x + v.x, self.y + v.y)<br><br>    def __radd__(self, v):<br>        return Vec2(self.x + v.x, self.y + v.y)<br><br>    def __sub__(self, v):<br>        return Vec2(self.x - v.x, self.y - v.y)<br><br>    def __rsub__(self, v):<br>        return Vec2(v.x- self.x , v.y - self.y)<br><br>    def __mul__(self, n):<br>        return Vec2(self.x * n, self.y * n)<br><br>    def __rmul__(self, n):<br>        return Vec2(self.x * n, self.y * n)<br><br>    def dot(self, v):<br>        return self.x*v.x + self.y*v.y<br><br>    def get_length(self):<br>        return np.sqrt(self.dot(self) )<br>    </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X6K-tkNNjssc9X3pZuL5Yw.jpeg" /><figcaption><strong>Visualizing Vector Addition: The sum of </strong>Vec2(3,4)<strong> and </strong>Vec2(1,2)<strong> is </strong>Vec2(4,6)<strong>, calculated using the </strong>__add__<strong> method in our </strong>Vec2<strong> class.</strong></figcaption></figure><h4>Defining the particle class</h4><p>In any N-body simulation, the basic unit is the <strong>particle</strong> which is basically a representation of a star, planet, or any celestial body. Each particle has its own position, velocity, and mass, and it interacts with all the others through gravitational forces. Our Particle class encapsulates all of this behavior. It also handles the symbolic computation of equations of motion, which is key to making the simulation both efficient and insightful.</p><p>We use sympy to symbolically define the positions and velocities of each particle, and then use lambdify to convert these symbolic expressions into fast numerical functions that can be evaluated repeatedly.</p><h4>But why use symbolic math and lambdify?</h4><p>Normally, if you calculate stuff like acceleration in a loop every time, it gets <strong>really slow</strong>, especially when there are many particles.</p><p>So instead of computing math in real-time over and over, we first write the <strong>formulas symbolically</strong> (like how you’d write them on paper using x, y, vx, vy), using SymPy.</p><p>Then we use <a href="https://www.sympy.org/scipy-2017-codegen-tutorial/notebooks/22-lambdify.html">lambdify</a>, which basically converts those formulas into fast, normal Python functions. Now the simulation runs way faster because we’re using pre-built formulas instead of re-doing the math each time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJ1a0VRJH8ujwIyWZuqvYQ.jpeg" /><figcaption><strong>Hardcoded vs. symbolic evaluation for </strong>sin⁡2(x)+cos⁡2(y)sin2(<em>x</em>)+cos2(<em>y</em>)<strong>. Note the performance gains (lower is better) as complexity scales.</strong></figcaption></figure><p>Want to test this yourself? Swap the lambdify approach with hardcoded loops in the <a href="https://github.com/Jiya1101/Nbodysimulation">GitHub code</a> and compare runtime!</p><p>Here’s what it looks like</p><pre>class Particle():<br><br>    n = 0<br><br>    def __init__(self, initial_pos, initial_vel, mass):<br>        self.i = Particle.n  # Unique index for each particle<br>        Particle.n += 1<br><br>        self.m = mass<br>        self.G = 1  # Gravitational constant (can replace with real value for realism (6.6743 × 10-11)<br><br>        # Symbolic position and velocity vectors for this particle<br>        self.pos = Vec2(sp.symbols(f&quot;x_{self.i}&quot;), sp.symbols(f&quot;y_{self.i}&quot;))<br>        self.vel = Vec2(sp.symbols(f&quot;vx_{self.i}&quot;), sp.symbols(f&quot;vy_{self.i}&quot;))<br>        self.acc = Vec2(0, 0)  # Placeholder for acceleration<br><br>        # Lambdified versions for faster evaluation later<br>        self.lamb_vel = Vec2(None, None)<br>        self.lamd_acc = Vec2(None, None)<br><br>        # Initial conditions<br>        self.initial_pos = initial_pos<br>        self.initial_vel = initial_vel<br><br>        # Vector field components for velocity and acceleration<br>        self.vf_vel = Vec2(0, 0)<br>        self.vf_acc = Vec2(0, 0)<br><br>        # Solutions after integration (populated later)<br>        self.sol_pos = Vec2(None, None)<br>        self.sol_vel = Vec2(None, None)<br></pre><h4>Initializing the conditions</h4><p>Once the Particle class is defined, the next step is to populate your simulation with actual particles<strong>.</strong> Each one is created with a starting position, velocity, and mass. This setup determines how they’ll interact over time.</p><p>Each Particle object represents a celestial body with:</p><ul><li>A 2D position vector Vec2(x, y)</li><li>A velocity vector Vec2(vx, vy)</li><li>A scalar mass</li></ul><pre>par.append(Particle(initial_pos=Vec2(5, 2), initial_vel=Vec2(0.5, 0.2), mass=1.0))<br>par.append(Particle(initial_pos = Vec2(3,3), initial_vel = Vec2(0.1,0.5) , mass = 1.))<br>par.append(Particle(initial_pos = Vec2(0.6,2.5), initial_vel = Vec2(0.5,0.5) , mass = 1.))<br>par.append(Particle(initial_pos=Vec2(8, 8), initial_vel=Vec2(0.3, 0.7), mass=1.5))<br>par.append(Particle(initial_pos=Vec2(2, 9), initial_vel=Vec2(0.3, 0.7), mass=1.))</pre><p>We also set:</p><ul><li>t_end: total simulation time</li><li>steps: number of time intervals to break the simulation into (higher = smoother but slower)</li></ul><pre><br>t_end = 60.0   <br>steps = 800    <br>n = len(par)   # total number of particles</pre><h4>From Theory to Motion: Making the Universe Move</h4><p>We’ve defined particles and set their initial conditions. But how do they actually move?</p><p>The heart of the simulation comes down to how we calculate the forces between particles and how those forces translate into motion. Newton’s law of gravitation gives us the foundation for this, and we’ll use it to calculate the acceleration of each particle.</p><pre>for i in range(n):<br>    par[i].calculate_acc(par)<br><br>for i in range(n):<br>    par[i].lambdify_vel(par)<br>    par[i].lambdify_acc(par)</pre><ul><li>calculate_acc(par): Uses Newton’s law of gravitation to calculate the total acceleration on each particle due to every other particle.</li><li>lambdify_vel(par): Converts the symbolic velocity expressions into efficient Python functions.</li><li>lambdify_acc(par): Same as above, but for acceleration — this helps during numerical integration.</li></ul><h4>Integrating the Particle Motion</h4><p>To simulate how particles move under gravitational attraction, we need to solve the equations of motion for each particle. This can be done using numerical integration techniques like the <a href="https://web.mit.edu/10.001/Web/Course_Notes/Differential_Equations_Notes/node5.html"><strong>Runge-Kutta method</strong></a>, or in our case, SciPy’s odeint function, which is designed to solve systems of ordinary differential equations (ODEs).</p><p>We already know that the position and velocity of each particle are interrelated, and that gravitational forces between particles affect their accelerations. So, let’s break down the code that integrates the particles’ motions over time.</p><p>The vectorfield function defines how particles move using Newton’s laws. It returns a list of derivatives (velocities and accelerations), which we pass to odeint for integration.</p><pre>from scipy.integrate import odeint<br><br>def vectorfield(var, t):<br>    <br>    pos = var[0:2*n] <br>    vel = var[2*n:4*n] <br>    f = []<br>    <br>    for i in range(0,n):        <br>        par[i].vf_vel.x = par[i].lamb_vel.x(vel[2*i])<br>        par[i].vf_vel.y = par[i].lamb_vel.y(vel[2*i + 1])<br>        f.append(par[i].vf_vel.x)<br>        f.append(par[i].vf_vel.y)<br>        <br>    for i in range(0,n):        <br>        par[i].vf_acc.x = par[i].lamd_acc.x(pos)<br>        par[i].vf_acc.y = par[i].lamd_acc.y(pos)<br>        f.append(par[i].vf_acc.x)<br>        f.append(par[i].vf_acc.y)<br><br>    return f</pre><p>Before running the simulation, we need to bundle all particle positions and velocities into one list for the integrator.</p><pre># set the initial conditions<br>var = []<br>for i in range(len(par)):<br>    var.append(par[i].initial_pos.x)<br>    var.append(par[i].initial_pos.y)<br>    <br>for i in range(len(par)):<br>    var.append(par[i].initial_vel.x)<br>    var.append(par[i].initial_vel.y)</pre><p>This var list becomes our starting point for solving the differential equations.</p><h4>Solving the equations of motion</h4><p>Now that we’ve defined our system, we use SciPy’s odeint to numerically integrate the equations and simulate particle motion over time.</p><pre># ODE solver parameters<br>t = np.linspace(0, t_end, steps+1)<br><br>sol = odeint(vectorfield, var, t)<br>sol = np.transpose(sol)<br><br># order the solution for clarity<br>for i in range(n):<br>    par[i].sol_pos.x = sol[2*i]<br>    par[i].sol_pos.y = sol[2*i+1]<br>    <br>for i in range(n):<br>    par[i].sol_vel.x = sol[2*n + 2*i]<br>    par[i].sol_vel.y = sol[2*n + 2*i+1]<br><br>Energy = 0 <br>for i in range(0,n):<br>    for j in range(i+1,n):<br>        Energy += (-1/(((par[i].sol_pos.x-par[j].sol_pos.x)**2 + (par[i].sol_pos.y-par[j].sol_pos.y)**2)**(1/2)))<br><br># Kinetic Energy<br>for i in range(0,n):<br>    Energy += 0.5*(par[i].sol_vel.x*par[i].sol_vel.x + par[i].sol_vel.y*par[i].sol_vel.y)</pre><p>The output gives you time-evolved positions and velocities for each particle and we’re all set to visualize our particles.</p><h4>Animating the particles</h4><p>Finally, let’s plot the initial frame of our simulation using a dark theme. It helps us verify scale, position, and aesthetics before animating.</p><pre>import matplotlib.pyplot as plt<br>plt.style.use(&#39;dark_background&#39;)<br>fig = plt.figure(figsize=(7, 7))<br>ax = fig.add_subplot(1,1,1)<br><br>plt.subplots_adjust(bottom=0.2, left=0.15)<br><br>ax.axis(&#39;equal&#39;)<br>ax.axis([-1, 30, -1, 30])<br>ax.set_title(&#39;Energy =&#39; + str(Energy[0]))<br>ax.xaxis.set_visible(False)<br>ax.yaxis.set_visible(False)<br></pre><p>We now prep the visual elements: a timer to show the simulation time, moving circles to represent each body, and a trailing line to trace their paths.</p><pre><br>timer_text = ax.text(0.02, 0.95, &#39;Time: 0.00&#39;, transform=ax.transAxes, <br>                     color=&#39;white&#39;, fontsize=12)<br><br>circle = [None]*n<br>line = [None]*n<br>for i in range(n):<br>    circle[i] = plt.Circle((par[i].sol_pos.x[0], par[i].sol_pos.y[0]), 0.08, ec=&quot;w&quot;, lw=2.5, zorder=20)<br>    ax.add_patch(circle[i])<br>    line[i] = ax.plot(par[i].sol_pos.x[:0], par[i].sol_pos.y[:0])[0]</pre><p>And we’re almost done with our N-body simulation, if you’d like you can always add features like a play/pause button or a slider to stop and resume the animation at any frame you want. You can also make it more interactive by taking inputs for the starting positions, mass, and velocities of the particles.</p><h4>Final Showdown</h4><p>There’s a unique thrill in watching your lines of code finally produce an error-free output. In this case, there’s something almost magical about seeing your own tiny universe spring to life.</p><pre>from matplotlib.animation import FuncAnimation<br>animator.animation = FuncAnimation(fig, animator.update, frames=len(t),<br>                                 interval=50, blit=False, repeat=True)<br><br>plt.show()</pre><p>Here’s what the animation looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*kezABFCDtiNRSJF7CiE2kQ.gif" /><figcaption>N=5 (simulation using 5 particles)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*C0rUodyXdcT0kc6V7G-BCA.gif" /><figcaption>N=3 (simulation using 3 particles)</figcaption></figure><h3>Building Blocks of a Simulated Universe</h3><p>But hey, go easy on the god complex. Our version skips over a lot of what makes real universe simulations tick. We’re not crunching millions of particles, balancing memory across nodes, or offloading compute to GPUs. We’re just using Python, NumPy, and Matplotlib to get a feel for how basic simulation works.</p><p>Still, this is how it all starts.</p><p>Real cosmological simulators like <strong>GADGET</strong>, <strong>AREPO</strong>, or <strong>IllustrisTNG</strong> are built on the same principles, just scaled up with serious tech. They use languages like C++ for speed, <strong>MPI</strong> for distributing tasks across machines, <strong>HDF5</strong> for managing massive datasets, and <strong>NumPy</strong> or <strong>yt</strong> for post-processing and visualization. The math doesn’t really change it’s the tooling and optimization that level things up.</p><p>Watch this video to see how millions of particles in motion look like in a simulation.</p><p><a href="https://youtu.be/DoLe1c-eokI?feature=shared">https://youtu.be/DoLe1c-eokI?feature=shared</a></p><h4>What can <em>you</em> do right now?</h4><p>Use your N-body sim as a <strong>sandbox</strong>. A place to experiment with physics, data, and computation. Here’s how to start building it out:</p><h3>1. Go 3D</h3><p>Move beyond flat visuals. Extend your simulation to 3D space using:</p><ul><li>matplotlib’s Axes3D for static visuals</li><li>Plotly or <a href="https://vpython.org/">VPython</a> for interactive 3D</li><li>Position and velocity now have x, y, z components.</li></ul><p><a href="https://youtu.be/T_qhi9-W0HE?feature=shared">3D Gravity Simulation in Python.</a></p><h3>2. Integrate Better Physics</h3><p>Your sim doesn’t need to stop at Newton’s law. Add:</p><ul><li><a href="https://stackoverflow.com/questions/9523928/n-body-simulation-how-to-choose-the-softening-factor"><strong>Softening factors</strong></a> to avoid infinite forces</li><li><strong>Velocity-based forces</strong> (e.g., drag, attraction)</li><li>Even <a href="https://en.wikipedia.org/wiki/Relativistic_mechanics"><strong>relativistic tweaks</strong></a>, if you’re up for a challenge</li></ul><h3>3. Upgrade Your Rendering</h3><p>Matplotlib is fine, but for smoother visuals:</p><ul><li>Use Pygame for real-time control</li><li>Or try PyOpenGL for GPU-accelerated 3D rendering</li><li>Bonus: export your simulation frames to <a href="https://www.blender.org/">Blender</a> for cinematic animations</li></ul><p><a href="https://youtu.be/RGJHVLjkONs?feature=shared">https://youtu.be/RGJHVLjkONs?feature=shared</a></p><h3>4. Go Parallel</h3><p>Big simulations choke single-threaded Python. Try:</p><ul><li>Numba to JIT-compile your math-heavy loops</li><li><a href="https://docs.python.org/3/library/multiprocessing.html">multiprocessing</a> to divide the load across CPU cores</li><li><a href="https://cupy.dev/">CuPy</a> for GPU-level acceleration (if you’ve got CUDA support)</li></ul><h3>5. Use Real Astronomical Data</h3><p>Try simulating around real star clusters or galaxies by importing data from:</p><ul><li>SDSS SkyServer</li><li>ESA Gaia Archive</li><li><a href="https://allendowney.github.io/AstronomicalData/README.html">Load into your simulation and watch what real gravity does.</a></li></ul><h3>6. Save and Reload Sim States</h3><p>Don’t restart from scratch every time. Add:</p><ul><li><a href="https://docs.python.org/3/library/pickle.html">pickle</a> for quick object saves</li><li><a href="https://www.h5py.org/">HDF5</a> (via h5py) for structured, large-scale snapshots</li><li>Or plain JSON for portability</li></ul><h3>7. Make It Your Universe</h3><p>This sandbox can be anything you want:</p><ul><li>A star cluster playground</li><li>A gravity-based art generator</li><li>A testing ground for AI agents that steer celestial objects</li><li>A physics engine for a space game</li></ul><h3>Wrapping up</h3><p>I’ll be honest the first time I got this working and saw those particles start dancing, I may have done a little victory dance myself. There’s something magical about watching pure math turn into motion. Now, it’s time to make this simulation your own.</p><p>All the code’s waiting for you here:<br><a href="https://github.com/Jiya1101/Nbodysimulation">https://github.com/Jiya1101/Nbodysimulation</a></p><p>Go ahead, add more particles, optimize, reinvent, tweak it, and break it. If nothing crashes, you’re not trying hard enough.</p><p>May the Force be with you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ce964d7d5a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/simulating-the-universe-on-your-computer-8ce964d7d5a1">Simulating the Universe on your Computer</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hackathon Hustle: A DevJams Starter Pack]]></title>
            <link>https://medium.com/gdg-vit/the-hackathon-hustle-a-devjams-starter-pack-0ee9f6efa932?source=rss-9f23abf3ff47------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ee9f6efa932</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[events]]></category>
            <dc:creator><![CDATA[Jiya Shrimalani]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 15:46:35 GMT</pubDate>
            <atom:updated>2024-08-11T14:29:00.600Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXik8_sXR_m2TvmNZ53pnw.png" /></figure><p>En route to becoming an engineer? You must have heard “Hackathon” at least once in your college life so far. It may sound like an event where the Alan Turings of our century pair up with the budding Elon Musks to solve complex world problems with their unobtainable technical skills and jargon.</p><p>But in reality, it’s just a nerdy sleepover, where an epic battle of keyboards replaces the silly pillow fights and you bond over the shared struggles of debugging nightmares. Doesn’t sound like your ideal night out, but it is an essential one in your journey to becoming a well-rounded (corporate slave) individual.</p><p>Stepping into competitions like these, some people might get cold feet, doubting their competency and significance to the team, but trust me, the only way to attain your prowess is to just begin, even if all you know is just <em>print “Hello World!”</em></p><h4>The Triumph and Trials</h4><p>With the ever-growing plethora of resources on the internet, you can equip yourself with all the handy skills to collaboratively build something from the ground up that you’ll have to pitch to the panel and face the moment of truth. Either they grill you down Comedy Central Roast style, (nothing personal, it’s just how tech enthusiasts engage in banter and hand out “constructive” criticism), or if you’re lucky enough you get some praises wedged between all of the above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5G0rS8Fii5D0tPmm-tfSQ.jpeg" /><figcaption>When the hackathon review round is in an hour and you just started coding (PS: Don’t try this)</figcaption></figure><p>If this doesn’t sound enticing enough yet, let me sweeten the deal: not only will you earn some serious bragging rights, but you can also win a substantial cash prize and exclusive merchandise. And if your idea and prototype truly shine, you can be one of those people with laptops adorned with impressive, coveted stickers.</p><p>On a more serious note though, let’s take a look at the process in further detail.</p><h4>The Blueprint</h4><p>Any hack begins with the release of tracks or themes that the organizers set to guide the participants in choosing their projects, so you don’t end up like those people trying to pitch in Throx at Shark Tank.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*54kervETsQg_OYVVNPCEQA.png" /><figcaption>Throx, the brand selling socks in threes to solve the lost sock problem, pitched on <em>Shark Tank</em> but got socked by the Sharks instead!</figcaption></figure><p>Although these eccentric sock enthusiasts shouldn’t keep you at bay from putting on your thinking caps and riding away into the land of visionaries to begin your quest, they remind us that every idea, no matter how unusual, has potential.</p><p>Once you’ve teamed up and devised an idea worthy of the contest, you submit it and wait for approval from the organizing board. A combination of feasibility, functionality, and innovation will land you a place in the event where “sleep is for the weak” is the general belief, and you better stand by it.</p><p>As the approval email lands in your inbox, excitement and a hint of anxiety set in. You and your team gather around a whiteboard, laptops open, and begin the rigorous process of turning your concept into reality. This is where the true essence of a hackathon comes to life.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*-hkxLUpC879wt-UN519pDw.jpeg" /></figure><h4><em>Git Good</em></h4><p>To transform your idea into a functional product, the first step is to set up a reliable development environment. This environment includes tools and platforms that facilitate efficient coding, collaboration, and testing. Here’s a detailed breakdown of what you need and why it’s important:</p><h4><strong>Version Control with Git</strong></h4><p><a href="https://www.atlassian.com/git/tutorials/what-is-version-control#:~:text=Version%20control%2C%20also%20known%20as,to%20source%20code%20over%20time.">Version control</a>, commonly known as source control, refers to a system that keeps track of changes made to the file over time. Git is a powerful version control system that is well-tailored for collaborative software development. It records the changes done and allows you to revert to a previous version if needed. Undeniably, it makes working in a team a cakewalk, if you minus all the conflict of opinions and the consequent daggers thrown at each other.</p><p>Nonetheless, collaboration is one of the key features of using version control. You can even create separate branches to work on new features or bug fixes without affecting the main project. Once the work is complete and tested, it can be merged back into the main branch.</p><h4><em>How To Use Git?</em></h4><p>You start by creating a repository (repo) on GitHub, which is an online platform for hosting Git repositories. This repo will store all your project’s files and their history. Each change you make is saved as a commit, which is a snapshot of your project at a certain point in time.</p><h4><strong>Essential Git Commands</strong></h4><p>Here are some basic <a href="https://github.com/joshnh/Git-Commands">Git commands</a> that will help you get started:</p><p><strong>Initialize a New Repository:</strong> This command sets up a new Git repository in your current directory.</p><pre>git init</pre><p><strong>Clone an Existing Repository:</strong> This command copies an existing repository from a URL (usually from GitHub) to your local machine.</p><pre>git clone [url]</pre><p><strong>Check Repository Status:</strong> This command shows the status of your working directory and staging area.</p><pre>git status</pre><p><strong>Add Changes to Staging Area:</strong> This command adds the specified file(s) to the staging area, preparing them for a commit. You can add all changes in the current directory to the staging area as well.</p><pre>git add [file]</pre><p><strong>Create a New Branch:</strong> This command creates a new branch with the specified name.</p><pre>git branch [branch-name]</pre><p><strong>Switch to a Branch:</strong> This command switches to the specified branch.</p><pre>git checkout [branch-name]</pre><p><strong>Merge Branches:</strong> This command merges the specified branch into the current branch.</p><pre>git merge [branch-name]</pre><p><strong>Push Changes to Remote Repository:</strong> This command pushes your changes from the specified branch to the remote repository.</p><pre>git push origin [branch-name]</pre><p><strong>Pull Changes from Remote Repository:</strong> This command fetches and merges changes from the remote repository to your local branch.</p><pre>git pull</pre><p><strong>View Commit History:</strong> This command shows the commit history of your repository.</p><pre>git log</pre><p>Now that you’ve got your version control sorted, let’s talk about the tools that will make coding a breeze</p><h4>The Coding Compadres</h4><p>Integrated Development Environments (IDEs) are essential tools that streamline the process of software development while making the workflow smoother. When it comes to IDEs, choosing the right one depends mainly on your development needs. Visual Studio Code is a versatile, flexible, and lightweight editor that supports many languages. PyCharm, on the other hand, is a Python specialist. IntelliJ IDEA and NetBeans are commonly used by Java programmers. These tools not only make coding more efficient with their error-checking and debugging features but also help keep your project files well-organized.</p><p>Here are a couple of links to set up your own IDE.</p><p><strong>Pycharm:</strong></p><p><a href="https://www.jetbrains.com/pycharm/download/?section=windows">Download PyCharm: The Python IDE for data science and web development by JetBrains</a></p><p><strong>Visual Studio code:</strong></p><p><a href="https://code.visualstudio.com/Download">Download Visual Studio Code - Free AI Code Editor for Mac, Linux, Windows</a></p><p>With your hackathon toolbox fully stocked and your environment set up like a pro, you’re ready to tackle anything the coding gods throw your way. Whether you’re building the next big startup or just experimenting with wild ideas, these tools will be your trusty companions on the journey to hackathon glory.</p><p>Enough with the build-up, let’s talk about our very own DevJams’24, the battleground for you to test all the knowledge imparted to you so far and set your foot in the world of code-crazed techies.</p><h4>DevJams’24: Code, Create, Collaborate</h4><p>Continuing with their streak, we at GDSC VIT, will be organizing the 7th edition of the much anticipated DevJams in September 2024, encouraging students from diverse academic backgrounds to partake in this thrilling game changer.</p><p>DevJams is more than just a hackathon; it’s a catalyst for out-of-the-box solutions and creative thinking. Whether you’re a beginner or a seasoned techie, we encourage you to indulge in this exhilarating experience, which is ensured to stir the innovative spirit in you.</p><p>Our main motive is to foster a collaborative environment where all the participants are eager to tackle everyday challenges with unconventional ideas. It’s not just any coding event, it’s a platform for budding entrepreneurs to team up with like-minded people and jam their way into creating something that leaves even them awe-struck because here, we do crazy things that matter!</p><h4>Joining DevJams’24: Enrolling and Forming Teams</h4><p>Wondering how to be a part of DevJams now?</p><p>Since this is an event exclusively for students of VIT Vellore, you need to register on VTOP, followed by our website. Registrations will be opening soon, so keep an eye out for updates!</p><p>If you’re looking for a team, join our official Discord server dedicated especially to DevJams, which can help you connect with like-minded tech aficionados or people who best complement your skills.</p><p>And if you’re still unsure about taking part in this, the event promises an exciting lineup of activities, including insightful sessions led by industry tech tycoons and a fun midnight concert featuring your peers.</p><h4>Conclusion</h4><p>Now that you’ve got the lowdown on hackathons and the skills to match, you’re officially hackathon-ready. With your environment all set up and coding skills equipped, you’re all geared up to take on the challenge you might’ve long feared.</p><p>DevJams promises to be a milestone in your journey, blending innovation with camaraderie to create unforgettable experiences. Whether you’re a coding enthusiast, an aspiring entrepreneur, or simply curious about the latest updates in tech, this event is your chance to shine!</p><p>For more such updates and exciting build-ups, follow us on our <a href="https://www.instagram.com/gdscvitvellore/">Instagram</a>, <a href="https://twitter.com/gdscvit?lang=en">Twitter</a>,<a href="https://www.linkedin.com/company/dscvit/"> and LinkedIn</a>, and stay in the loop with crucial dates and announcements for DevJams’24. Good luck!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ee9f6efa932" width="1" height="1" alt=""><hr><p><a href="https://medium.com/gdg-vit/the-hackathon-hustle-a-devjams-starter-pack-0ee9f6efa932">The Hackathon Hustle: A DevJams Starter Pack</a> was originally published in <a href="https://medium.com/gdg-vit">GDG VIT Vellore</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>