mastodon.world is one of the many independent Mastodon servers you can use to participate in the fediverse.
Generic Mastodon server for anyone to use.

Server stats:

8.4K
active users

#vectors

0 posts0 participants0 posts today

Mathsy fedi, I have a question!

I have an arbitrarily sized cube of 3D space, and want to find the furthest possible distance an arbitrary number of points can be apart in it (and then average that and weight it by weights attached to the points and stuff but I can do all that hit).

This is presumably a very solved problem for low numbers (and I don't need more than low numbers), is there an easy enough formula or table I can use?

Boosts appreciated!

Time for my regular moaning about #AI .
England math GCSE Higher paper 3... last question, about vectors.

I looked at it and came to a conclusion, but I'm not too certain since I'm a bit rubbish with vectors. I never been taught it formally, self learned and never practiced much.

So a colleague suggested a certain AI to solve it and the answer is k= 15/4. I used a different AI and the answer is k= 17/2 ... 3.75 vs 8.5 ... not even close!

Соединяем физику и лирику. Как я собрал рекомендательную систему для стихов с помощью Flask, sqlite-vec и Hugging Face

Для песен рекомендательные системы есть, для книг — есть, для фильмов — есть, для стихов — нет. Непорядочек 🤔 Используя Flask, Jinja2, Sentence-Transformers и sqlite-vec, собрал первый прототип рекомендательной системы для стихов. Для машины измерить в цифрах схожесть двух стихов — трудно. А для человека — в самый раз. Прикрутил форму оценки рекомендаций, собрал человеческий фидбек. В статье подробно рассказываю о деталях конструкции.

habr.com/ru/articles/916476/

ХабрСоединяем физику и лирику. Как я собрал рекомендательную систему для стихов с помощью Flask, sqlite-vec и Hugging FaceЛюблю я кодить и стихи — Вот, в общем, все мои грехи... А. С. Пушкин Привет! Я Константин Хабазня, преподаватель программирования и математики, а также автор (что бы это ни значило). N-нное время...

Today's activity include #vectors #points and #math.

Once I crack this for my context case, I get to be very happy. It is old code Infound that I have been using for YEARS. It has worked this whole time until I tries pipes and content that was perfectly vertical. I had a slick way (then) of getting my number fast, but never considered the how I got it, and it was strictly bad math!! I had a div by zero issue since the X1Y1 and X2Y2 were equal, and I was using maths for a 2D situation.
What I literally need is X here, because it is the number I need to find distance from primary pipe end to place a branch node.
This has real world implications wherein we save a LOT of money at the shop by this process correcting broken branch nodes-- at the fabrication stage, this point is used to automate cuts for the taps on the pipe, and cut them out by plasma torch.

#ReleaseWednesday — I just released a new version (v8.0.0) of thi.ng/vectors, an almost complete rewrite of the package with all of its ~900 vector operations. I've updated the Readme with a section of _potentially_ minor breaking changes, however I expect this to be a seamless upgrade for the vast majority of users...

I've recently written more about the reasons and implications of this update and I'll refer you to those posts instead of repeating them once more (see links below).

Just the top-level changes:

- Replaced dynamic code generation with higher-order templating to be usable with strict content security policies (when deployed online)
- New structure allows for vast majority of functions to have doc strings (and they do now)
- More consistent/less confusing naming for some operations
- Potentially improved tree-shaking and smaller project bundle sizes

Related to this update I've also refactored and fixed some bugs in other packages (e.g. color, geom, matrices). As a result both the color & matrix packages are now also free from dynamic codegen and therefore won't cause any problems with strict CSPs

Should you run into any issues regarding this update, please get in touch (also grateful for any other experience/impact reports... 🙏)

More info in these recent posts/threads:

- mastodon.thi.ng/@toxi/11429644
- mastodon.thi.ng/@toxi/11431965
- mastodon.thi.ng/@toxi/11433601

Happy coding!

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
Continued thread

To put the "large" package size a little more into perspective: I don't know of any other feature-comparable JS vector library which provides all of the following:

- Generic n-dimensional float, int, uint, boolean vectors
- Size optimized versions for 2D/3D/4D (all types)
- Multiple-dispatch wrappers (auto-delegating to available optimized versions)
- Memory-mapped vectors and optimized versions for various memory layouts (e.g. SOA/AOS)
- Optimized versions of many vector-scalar ops
- Optimized compound operations (like multiply-add etc.)
- Vector randomizations (several approaches)
- 99% of GLSL vector operations & conversions
- Vector versions of most of JS `Math` ops
- Vector interpolations (linear, bilinear, cubic, quadratic...)
- 10 different distance functions & metrics
- Swizzling & vector coercion/extension
- Dozens of additional graphics, statistics & ML-related operations

Just a quick #ThingUmbrella update to say that I've already replaced the thi.ng/vectors package on the develop branch and after LOTS of deep experimentation have decided NOT to split up the package. There will be a few (minor) breaking changes, mainly because of enforcing more consistent naming and more granularity in some source files (therefore possibly changed imports, though only if you use direct ones for individual functions...). All in all, I've managed to keep the impact on users to a bare minimum (likely unnoticeable for most), even though it's pretty much a complete rewrite of the entire package (with all its ~900 functions)... This package is now almost 10 years old and I'm very happy how this refactor turned out!

In terms of file size impact: The FULL minified pkg bundle is now 56.4KB vs previously 48.5KB, however the code density has improved and the brotli-compressed pkg size is only 15.1KB (only 1KB larger than before), which I found absolutely incredible! 🎉 I also have to state once more that this package (and most others in #ThingUmbrella) are _designed for tree shaking_ and bundling. Hardly any project would ever use the full set of functions provided here all at once, most will only use a small/tiny subset...

Also — more importantly — many of the 185 example projects in the repo are now showing between 2-25% smaller final bundle sizes. Some also have become slightly larger, but so far I found the most by only ~2%...

Related to this change: I've also updated the thi.ng/color & thi.ng/matrices packages to be free from dynamic code generation now! The only packages still using `new Function(...)` are the following, but for those it's unavoidable and dynamic code generation is a core feature:

- thi.ng/pixel (custom pixel format definition/compilation)
- thi.ng/pixel-convolve (custom image convolution kernel compilation)
- thi.ng/shader-ast-js (Shader AST to JavaScript compilation)

I will do more testing over the coming days, then release new version(s) ASAP...

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts

In recent years every spring seems to turn into a period of _massive_ refactoring & restructuring in #ThingUmbrella — maybe it's a form of spring cleaning, even though the reasons[1] are not seasonal... Currently spending my nights reworking the thi.ng/vectors package (likely one of the most comprehensive vector packages available for TS/JS) and trying out different splits/structures, testing their impact on package sizes and usability in existing downstream packages. Currently over 3000 source files with uncommitted changes... aaaarrrgghh! 🤯

Most functions (vector operations) in this package exist in multiple versions (many code generated, but now in need to be updated): Generic n-dimensional, loop-free, optimized 2D/3D/4D versions and strided versions for manipulating vectors views of larger nD data buffers (supporting all kinds of data layouts, incl. AOS, SOA, hybrid...)

[1] mastodon.thi.ng/@toxi/11429644

thi.ng/vectorsOptimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts