#binary search algorithm
Explore tagged Tumblr posts
rahulswriteups · 1 year ago
Text
Tumblr media
Navigating Efficiency: A Comprehensive Guide to the Binary Search Algorithm
In the vast landscape of algorithms, one star shines bright in the realm of search operations—Binary Search. This comprehensive guide aims to demystify the intricacies of this algorithm, exploring not only its mechanics but also delving into the crucial aspect of time complexity. Join us on a journey to unlock the power of efficiency.
Understanding Binary Search:
Binary Search Demystified:
Imagine you have a library of books neatly arranged in alphabetical order. Binary search is like finding a specific book by repeatedly splitting the remaining possibilities in half. You start in the middle, decide if the target is in the left or right half, and continue this process until you've pinpointed the book. This systematic approach is the heartbeat of binary search.
Real-World Scenario:
Consider a scenario where you're searching for a friend in a phone book. You open it in the middle, decide whether their name would be in the first or second half, and repeat until you locate the right entry. This mirrors the efficiency of binary search in swiftly finding elements in a sorted collection.
Time Complexity Unveiled:
The Essence of Time Complexity:
Now, let's dive into the critical realm of time complexity. Binary search boasts a time complexity of O(log n), where n is the number of elements. To put it simply, as your dataset grows, binary search's efficiency doesn't increase at the same pace as linear search, making it a go-to solution for large datasets.
Visualizing Time Complexity:
Picture a scenario where you're searching for a specific contact in your phone—a linear search would involve scrolling through each entry, while binary search mirrors the efficiency of quickly narrowing down your contacts by jumping to the middle, then deciding which half to explore.
Real-Life Applications:
Binary Search in Everyday Scenarios:
Consider managing an extensive contact list on your phone, sorted by names. Binary search becomes your ally in swiftly locating a friend's contact information without scrolling through every entry. This efficiency becomes even more pronounced in scenarios like online databases or searching for elements in a sorted array.
Optimizing Database Queries:
In the realm of databases, where time is of the essence, binary search becomes a game-changer. Whether you're searching for a specific record by ID or querying a sorted dataset for relevant information, the algorithm's efficiency enhances response times and user experience.
Conclusion:
As we conclude our exploration of the Binary Search Algorithm, it stands as a beacon of efficiency in the sea of algorithms. Its simplicity, coupled with the elegance of divide and conquer, makes it a valuable asset in the toolbox of any programmer or data scientist.
Armed with the knowledge of binary search and its time complexity advantages, you're empowered to optimize search operations and enhance the responsiveness of your applications. In the dynamic world of technology, where speed and efficiency are paramount, understanding the nuances of binary search opens doors to a realm of possibilities, making your journey through the vast data landscape smoother and more rewarding.
Know more: Click Here
0 notes
vatche-dev · 2 years ago
Text
Grokking Algorithms #1
I’m awful at algorithms. There, I said it. I could blame my college algorithms professor or the fact that I’ve never had to use fancy algorithms at work. But anytime I’m on the market for a new job, I’m confronted with the inevitable HackerRank or LeetCode challenge and I stumble, remembering my biggest weakness as a software engineer. Now that I’m happy with my current job, I figure it’s a…
Tumblr media
View On WordPress
2 notes · View notes
tinchicus · 4 months ago
Text
C++ / algoritmo de busqueda binaria
Hoy les traigo otro algoritmo de busqueda pero con otra manera de trabajar. Espero les sea de utilidad!
Bienvenidos sean a este post, hoy veremos otra forma de busqueda. En el post anterior vimos como crear un algoritmo de busqueda simple con iteradores para hacerlo completamente generico. La busqueda binaria puede ser mas simple que el visto anteriorrmente. Esto es asi porque el primer elemento que mira sera el de la mitad del contenedor. Si el elemento coincide con el que buscamos procede a…
0 notes
shtaras · 1 year ago
Text
youtube
1 note · View note
jcmarchi · 2 years ago
Text
OpenAI GPTs: Building Your Own ChatGPT-Powered Conversational AI
New Post has been published on https://thedigitalinsider.com/openai-gpts-building-your-own-chatgpt-powered-conversational-ai/
OpenAI GPTs: Building Your Own ChatGPT-Powered Conversational AI
What are GPTs?
GPTs, introduced by OpenAI in November 2023, are customizable versions of the ChatGPT model. They represent a significant shift from general-purpose AI chatbots to specialized, purpose-driven AI assistants. GPTs can be tailored for specific tasks, making them more effective and efficient in various domains, from education and gaming to business and creative arts.
OpenAI new GPT Builder (GPTs)
Key Features and Capabilities
Customization Without Coding: One of the most groundbreaking aspects of GPTs is that they require no coding skills to build. This makes it accessible to a broader audience.
Wide Range of Applications: GPTs can be designed for myriad uses, such as teaching math, assisting in game rules interpretation, or creating digital content like stickers.
Integration of Extra Knowledge: Users can feed additional information into GPTs, enhancing their ability to handle specialized tasks.
Functional Flexibility: GPTs can incorporate capabilities like web searching, image creation, and data analysis, depending on the user’s needs.
Creating a Custom GPT: Simplicity and Efficiency
Creating your personalized GPT app is a straightforward process that requires no coding knowledge, making it accessible for anyone with an idea. Here’s a simplified guide on how to bring your custom GPT to life:
Step-by-Step Guide to Creating Your Personalized GPTs App
Login and Navigate: First, log into your ChatGPT account. Look for the “Explore” section, which is usually located on the top left of your screen. This is where you’ll find all the GPT applications you have access to.
OpenAI ChatGPT
Create Your GPT: Click on ‘Create My GPT’. You’ll be taken to a new screen. Here, you’ll be prompted to describe what your GPT should do.
GPTs Interface
Set Your Prompt: Input your prompt with clarity and purpose. For our example we created a “Code Mentor” by entering a prompt: “Create an AI that provides clear explanations and guides users through algorithms and data structures, capable of facilitating real-time problem-solving sessions.”
Building a Coding Mentor with GPTs
Refinement: ChatGPT may ask follow-up questions to refine your concept. This step ensures your GPT is aligned with your vision and is capable of performing its intended functions efficiently.
Testing and Customization: Once created, your GPT appears on the right side of the screen. Here you can test its capabilities and fine-tune its functions. For the “Code Mentor” you might test it with queries like “Explain the concept of dynamic programming” or “Guide me through implementing a binary search tree.”
Save and Share: After you’re satisfied with your GPT, you can save your settings. Then, take advantage of the option to share your GPT with others. This is done through a link, making collaboration easy and promoting a community-oriented approach to AI development.
Remember, while Plus users have immediate access to use the GPTs via shared links, the creators won’t have access to the chats others have with their GPTs,.
Open AI mentioned that Privacy and safety are at the heart of GPTs. Chats with GPTs remain private, not shared with builders, and users have full control over whether data is sent to third-party APIs. Additionally, builders can decide if interactions with their GPT should contribute to model training, giving users and builders alike control over data usage and privacy.
Connecting GPTs to Real-World Applications
Beyond explanations, these GPTs can connect to external data sources or perform actions in the real-world. For instance, you could create a “Shopping Assistant” GPT that helps with e-commerce orders, or a “Travel Planner” GPT that integrates with a travel listings database.
Empowering Enterprises with Custom GPTs
Enterprises can take advantage of internal-only GPTs for specific use cases. This could range from a “Marketing Assistant” that helps draft brand-aligned materials to a “Support Helper” that aids in customer service. These GPTs can be deployed securely within a company’s workspace, with full administrative control over sharing and external GPT usage.
5 custom GPT applications that users have created
Conclusion
The evolution of AI technology with OpenAI’s GPT-4 Turbo and the introduction of customizable GPTs represent a significant leap forward in the field of artificial intelligence. GPT-4 Turbo’s enhanced context window and integration with visual and auditory capabilities mark a new era of conversational AI that is more accurate, detailed, and versatile. The GPTs, with their user-friendly customization options, open up endless possibilities for personal and professional use, democratizing AI technology and making it accessible to a wider audience.
0 notes
charl0ttan · 3 months ago
Text
do you really wanna let an ALGORITHM perform binary search on your tree??
322 notes · View notes
foone · 9 months ago
Text
I really don't know how Tumblr's search manages to be this bad.
Like, I know I have at least 5 posts mentioning FOOBAR (FOOBAR here is a placeholder word).
Tumblr finds 2 of them.
I can totally see how you might have a search engine that doesn't find any of them, but only finding some of them? How?
Are you trying to do an evolutionary algorithm crossed with a chaos monkey where you randomly delete entries from your full text index, figuring that 99% of posts will never be searched for?
Because computers are usually binary! They work or they don't. This half-working is so strange that I can only imagine how Tumblr got it this twisted.
313 notes · View notes
radical-revolution · 7 months ago
Text
Tumblr media
"One of the most persistent and sticky habits of perception that has possessed those of us gestated in modern civilizations is: we tend to see things as separate from each other; we see things as bounded and atomized.
I see the strategy of separation as an attempt to create safety, permanence, fixity, for once and for all, to name things in a final way. That’s the modern impulse. But you run into trouble when things like what’s happening today start to crop up.
We are slowly coming to terms with a world that is more entangling, more relational, and more processual than our modern habits of seeing can allow us to notice or appreciate.
We are not so different from our technologies as modernity would have us believe we are. In shaping computers, we are shaped by computers. In participating in networks, we are conducting and performing emotional labor and shaping ourselves.
It means that we think, act, behave, see, want, yearn, practice, perform, and do things with the world and with others. The presumption that we act as individuals is already being haunted by the idea of an entangled world.
My work in thinking about climate change through the prism of Indigenous realities, poetry, and entanglement, is basically to note that we need to find the places of power with which we might respond to something that is beyond us. We are responding in the machine, and the machine is tired and exhausted.
Slowing down is not a function of speed. It is a function of awareness, and I don’t want to make awareness a mental construct. It’s a function of presence.
So, when I invite slowing down, I invite us to research and to perform research into the ancestral tentacularities that precede us. I’m asking us to touch our bodies, and touch our colonial bubbles.
I’m asking us to listen, to witness, to ‘with-ness’; to be with land, and community, and ancestor, and progeny, and children in a way that isn’t instrumental.
Activism is increasingly instrumental, meaning it’s a form of power that is tied to the logic and algorithm of the status quo. This makes activism, even in the search for justice, a creature of the status quo, which renders hope and justice, as ironic as that sounds, a creature of the things we’re trying to leave behind.
To slow down is to hack the machine, like we’re taking on other forms of body that allow us to penetrate into different kinds of realities—other worlds.
What if rest is listening to one’s Elders? What if rest is dreaming? What if working is playing?
The university structure is one example of a colonial imposition that sees study and learning as only one thing; university tells you that if you’re not studying in some disciplinary manner, then you’re not studying. But what if having a conversation with a friend is a form of study?
Rest is decolonial in its relational entanglements with a capitalist structure. I don’t want to see it as a binary thing: rest vs. non-rest. I want to move outside that binary altogether, and create fugitive communities where rest takes on new meanings altogether. I don’t know what that is—only in the performance of it can we speak about it, and that’s just fine."
~ Bayo Akomolafe
Text source: Dr. Bayo Akomolafe on Slowing Down in Urgent Times https://atmos.earth/dr-bayo-akomolafe-on-slowing-down-in-urgent-times/
22 notes · View notes
kanguin · 2 months ago
Text
Hi, idk who's going to see this post or whatnot, but I had a lot of thoughts on a post I reblogged about AI that started to veer off the specific topic of the post, so I wanted to make my own.
Some background on me: I studied Psychology and Computer Science in college several years ago, with an interdisciplinary minor called Cognitive Science that joined the two with philosophy, linguistics, and multiple other fields. The core concept was to study human thinking and learning and its similarities to computer logic, and thus the courses I took touched frequently on learning algorithms, or "AI". This was of course before it became the successor to bitcoin as the next energy hungry grift, to be clear. Since then I've kept up on the topic, and coincidentally, my partner has gone into freelance data model training and correction. So while I'm not an expert, I have a LOT of thoughts on the current issue of AI.
I'll start off by saying that AI isn't a brand new technology, it, more properly known as learning algorithms, has been around in the linguistics, stats, biotech, and computer science worlds for over a decade or two. However, pre-ChatGPT learning algorithms were ground-up designed tools specialized for individual purposes, trained on a very specific data set, to make it as accurate to one thing as possible. Some time ago, data scientists found out that if you have a large enough data set on one specific kind of information, you can get a learning algorithm to become REALLY good at that one thing by giving it lots of feedback on right vs wrong answers. Right and wrong answers are nearly binary, which is exactly how computers are coded, so by implementing the psychological method of operant conditioning, reward and punishment, you can teach a program how to identify and replicate things with incredible accuracy. That's what makes it a good tool.
And a good tool it was and still is. Reverse image search? Learning algorithm based. Complex relationship analysis between words used in the study of language? Often uses learning algorithms to model relationships. Simulations of extinct animal movements and behaviors? Learning algorithms trained on anatomy and physics. So many features of modern technology and science either implement learning algorithms directly into the function or utilize information obtained with the help of complex computer algorithms.
But a tool in the hand of a craftsman can be a weapon in the hand of a murderer. Facial recognition software, drone targeting systems, multiple features of advanced surveillance tech in the world are learning algorithm trained. And even outside of authoritarian violence, learning algorithms in the hands of get-rich-quick minded Silicon Valley tech bro business majors can be used extremely unethically. All AI art programs that exist right now are trained from illegally sourced art scraped from the web, and ChatGPT (and similar derived models) is trained on millions of unconsenting authors' works, be they professional, academic, or personal writing. To people in countries targeted by the US War Machine and artists the world over, these unethical uses of this technology are a major threat.
Further, it's well known now that AI art and especially ChatGPT are MAJOR power-hogs. This, however, is not inherent to learning algorithms / AI, but is rather a product of the size, runtime, and inefficiency of these models. While I don't know much about the efficiency issues of AI "art" programs, as I haven't used any since the days of "imaginary horses" trended and the software was contained to a university server room with a limited training set, I do know that ChatGPT is internally bloated to all hell. Remember what I said about specialization earlier? ChatGPT throws that out the window. Because they want to market ChatGPT as being able to do anything, the people running the model just cram it with as much as they can get their hands on, and yes, much of that is just scraped from the web without the knowledge or consent of those who have published it. So rather than being really good at one thing, the owners of ChatGPT want it to be infinitely good, infinitely knowledgeable, and infinitely running. So the algorithm is never shut off, it's constantly taking inputs and processing outputs with a neural network of unnecessary size.
Now this part is probably going to be controversial, but I genuinely do not care if you use ChatGPT, in specific use cases. I'll get to why in a moment, but first let me clarify what use cases. It is never ethical to use ChatGPT to write papers or published fiction (be it for profit or not); this is why I also fullstop oppose the use of publicly available gen AI in making "art". I say publicly available because, going back to my statement on specific models made for single project use, lighting, shading, and special effects in many 3D animated productions use specially trained learning algorithms to achieve the complex results seen in the finished production. Famously, the Spider-verse films use a specially trained in-house AI to replicate the exact look of comic book shading, using ethically sources examples to build a training set from the ground up, the unfortunately-now-old-fashioned way. The issue with gen AI in written and visual art is that the publicly available, always online algorithms are unethically designed and unethically run, because the decision makers behind them are not restricted enough by laws in place.
So that actually leads into why I don't give a shit if you use ChatGPT if you're not using it as a plagiarism machine. Fact of the matter is, there is no way ChatGPT is going to crumble until legislation comes into effect that illegalizes and cracks down on its practices. The public, free userbase worldwide is such a drop in the bucket of its serverload compared to the real way ChatGPT stays afloat: licensing its models to businesses with monthly subscriptions. I mean this sincerely, based on what little I can find about ChatGPT's corporate subscription model, THAT is the actual lifeline keeping it running the way it is. Individual visitor traffic worldwide could suddenly stop overnight and wouldn't affect ChatGPT's bottom line. So I don't care if you, I, or anyone else uses the website because until the US or EU governments act to explicitly ban ChatGPT and other gen AI business' shady practices, they are all only going to continue to stick around profit from big business contracts. So long as you do not give them money or sing their praises, you aren't doing any actual harm.
If you do insist on using ChatGPT after everything I've said, here's some advice I've gathered from testing the algorithm to avoid misinformation:
If you feel you must use it as a sounding board for figuring out personal mental or physical health problems like I've seen some people doing when they can't afford actual help, do not approach it conversationally in the first person. Speak in the third person as if you are talking about someone else entirely, and exclusively note factual information on observations, symptoms, and diagnoses. This is because where ChatGPT draws its information from depends on the style of writing provided. If you try to be as dry and clinical as possible, and request links to studies, you should get dry and clinical information in return. This approach also serves to divorce yourself mentally from the information discussed, making it less likely you'll latch onto anything. Speaking casually will likely target unprofessional sources.
Do not ask for citations, ask for links to relevant articles. ChatGPT is capable of generating links to actual websites in its database, but if asked to provide citations, it will replicate the structure of academic citations, and will very likely hallucinate at least one piece of information. It also does not help that these citations also will often be for papers not publicly available and will not include links.
ChatGPT is at its core a language association and logical analysis software, so naturally its best purposes are for analyzing written works for tone, summarizing information, and providing examples of programming. It's partially coded in python, so examples of Python and Java code I've tested come out 100% accurate. Complex Google Sheets formulas however are often finicky, as it often struggles with proper nesting orders of formulas.
Expanding off of that, if you think of the software as an input-output machine, you will get best results. Problems that do not have clear input information or clear solutions, such as open ended questions, will often net inconsistent and errant results.
Commands are better than questions when it comes to asking it to do something. If you think of it like programming, then it will respond like programming most of the time.
Most of all, do not engage it as a person. It's not a person, it's just an algorithm that is trained to mimic speech and is coded to respond in courteous, subservient responses. The less you try and get social interaction out of ChatGPT, the less likely it will be to just make shit up because it sounds right.
Anyway, TL;DR:
AI is just a tool and nothing more at its core. It is not synonymous with its worse uses, and is not going to disappear. Its worst offenders will not fold or change until legislation cracks down on it, and we, the majority users of the internet, are not its primary consumer. Use of AI to substitute art (written and visual) with blended up art of others is abhorrent, but use of a freely available algorithm for personal analyticsl use is relatively harmless so long as you aren't paying them.
We need to urge legislators the world over to crack down on the methods these companies are using to obtain their training data, but at the same time people need to understand that this technology IS useful and both can and has been used for good. I urge people to understand that learning algorithms are not one and the same with theft just because the biggest ones available to the public have widely used theft to cut corners. So long as computers continue to exist, algorithmic problem-solving and generative algorithms are going to continue to exist as they are the logical conclusion of increasingly complex computer systems. Let's just make sure the future of the technology is not defined by the way things are now.
7 notes · View notes
cool-retro-term-official · 10 months ago
Text
one of the best sorting algorithm though has to be the denial sorting algorithm (O(0) space & time): first, shuffle the list...
And... Now it's sorted ! no no, I swear it's sorted. It just couldn't be not sorted. It's sorted. Don't worry about it. It's mostly- it's Completely sorted. From start to finish. Yeah 1, 5, 4, 2, 6, 9, 8, 3, 7, 0, just like we learned in school ! Now run you binary search or something on it, don't worry.
18 notes · View notes
hallowpen · 11 months ago
Note
Tumblr media
Why are there fences around the trees in all of the dramas? I know that there are better pictures but this was the only one I could directly find from memory.
I also use they/them pronouns. Have you talked about/would you be willing to talk about navigating the linguistics of a gendered language like Thai? ARE there really no neo pronouns outside the ค่ะ/ครับ binary? A lot of times actual queer lived experiences dont make it through the search engine algorithm no matter how hard you look for them.
Do you have a patreon/buy me a cup of coffee etc? I'm willing to tip for your labor. (Not much, sadly because I am very very poor, but still I appreciate anyone who is willing to help with translation/questions.) It can be frustrating when you are a self learner and there is literally no one tgat you can ask a question.
I think you're the first person to ask me this! It made me smile.
It's a sort of dual-faceted protection. Like other places, it's mostly to protect the soil from being trampled on so that it stays as porous as possible and can retain water (especially for newly planted trees). The more cultural reason is that certain trees hold auspicious and spiritual value to us, so we would want to preserve them by limiting disturbances (though most of those won't be found in urban environments). There's a big movement in certain cities to revitalize green spaces for both cultural and climate reasons.
As for your second question... I've spoken a little bit about gendered language in Thailand [X] The problem, for me, doesn't really exist in what you could call language 'norms'. Because pronouns/particles (ฉัน/ผม | ค่ะ/ครับ/จ๊ะ) are, more increasingly, used interchangeably OR what are classified as "female" pronouns can be used as 'acceptable' gender neutral identifiers. The problem is how certain people react to the use of gendered language in more modern expression. Does that make sense? Collectivist views and traditionalism look down upon non-adherence to gender correlated language, in a lot of instances. The fact that our culture was established from patriarchal perspectives doesn't help.
I don't know if I'm comfortable or ready to talk about my personal experiences (some of which were very unpleasant) living as a non-binary transgender person in Thailand, especially in online spaces, but I hope that I can get there one day.
Please don't feel pressured to compensate me in any way!!! I'm not asking or expecting to be rewarded for sharing my cultural insight. Some might see it as generous, and I'll accept that, but the reason behind it is very self-serving...in a way. Because I desperately want to combat the false information and discriminatory views that exist in fandom spaces about my culture. So really...
Thank you to anyone who refrains from making generalized assumptions about a culture that you do not belong to. It's hurtful to to see a lot of the misinformation that exists, not just here, but in other social media spaces. Coming to terms with interfandom has been a struggle... because Thai voices are often disregarded when discussing media that originates from their own country. And I hope that I've created an environment where you'd feel comfortable enough coming to me for any sort of clarification. All I have ever asked, is that you be respectful.
23 notes · View notes
bisexual-engineer-guy · 1 year ago
Text
I used to go to the library sometimes and pick books off the return shelf and sort them using different sorting algorithms in O(n*log(n)) time and then put newly returned books back into the stack using binary search
21 notes · View notes
Text
It’s very funny to me that the earth kingdom avatar search method is literally just the binary search algorithm.
The airbenders rely on sentimentality that reaches back through the ages and the earthbenders use one of the first algorithms you learn how to code in comp sci 101
11 notes · View notes
lloke · 2 months ago
Text
I was tagged by @nohoperadio for this meme about 10 books or categories-of-books you're planning to read this year... their list is full of Actual Literature and mine isn't going to be nearly as impressive, but here it is anyway...
So I use Goodreads (link - feel free to friend me) and have a gigantic to-read list, which I've tried to manage by breaking it up into various categories/genres, ordering each list according to an obscure algorithm and then rotating through the categories in an overly complicated system that changes every few months... but without some kind of system to tell me what to read next I think I would just be paralyzed by indecision because there are too many books that I want to read Right Now. But anyway that means my reading is pretty planned out and I do have a pretty good idea of what I'm going to be reading this year.
I read mostly SFF and one subgenre I've been very into lately is "stuff with interesting aliens" and one book that's currently near the top of that list is The Sparrow by Mary Doria Russell, which as I understand it is a book about aliens and religion, both topics that I'm interested in. So I'm looking forward to that one.
Another category which is sometimes a subgenre of the above is books (usually SF but occasionally fantasy) which depict a society that Does Gender Differently, especially in the sense of having some kind of non-binary gender system. Sometimes I become an insane completionist about things, and this is one of those things.... it's just fun seeing how many different tri-gender (or whatever) systems writers can come up with, even when the books themselves are otherwise terrible. I've now read most of the well-known stuff in this subgenre and have been venturing into the increasingly obscure... one that I'll probably get to this year is called Eifelheim by Michael Flynn, which apparently also involves both religious themes and aliens with three sexes? Hey, sign me up.
In the general category of "stuff by authors I like and want to read more of" some I've got coming up are Babel-17 by Samuel R. Delany, The Transmigration of Timothy Archer by Philip K. Dick, The Truth and Other Stories by Stanisław Lem, Rocannon's World by Ursula K. Le Guin.... also some more Asimov and Heinlein, which I'm a little embarrassed about as I have been given to understand that all Real SF Fans already read all that "golden age" stuff when they were 12 and haven't glanced at it since.
Also: more silly Sherlock Holmes fanfics pastiches, of which I've already read way too many. I usually go for the ones that bring in SFF elements (the crackier the better) or that sound like they might have h/c in them lol. Coming up in the near future is Lindsay Faye's Observations by Gaslight.
In the nonfiction category, the next on the list is Buddhisms: An Introduction by John S. Strong, which I picked out just by searching around for a good introductory book on the topic. That's how I tend to approach nonfiction reading, by starting with a general overview of whatever topic I'm interested in to get some background on the "scholarly consensus" before delving into books on more specific subtopics or scholars presenting their own idiosyncratic view or "bold new theory" or whatever. Mostly I've been reading about religion lately; I kind of want to get back into math and science stuff which I liked as a kid and did well at in school, but everything I learned is so rusty now... and I dunno, I like the idea of being the sort of person who actually understands relativity theory or whatever but realistically I'm probably not actually smart enough for it lol.
I guess that's roughly ten things. Tagging (only if they want to obviously) @ipsomaniac @paradigm-adrift and/or anyone else who feels like doing it.
4 notes · View notes
blake447 · 2 years ago
Text
Strange way of drawing the Dragon Curve
Tumblr media
Alright, so real quick I just want to share potentially the most arcane method of drawing the Dragon Curve I've ever seen, derived and designed by yours truly! As far as I know, this is a novel solution. I know the sequence it generates is known, but I'm not sure if anyone else has used this method before. Its quite elegant if I may say so myself.
Tumblr media
So for those that aren't aware in programming the "<<" and ">>" operators are sometimes known as "bit shifts." Basically what this is doing is starting at some number, adding a power of two, then getting a specific 1 or 0 in the binary representation of that number iteratively, until its searched enough bits to know they aren't going to change anymore.
It has to do with this sequence right here. I've mentioned before, my personal favorite way of generating the dragon curve is to start with the sequence 0, reverse it, add one, roll over once you reach 4, and tack that on to the original sequence. So 0 0 1 0 1 2 1 0 1 2 1 2 3 2 1 0 1 2 1 2 3 2 1 2 3 0 3 2 3 2 1 Well what ends up happening is each time you add one, its like adding one to the reversed part of the newly added sequence. So we can track where all these 1's come from based on when they're added. For example, the 1 we added in the "01" step turns into 0 1 0 1 1 0 0 1 1 0 0 1 1 0 Note from here on out its palindromic, so reversing it no longer has any effect. What we end up with is a repeating pattern of two 1's, then two 0's, starting with half that many 0's. When going from 0 1 0 1 2 1 We're adding 1's to the entire second half, so in this step the 1's propagate to 0 0 1 1 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 And again, this is now palindromic. Four 1's, four 0's led by half that many. One of the things I've learned about the dragon curve is just how intrinsically linked it is to binary (and this makes sense when you think of the folding paper method of generating it. Here's an excel spreadsheet demonstrating this in action
Tumblr media
Now here's the fun part. My research was to parallelize this algorithm. One approach is to say "Okay, how can we calculate each term in this sequence without looking at the previous ones." And the answer is to exploit these very predictable patterns. And how do we predict these patterns? Simple, we simply count in binary
Tumblr media
The right most column is useless, but starting at the next one to the left, we see a familiar pattern, almost. Say we want to know what the 5th number in the dragon curve sequence is (0 indexed). To make the sequence only lead with one 0 instead of two, we need to offset by 1, then all we have to do is increase the number by (n + 1) = 5 and take its 2nd least significant bit (1 indexed because english). The 2nd bit of ( 1 + 5 = 6 ) is a 1. For the next iteration we're looking at the 3rd least significant bit. Here we need to offset by 2, and then we increase the number by 5 again and the 3rd significant bit is the one we take. The 3rd bit of (2 + 5 = 7) is another 1 After that we're looking at the 4th least significant bit. We need to offset by 4, then increase the number by 5, and the 4th significant bit will give us our number. The 4th bit of (4 + 5 = 9) is going to be another 1, bringing our total to 3. Here's a visual representation
Tumblr media
This is where the "1 << i" comes in, because that's the same as saying 2^i, which is how we get those offsets of 1, 2, 4, then 8, 16, 32... the "n" in "n + (1 << i)" comes from us offsetting to get the nth term in each sequence Finally the " >> (i + 1) " and "% 2" are to fetch the (i + 1)th bit from the number. After that the increasing size of the leading zero's outpaces our constant offset of the number 5, so we are only going to get 0's from here on out, and we can actually stop, hence the usage of bit length to terminate the loop early.
And if we look at the the 5th element of the sequence (0 indexed) 0 1 2 1 2 3 Funnily enough, in python this brings an actual speed increase (or at least, distributes the cost over the drawing) because of how slow reading and writing to memory is, compared to how math and bit-wise operations are implemented in low level C behind the scenes. Additionally, since there is no reliance on previous work this task can be multi-threaded, or even GPU accelerated if need be. Finally, if you've made it this far, here are a few images of some close ups of dragon curves from my GPU implemented (unrelated to this one entirely) just so that there's something pretty. Enjoy <3
Tumblr media Tumblr media
126 notes · View notes
wellabridgemeprincess · 1 year ago
Note
Dunno if someone asked you this, but what inspired you to create Well Abridge Me, Princess in the first place?
God okay, long answer
well my YouTube had started tanking
which was an emergency when I lived in the most expensive part of the US
but kind of a blessing in disguise when I moved to a developing country and didn't need to make nearly as much money
because if the algorithm wouldn't promote anything I do anyway, then I literally have to make whatever I want
but as a people-pleaser who spent a lot of time in the closet, I didn’t fucking know would be the most Me thing ever
and after using voice acting as a tool to help millions with issues processing reading with Lost Legends, and working directly with Strong Bad on the podcast, I didn’t have any career goals left
so I did A LOT of soul-searching
every time I worked on a project, I paid attention to when I was having the most fun
In the Pirates of the Caribbean Real-Time Fandubs, I loved making my aesthetic and queer identity the centerpiece that everything else fell around
on Mystery Shack Lookback, I loved making jokes like Dog With A Pod that were basically only funny to me and Ella, and yet surprisingly not getting complaints like I would have on YouTube
when I made a Doremi Abridged One Shot for my wife's birthday, I was shocked I didn't get as bored editing as I usually do
and it became clear that my ideal project would be an Abridged Series based on a swashbuckling property in which I voice a non-binary character and/or a woman
and remembering how excited I sounded infodumping about Legend of Zelda in the PinesQuest podcast episode, there was an obvious answer
24 notes · View notes