Skip to main content

Posts

on arithmetic derivations of square roots

[This article was first published on R – Xi'an's Og , and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here ) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. An intriguing question made a short-lived appearance on the CodeGolf section of Stack Exchange, before being removed , namely the (most concise possible) coding of an arithmetic derivation of the square root of an integer, S, with a 30 digit precision and using only arithmetic operators. I was not aware of the myriad of solutions available, as demonstrated on the dedicated WIkipedia page . And ended playing with three of them during a sleepless pre-election night! The first solution for finding √S is based on a continued fraction representation of the root, with a²≤S and r=S-a². It is straightforward to code-golf: while((r<-S-T*T)^2>1e-9)T=(F<-2*T+r/(2*T+F))-T;F but I found it impossible to reach the 30 dig...

10 Must-Know Tidyverse Functions: #3 – Pivot Wider and Longer

[This article was first published on business-science.io , and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here ) Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. This article is part of a R-Tips Weekly, a weekly video tutorial that shows you step-by-step how to do common R coding tasks. Learn how to use pivot_wider() and pivot_longer() to format data like a data wizard: Get the Code: GitHub Link Video Tutorial: YouTube Tutorial (Click image to play tutorial) Why Pivot Wider? Pivoting wider is essential for making summary tables that go into reports & help humans (like you and me) understand key information. Let’s say we have some automobile manufacturer data that we want to format into a table that people can read. We can summarize and pivot the data by manufacturer and class to understand the number of vehicle classes that each manufacturer produces. The result i...

The Atlantic Daily: What’s Next for the Democratic Party

Every weekday evening, our editors guide you through the biggest stories of the day, help you discover new ideas, and surprise you with moments of delight. Subscribe to get this delivered to your inbox . THE ATLANTIC Joe Biden accrued a record-setting number of votes, proving that the Democratic Party’s coalition is the largest in the country. But that alignment could be tricky to maintain, writers on our politics team warn. The party’s truce is over. From our staff writer Elaine Godfrey: “For Democrats, this election was an exercise in setting aside differences in support of a broader goal: ending the reign of Donald Trump.” That’s done, and their civil war is back on. It could pose a problem for 2024. “The results already have Democratic strategists privately asking frank questions about whether any of the next generation of Democratic leaders … can sustain enough of the coalition that elected Biden to the White House without him on the ballot,” Ronald Brownstein writes. ...