# How to enter a long logical expression into Wolfram|Alpha?

**URL:** <https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039>\
**Category:** Questions\
**Tags:** wolfram-alpha\
**Created:** [December 3, 2013, 11:16am UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039 "2013-12-03T11:16:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamieuka](https://avatars.discourse-cdn.com/v4/letter/j/2bfe46/32.png) [@jamieuka](https://community.wolfram.com/u/jamieuka)\
**Post date:** [December 3, 2013, 11:16am UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/1 "2013-12-03T11:16:45Z")

</div>

When I enter an logical expression e.g.

( P && Q && R ) || ( Q && R && S )

I get lots of lovely info. However, I’ve discovered there is a limit to the length of input e.g.

( P && Q && R && S ) || ( P && Q && R && ~S ) || ( P && Q && ~R && S ) || ( P && Q && ~R && ~S ) || ( P && ~Q && R && S ) || ( P && ~Q && R && ~S ) || ( P && ~Q && ~R && S ) || ( P && ~Q && ~R && ~S )

results in a failure message, “Input Too Long! Upload as data using Data input first.”

When I try the data input route, I get another failure message, "“No structured data detected; performing a textual analysis instead.”

How do I structure or otherwise mark my input as being a single logical expression?

---

<div class="post-metadata">

**Author:** ![seanc](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/seanc/32/34005_2.png) [@seanc](https://community.wolfram.com/u/seanc)\
**Post date:** [December 3, 2013, 2:45pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/2 "2013-12-03T14:45:04Z")

</div>

Inputing an expression as data can’t be used as a way around the maximimum input length in this case. Wolfram|Alpha will interpret anything given as data to be a dataset or a piece of text.

You may want to suggest to the WolframAlpha team that they support boolean expressions as a data format in the future so that you can work with larger boolean expressions than the input bar can handle.

---

<div class="post-metadata">

**Author:** ![bsimpson141421356](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bsimpson141421356](https://community.wolfram.com/u/bsimpson141421356)\
**Post date:** [December 3, 2013, 5:34pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/3 "2013-12-03T17:34:52Z")

</div>

Hoping that WolframAlpha will interpret precedence when I eliminate parens and white space I try each of the following

```auto
Simplify[P&&Q&&R&&S||P&&Q&&R&&~S||P&&Q&&~R&&S||P&&Q&&~R&&~S||P&&~Q&&R&&S||P&&~Q&&R&&~S]

Simplify[P&&Q&&R&&S||P&&Q&&R&&~S||P&&Q&&~R&&S||P&&Q&&~R&&~S||P&&~Q&&R&&S||P&&~Q&&R&&~S||P&&~Q&&~R&&S]

```

It happily allows me to enter both within the available line length, understands and correctly interprets the first and cannot comprehend the second.

Thus I presume there is more than one internal limit on the length of input and they do not appear to be consistent.

---

<div class="post-metadata">

**Author:** ![ghurst](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ghurst/32/20267_2.png) [@ghurst](https://community.wolfram.com/u/ghurst)\
**Post date:** [December 3, 2013, 6:05pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/4 "2013-12-03T18:05:03Z")

</div>

For what it’s worth, Simplify (or LogicalExpand) does the trick and returns P.

```auto
Simplify[P&&Q&&R&&S||P&&Q&&R&&!S||P&&Q&&!R&&S||P&&Q&&!R&&!S||P&&!Q&&R&&S||P&&!Q&&R&&!S||P&&!Q&&!R&&S||P&&!Q&&!R&&!S]

P

```

---

<div class="post-metadata">

**Author:** ![raphaeldelcastillo24](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@raphaeldelcastillo24](https://community.wolfram.com/u/raphaeldelcastillo24)\
**Post date:** [February 25, 2015, 8:05pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/5 "2015-02-25T20:05:24Z")

</div>

It has been a year and i do not think they have fixed it. I subscribed to the pro version thinking that inputting data through files would fix the issue but it has not ☹ I am trying to calculate this.  
078435243638422372447672231234716695757593735449641234358462086700559213667152171913^733286178582569088283232046829710496185570977121081786863578840329631292141076523731373 mod1026650243044648666338779501960308972649317942706523177961403694692749456133768845419907

for an assignment and sadly it does not work. any suggetions on what i can do?

---

<div class="post-metadata">

**Author:** ![geoffe](https://avatars.discourse-cdn.com/v4/letter/g/b782af/32.png) [@geoffe](https://community.wolfram.com/u/geoffe)\
**Post date:** [February 25, 2015, 8:19pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/6 "2015-02-25T20:19:38Z")

</div>

Raphael, Wolfram|Alpha can’t solve that kind of question. Even Mathematica would struggle to do it - your expression would take a ludicrous amount of time to compute. Probably on the order of days.

The exponentiation alone is:

[http://www.wolframalpha.com/input/?i=078435243638422372447672231234716695757593735449641234358462086700559213667152171913^733286178582569088283](http://www.wolframalpha.com/input/?i=078435243638422372447672231234716695757593735449641234358462086700559213667152171913%5E733286178582569088283)

60785399379915432324698 digits in length.

That alone would take long enough to compute, but you’re expecting a modulus operation on top of that?

It’s just not possible. You would need a supercomputer to calculate that result in anything resembling a “quick” time frame.

---

<div class="post-metadata">

**Author:** ![iliang](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/iliang/32/11263_2.png) [@iliang](https://community.wolfram.com/u/iliang)\
**Post date:** [February 25, 2015, 8:54pm UTC](https://community.wolfram.com/t/how-to-enter-a-long-logical-expression-into-wolfram-alpha/1039/7 "2015-02-25T20:54:19Z")

</div>

I don’t think Mathematica struggles that much

```
In[2]:= AbsoluteTiming[
 PowerMod[078435243638422372447672231234716695757593735449641234358462086700559213667152171913, 73328617858256908828323, 
  1026650243044648666338779501960308972649317942706523177961403694692749456133768845419907]]

Out[2]= {0.000076, 488852248312393495853898207472820633208110722640160160319617509136528516001303946959159}

```
