fiwhex.blogg.se

Wolfram mathematica function of list
Wolfram mathematica function of list









wolfram mathematica function of list

Then Select tells Mathematica that we want it to select from that list the elements that return True for the given Boolean, in this case PrimeQ &. So Range just gives us the integers 1 to 100, and Prime] gives us the primes indexed by the integers 1 to 100, that is, 2, 3, 5, 7, 11, 13, 17, 19, and so on to 541. Wolfram Alpha gives the correct response to the Wolfram Mathematica statement above: 3, 5, 11, 13, 19, and so on and so forth to 541, which just happens to be the 100th prime number. By contrast, we see that 7 is not such a prime, since 3 × 7 + 4 = 25 = 5². For example, 5 is such a prime, since 3 × 5 + 4 = 19. This is probably what you would type in if you’re curious about which prime numbers p also give primes for 3 p + 4. In fact, go to Wolfram Alpha right now and type this in: Select], PrimeQ &] In Wolfram Mathematica, there’s this concept called “ pure functions.” With some caveats, you can use pure functions in Wolfram Alpha. For those of you with lots of experience with Wolfram Mathematica, this might be old hat.īut for those of you who sometimes play around with functional programming with Wolfram Alpha or Scastie or whatever else you use to play around with functional programming, this might be a revelation. Short post, just wanted to share a neat little discovery I made earlier today.











Wolfram mathematica function of list