Group Abstract Group Abstract

Message Boards Message Boards

0
|
1K Views
|
6 Replies
|
8 Total Likes
View groups...
Share
Share this post:

Different outputs when using numerics vs variables

Posted 3 months ago

Hello. This is my first post. I'm sorry if I'm either posting it incorrectly, or posting about something I shouldn't be.
If this is somewhere here already, then I don't know enough to know what to search for to find my answer.

Ok... Please don't sigh, and hear me out...
6÷2(1+2) I know, Eww. Right?
My question is why does Wolfram process the following differently than if it's in numerical form?

a÷bc, a=6, b=2, c=(1+2) or transpose c=3 if that's the correct format.
I don't want to know if you think it's 1 or 9. I don't want to know if you think it's ambiguous.
I'm asking why with numbers it gives me one answer, but with variables it gives a different answer.
Is there a Convention I'm not thinking of that explains it? Is it some Computer Programing thing?
What did I do wrong?

Thank you for your time.

POSTED BY: Clifford Kelley
6 Replies

So, I thank everyone who replied. I've read more on this subject than i'd care to admit. I came across a blog by a Physicist who had also noticed the same thing. He asked Chatgpt why, and this is what Chatgpt said...

"4️⃣ Why numeric and symbolic differ

Numeric input: WA uses a calculator-style left-to-right evaluation: 6 ÷ 2 × 3 = 9

Symbolic input: WA uses algebraic conventions: a ÷ bc = a ÷ (b*c) = 1

So the difference comes from “numeric calculator rules vs algebraic coefficient rules.”

This seems to be what i was wanting to know. Thanks.

POSTED BY: Clifford Kelley

Natural Language mode uses the Wolfram|Aplha interpreter. That in turn uses a different precedence convention for the ÷ (obelus) than is used by the Wolfram Language (maybe also for the slash division sign, I'm not sure). All part of the the perils of trying to second-guess what the user intended.

POSTED BY: Daniel Lichtblau
Posted 3 months ago
POSTED BY: Clifford Kelley
Posted 3 months ago

It would be helpful to know what result you actually got. Also, it would help us if you use the formatting tools to show exactly what you input.

I'm assuming that you didn't have a space between the b and c.

a = 6;
b = 2;
c = (1 + 2);

a/b c
(* 9 *)

a/bc (* notice no space *)
(* 6/bc *)
POSTED BY: Eric Rimbey
Posted 3 months ago
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard
Be respectful. Review our Community Guidelines to understand your role and responsibilities. Community Terms of Use