Techno Blender
Digitally Yours.
Browsing Tag

Kadie

Nine Rules for Creating Fast, Safe, and Compatible Data Structures in Rust (Part 2) | by Carl M. Kadie | Apr, 2023

Lessons from RangeSetBlazeStoring numbers in a tree — Source: Bing Image CreatorThis is Part 2 of an article about creating data structures in Rust. We’ll look at rules 6 to 9:6. Define operators and fast operations.7. Follow the “Nine Rules of Good API Design” especially “write good documentation”.8. Optimize performance using representative data, Criterion Benchmarking, and profiling.9. Test coverage, docs, traits, compiler errors, and correctness.See Part 1 for rules 1 to 5.Plagiarize your API, documentation, and even…

Nine Rules for Creating Fast, Safe, and Compatible Data Structures in Rust (Part 1) | by Carl M. Kadie | Apr, 2023

Lessons from RangeSetBlazeStoring numbers in a tree — Source: Stable DiffusionThis year, I developed a new Rust crate called range-set-blaze that implements the range set data structure. A range set is a useful (if obscure) data structure that stores sets of integers as sorted and disjoint ranges. For example, it stores these three ranges:100..=2_393, 20_303..=30_239_000, 501_000_013..=501_000_016rather than 30,220,996 individual integers. In addition to potential memory savings, range-set-blaze provides efficient set…

Understand Polars’ Lack of Indexes | by Carl M. Kadie | Jan, 2023

Switch from Pandas to Polars and forget about indexesA Polar Bear racing a Panda — Source: https://openai.com/dall-e-2Pandas and Polars are two dataframe libraries for Python. In a previous article, I wrote this about Pandas and indexes:To efficiently use Pandas, ignore its documentation and learn the truth about indexes.In contrast, the Polars book says this about Polars and indexes:Indexes are not needed! Not having them makes things easier — convince us otherwise!Can we really forget about indexes? Let’s put Polars’…

Perfect, Infinite-Precision, Game Physics in Python (Part 4) | by Carl M. Kadie | Dec, 2022

Improving speed and features, perfectly and imperfectlyA Python losing a race to a Turtle — Source: https://openai.com/dall-e-2/This is the fourth of four articles showing you how to program a perfect physics engine in Python. It is a tiny step in my grand ambition to turn all of physics, mathematics, and even philosophy into programming. All code is available on GitHub. Part 1 introduced the high-level engine and applied it to physics worlds such as Newton’s Cradle and the tennis ball & basketball drop. Part 2…

Perfect, Infinite-Precision, Game Physics in Python (Part 3) | by Carl M. Kadie | Nov, 2022

Use Python SymPy to turn Math and Physics into ProgrammingA Python balancing mathematical equations — Source: https://openai.com/dall-e-2/This is the third of four articles showing you how to program a perfect physics engine in Python. It is a tiny step in my grand ambition to turn all of physics, mathematics, and even philosophy into programming. All code is available on GitHub.This article is about getting the computer to do math for us. Not just numerical calculations, but also algebraic and calculus-related…

Perfect, Infinite-Precision, Game Physics in Python (Part 2) | by Carl M. Kadie | Nov, 2022

Turn Philosophy into Programming with BilliardsA Python playing billiards — Source: https://openai.com/dall-e-2/This is the second of four articles showing you how to program a perfect physics engine in Python. It is a tiny step in my grand ambition to turn all of physics, mathematics, and even philosophy into programming. Through this project, we will uncover surprises, increase our understanding, and (I hope) have fun. All code is available on GitHub.In Part 1, we developed the top-level of a perfect physics engine. We…

Perfect, Infinite-Precision, Game Physics in Python (Part 1) | by Carl M. Kadie | Nov, 2022

With absolute accuracy, program “Newton’s Cradle”, “tennis ball & basketball drop”, and moreNewton’s Cradle with Python — Source: edited https://openai.com/dall-e-2/This is the first of four articles showing you how to program a perfect physics engine in Python. It is a tiny step in my grand ambition to turn all of physics, mathematics, and even philosophy into programming. Through this project, we will uncover surprises, increase our understanding, and (I hope) have fun. All code is available on GitHub.We will limit…

Nine Rules for Creating Procedural Macros in Rust | by Carl M. Kadie | Oct, 2022

Practical Lessons from anyinput, a New Macro for Easily Accepting String/Path/Iterator/Array-Like InputsThe Rust crab programming itself — Source: https://openai.com/dall-e-2/I love the Rust programming language, but it’s not perfect. For example, do you know how to write a Rust function that accepts any string-like thing as an input? What about accepting an iterator of any kind of path? Can you write a function that accepts a Vec<f32> as an ndarray::ArrayView1?Rust functions can accept all these inputs, but I find…

Interview Question: Select a Random Line from a File (in Rust) | by Carl M. Kadie | Sep, 2022

A cool and useful algorithm explained and extendedBy Carl M. Kadie and Christopher MeekA crab selecting a random line of text from a file — Source: https://openai.com/dall-e-2/If I (Carl) interviewed you for a job at Microsoft, I probably asked you this question:How would you select a random line from a text file of unknown length?I asked this question in Microsoft Research, in the original anti-spam team, and in an Office Machine Learning/Data Science group. We love the question because it touches on probability,…

Interview Question: Select a Random Line from a File (in Python) | by Carl M. Kadie | Aug, 2022

A cool and useful algorithm explained and extendedBy Carl M. Kadie and Christopher MeekSource: https://openai.com/dall-e-2/If I (Carl) interviewed you for a job at Microsoft, I probably asked you this question:How would you select a random line from a text file of unknown length?I asked this question in Microsoft Research, in the original anti-spam team, and in an Office Machine Learning/Data Science group. We love the question because it touches on probability, algorithms, and systems issues.Even having retired from…