1

How can I tell Wolfram Alpha that I only want it to evaluate my function for natural numbers?

For example $ 2n $, assuming n integer used to work, but not anymore. Is there a new syntax I can use?

Edit: Since this was marked as duplicate: The question popped up a couple years ago already, but the syntax seems to be a little different now. The answers given back then don't work anymore.

  • I believe you can add 'over the integers' – Bram28 Jan 04 '18 at 16:22
  • I tried that in various ways, but it's always suggesting something completely irrelevant... –  Jan 04 '18 at 16:26
  • @DietrichBurde: I tried to clarify with an edit why the duplicate is necessary. –  Jan 04 '18 at 16:29
  • How about this: f[n_ /; n \[Element] Integers] := 2 n; – Steve Kass Jan 04 '18 at 16:53
  • @SteveKass Here's what Wolfram Alpha says about that: https://www.wolframalpha.com/input/?i=f%5Bn_+%2F;+n+%5C%5BElement%5D+Integers%5D+:%3D+2+n; – David K Jan 05 '18 at 02:11
  • Sorry about that. What I wrote is a Mathematica command, not a Wolfram Alpha command. I didn't realize they were so incompatible, and I don't see anything online yet about entering Mathematica notation in WA. :( – Steve Kass Jan 05 '18 at 18:27
  • You can do this in the Wolfram Programming Lab. Whether that will accommodate everything you want to do, I don’t know. https://i.imgur.com/IDgNnm6.png (I replaced the 2+2 with my code here: https://lab.open.wolframcloud.com/objects/wpl/GetStarted.nb .) – Steve Kass Jan 05 '18 at 18:37

0 Answers0