Linked Questions

12 votes
1 answer

Should I add a semicolon after a function definition? [duplicate]

should I write the program like this: f[x_]:=x^2; g[x_]:=x+2; or should I write the program like this: ...
an offer can't refuse's user avatar
1 vote
1 answer

How to make an empty list inside a module program? It consatly spews errors [duplicate]

Okay, so, I'm trying to write a program within the module. It goes like this: create empty list, join it with a sample from a certain set called MyList, and then repeat it certain number of times. ...
fsedgdgdgdgdgfdg's user avatar
0 votes
1 answer

Functions as objects [duplicate]

I have a very long program I'm trying to stuff express as a single function. (I'll include it at the bottom of my post.) My long-term goal is to trim out the file handling portion of this function, ...
RNPF's user avatar
  • 175
0 votes
0 answers

Next line without ";" and set::write error => why? [duplicate]

In my code I first wrote : Print["else"] beta156v345 = 1/Sin[theta15]*1/ Sin[theta35]*(Cos[theta13]*1 - Cos[theta15] Cos[theta35]); (* j1^j5 . j3^j5 *) ...
StarBucK's user avatar
  • 2,164
550 votes
37 answers

What are the most common pitfalls awaiting new users?

As you may already know, Mathematica is a wonderful piece of software. However, it has a few characteristics that tend to confuse new (and sometimes not-so-new) users. That can be clearly seen from ...
27 votes
2 answers

Using a list of tuples in a pure function

I want to use a list of tuples within a function to make assignments. Say I want to make assignments of the form value[i,j] = val What I have is a list of ...
gwr's user avatar
  • 13.5k
14 votes
2 answers

Why is this semicolon in red?

I have a piece of code that works well, but when I put a semicolon after a plotting statement, the semicolon appears in red. What's the error?
Mika Ike's user avatar
  • 3,261
8 votes
1 answer

Creating a multiline function with localized variables

I would like to create a function with several expressions in the code body. For example, I would like to write something like this, but which will actually work. ...
StarBucK's user avatar
  • 2,164
4 votes
1 answer

Why do I get the Null when I evaluate Print[x] // InputForm? [duplicate]

When I execute: Print[x]//InputForm I get a Null at the last line of the result. This is an example shown in the ...
Taiki Bessho's user avatar
6 votes
1 answer

Should I end all definitions from packages with semicolon?

I noticed that if I open a .m file in Mathematica and click on the Run Package button, all the ...
Meh's user avatar
  • 1,637