Message Boards Message Boards

0
|
5975 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

What is wrong with these statements?

Posted 5 years ago

What is wrong with the following statement? A="sedf" B="eret" shift-enter which asked for echo each statement. Perfect. But as I typed again A B The A is not assigned? But B is assigned Why? See the attached screen.

Attachment

Attachments:
POSTED BY: AI Algorithm
9 Replies
Posted 5 years ago

Thank you for your attention of my problem. I am using 11.2

I did not notice the notebook I posted did not evaluate A

This time I start the MATHEMATICA from the start manual it works. But there is a line below (assuming....) I do not understand what does that mean? enter image description here

Previously I clicked a xxx.m file to start the MATHEMATICA. Why? What is the difference?

POSTED BY: AI Algorithm
Posted 5 years ago

The problem turns out to to be related to how did I entered those two command. If I entered by hand, no problem. If I loaded them from a .m file (clicking the .m file to start MATHEMATICA) there is a problem. Could anyone explain the problem?

POSTED BY: AI Algorithm

Possibly a silly question, but did you evaluate your input cell 11 (the one containing just A)?

POSTED BY: Ian Williams

I've just tried your example in a V11.3 notebook and it works as I'd expect - see below and attached. enter image description here

Not sure why your notebook is behaving as you've described. Can you attach it?

All the best,

Ian

Attachments:
POSTED BY: Ian Williams

In a notebook cell, remember to put a semicolon (;) at the end of each statement:

A = "abcdef"; (* <- semicolon *)
B = "cedfr"

Otherwise you may be rmultiplying:

FullForm[Hold[A = "abcdef"
     B = "cedfr"]]

(*  Hold[Set[A,Set[Times["abcdef",B],"cedfr"]]] *)
POSTED BY: Gustavo Delfino
Posted 5 years ago

Why? I know semi-column. But, it is not necessary. If you do not want echo you put a semi-column. If you want it echo no semi-column. That is the rule I learnt.

My statements are not interpreted as multiplying. Suppose MATHEMATICA interpreted it as multiplying I won't get those two correct echos, i.e. A is not assigned but echoed, while B is assigned.

Is there anyway to debug my program? To see how does Mathematica interpret my statement? Perhaps, a FullForm?

POSTED BY: AI Algorithm

I do not know.

enter image description here

POSTED BY: Jürgen Kanz
Posted 5 years ago

I can surely do the alternative. But that does not answer my question. Can you do it as I did, (i.e. two assignment together) so that you are discussing my problem. Thanks.

POSTED BY: AI Algorithm

Done with Mathematica V12:

enter image description here

I do not know whether there is a change regarding this subject among V11.2 and V12

POSTED BY: Jürgen Kanz
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