Message Boards Message Boards

0
|
2461 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Translating math words to Mathematica, an example, an experiment

Posted 2 years ago

A textbook has this:

For any two integers (positive, negative, or zero) n and m >= n

I tried to translate into Mathematica thusly:

Given Element[n | m, Integers] && { n > 0 | n < 0 | n = 0} && { 
  m > 0 | m < 0 | m = 0} && m >= n

Does that make sense and work in Mathematica or only to human readers? ;-) I am conducting some experiments how far and well translating from an ordinary math textbook into live Mathematica code. I am understanding more about the hidden assumptions Mathematica makes that would need to be spelled out.
Thanks.

POSTED BY: Andrew Meit
2 Replies

Beware the difference between | and ||, between = and ==, and between {} and (). The following is closer to the textbook phrase:

ForAll[{n, m},
 Element[n | m, Integers]
  && (n > 0 || n < 0 || n == 0)
  && (m > 0 || m < 0 || m == 0)
  && m >= n,
 predicate]

For example

ForAll[{n, m},
  Element[n | m, Integers]
   && (n > 0 || n < 0 || n == 0)
   && (m > 0 || m < 0 || m == 0)
   && m >= n,
  2^m >= 2^n] // Reduce
POSTED BY: Gianluca Gorni
Posted 2 years ago

Wonderful, now I have a template to use/edit going forward in my translating textbook text into live Mathematica code experiments. Since there are definitions and assumptions that are stated before giving the formula or function. Thank you!

POSTED BY: Andrew Meit
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract