Contenu principal

Résultats pour

Image Analyst
Image Analyst
Dernière activité le 2 Déc 2024

Christmas season is underway at my house:
(Sorry - the ornament is not available at the MathWorks Merch Shop -- I made it with a 3-D printer.)
I know we have all been in that all-too-common situation of needing to inefficiently identify prime numbers using only a regular expression... and now Matt Parker from Standup Maths helpfully released a YouTube video entitled "How on Earth does ^.?$|^(..+?)\1+$ produce primes?" in which he explains a simple regular expression (aka Halloween incantation) which matches composite numbers:
Here is my first attempt using MATLAB and Matt Parker's example values:
fnh = @(n) isempty(regexp(repelem('*',n),'^.?$|^(..+?)\1+$','emptymatch'));
fnh(13)
ans = logical
1
fnh(15)
ans = logical
0
fnh(101)
ans = logical
1
fnh(1000)
ans = logical
0
Feel free to try/modify the incantation yourself. Happy Halloween!
David
David
Dernière activité le 12 Sep 2024

In case you haven't come across it yet, @Gareth created a Jokes toolbox to get MATLAB to tell you a joke.
Image Analyst
Image Analyst
Dernière activité le 12 Août 2024

Imagine that the earth is a perfect sphere with a radius of 6371000 meters and there is a rope tightly wrapped around the equator. With one line of MATLAB code determine how much the rope will be lifted above the surface if you cut it and insert a 1 meter segment of rope into it (and then expand the whole rope back into a circle again, of course).
Hans Scharler
Hans Scharler
Dernière activité le 31 Mai 2024

Spring is here in Natick and the tulips are blooming! While tulips appear only briefly here in Massachusetts, they provide a lot of bright and diverse colors and shapes. To celebrate this cheerful flower, here's some code to create your own tulip!
Chen Lin
Chen Lin
Dernière activité le 9 Juin 2024

Drumlin Farm has welcomed MATLAMB, named in honor of MathWorks, among ten adorable new lambs this season!
Hans Scharler
Hans Scharler
Dernière activité le 17 Mai 2024

I found this plot of words said by different characters on the US version of The Office sitcom. There's a sparkline for each character from pilot to finale episode.
Mari is helping Dad work.
Today, he got dressed for work to design some new dog toy-making algorithms. #nationalpetday
Transforming my furry friend into a grayscale masterpiece with MATLAB! 🐾 #MATLABPetsDay
Hans Scharler
Hans Scharler
Dernière activité le 11 Avr 2024

This is Stella while waiting to see if the code works...
In one line of MATLAB code, compute how far you can see at the seashore. In otherwords, how far away is the horizon from your eyes? You can assume you know your height and the diameter or radius of the earth.
Keep calm and study PDEs
Adam Danz
Adam Danz
Dernière activité le 26 Déc 2024

David
David
Dernière activité le 26 Mar 2024

A bit late. Compliments to Chris for sharing.
Athanasios Paraskevopoulos
Athanasios Paraskevopoulos
Dernière activité le 17 Mar 2024

Athanasios Paraskevopoulos
Athanasios Paraskevopoulos
Dernière activité le 14 Mar 2024

Chen Lin
Chen Lin
Dernière activité le 10 Fév 2024