Common Mathematica Mistakes?

General discussion about Mathematica features and functionality...
Forum Rules
By using the Wolfram Faculty Program Forum, you agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, or sexually oriented material. Wolfram Faculty Program Forum administrators have the right to remove, edit, move or close any topic at any time should we see fit.

Personal Information: Posts in this forum may be viewed by non-members; however, the forum prohibits non-members from viewing your profile. Although your email address is hidden from both non-members and members, your account is initially configured to allow members to contact you via email through the forum. If you wish to hide your profile, or prohibit others from contacting you directly, you may change these settings by updating your profile through the User Control Panel.

Attachments: Attachments are not currently enabled on this forum. To share a file with others on this site, simply upload your file to the online storage service of your choice and include a link to the file within your post. If your school does not offer an online file storage and sharing service, the following sites provide free basic online file storage and sharing: Mozy, FilesAnywhere, Adrive, and KeepandShare.

Common Mathematica Mistakes?

Postby Kathy_Bautista » Wed Jan 27, 2010 11:16 pm

The new Classroom Assistant does a really great job at minimizing this, but does anyone have a list of the most common mistakes that students make when they first use Mathematica?

Some beginner mistakes that immediately come to mind:

  1. Confusing the use of "=" for assignment and "==" for equality.
  2. Forgetting to use a space or an asterisk for multiplication between symbols, i.e., "x y" or "x*y", not "xy".
  3. Trying to use Plot with an equation rather than a function. (A common mistake is for students to give something like y=2x+3 as the argument to Plot, rather than 2x+3.)

Any others?
Katherine Bautista
Senior Academic Program Manager
Wolfram Research, Inc.
http://www.wolfram.com
User avatar
Kathy_Bautista
Site Admin
 
Posts: 182
Joined: Fri Jul 31, 2009 6:24 pm
Location: Mesa, Arizona
Organization: Wolfram Research, Inc.
Department: Academic Initiatives

Re: Common Mathematica Mistakes?

Postby Steven_Miller » Mon Feb 22, 2010 7:49 pm

Other common mistakes:
4) Forgetting underscores when defining variables.
5) Confusing using [[n]] versus [n] when accessing entries.
6) In Modules one now has to write Print[Histogram[...]] for it to output.
User avatar
Steven_Miller
 
Posts: 1
Joined: Mon Feb 22, 2010 7:12 pm
Organization: Williams College
Department: Math/Stats

Re: Common Mathematica Mistakes?

Postby Jose_Luis_Gomez » Tue Feb 23, 2010 2:52 am

Maybe I create next error in my students because of the particular way I teach them Mathematica, but they often use a symbol very similar but with different meaning. The basic form of this error is use the LARGE arrow pointing to the right (they find it in the Typesetting section of the Basic palette) instead of the short right arrow (Rule, as in a+b /. b->3

Bye Jose
User avatar
Jose_Luis_Gomez
 
Posts: 22
Joined: Wed Feb 03, 2010 7:57 pm
Location: Mexico
Organization: ITESM CEM Mexico
Department: Ciencias Basicas

Re: Common Mathematica Mistakes?

Postby Carsten_Herrmann » Tue Mar 09, 2010 3:45 pm

forgetting about Set assignments (or old definitions) being made in the past
User avatar
Carsten_Herrmann
 
Posts: 1
Joined: Tue Feb 02, 2010 3:11 am
Organization: mathemas ordinate
Department: Teaching

Re: Common Mathematica Mistakes?

Postby Carlos_Salema » Fri Mar 26, 2010 11:32 am

Another common mistake is to believe that on opening an existing notebook all definitions (variables, functions, ...) are available prior to execution.
User avatar
Carlos_Salema
 
Posts: 4
Joined: Fri Mar 19, 2010 3:50 pm
Organization: Instituto Superior Técnico
Department: Instituto de Telecomunicações

Re: Common Mathematica Mistakes?

Postby Fereshteh_Fadaee » Wed May 19, 2010 9:20 am

the most popular mistake actually for who are familiar with other programs like MATLAB or programming with Fortran is , capital letter at the first of orders in mathematica ! I thing it should be solve for new versions , sometimes I myself confuse !
User avatar
Fereshteh_Fadaee
 
Posts: 1
Joined: Tue May 11, 2010 5:56 pm
Organization: Kntoosi University of Technology
Department: Science

Re: Common Mathematica Mistakes?

Postby bsyehuda » Wed May 19, 2010 1:14 pm

Personally, using Mathematica over the years I prefer to be able to differentiate between the names of internal functions and the names of function that I develop, so, from this point of view starting with a capital letter helps

It also helps to prevent common beginners errors such as defining function names that collide with the names of internal functions, almost always of short names. Many times students prefer of using D (or N) as a variable or function names and this helps them to understand where they got wrong.

yehuda
User avatar
bsyehuda
 
Posts: 9
Joined: Wed Mar 17, 2010 3:02 pm
Organization: Ben-Gurion University
Department: Communication Systems Engineering

Re: Common Mathematica Mistakes?

Postby Adriano_Marden » Thu May 20, 2010 1:42 pm

A common mistake is when we have a great expression and you forget to close a bracket.
User avatar
Adriano_Marden
 
Posts: 1
Joined: Thu May 13, 2010 3:55 pm
Organization: IFCE
Department: physics

Re: Common Mathematica Mistakes?

Postby telefunkenvf14 » Fri Jul 02, 2010 9:03 pm

Two things... I'll post them separately, as the second one is kind of long.

(Both observations were previously shared on MathGroup http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/3cce53ef897d3368/02264f4f80d81214?hl=en&lnk=gst&q=Lists%3A+Row+Vectors+vs.#02264f4f80d81214)

--------- Number 1 ---------

.....NOT an attack on TraditionalForm i/o; just an observation I thought I'd share: This last semester I taught with Mathematica for the first time, and I'm a little mixed on the way that students are encouraged to use the input palettes and change their input/output to TraditionalForm (encouraged by WRI screencasts). I think this route caused more confusion/frustration than it was worth and slowed students' progress in learning to program and debug.

-RG
User avatar
telefunkenvf14
 
Posts: 46
Joined: Tue Apr 27, 2010 7:40 pm
Location: Lincoln, NE
Organization: University of Nebraska-Lincoln
Department: Economics

Re: Common Mathematica Mistakes?

Postby telefunkenvf14 » Fri Jul 02, 2010 9:11 pm

As noted in my previous reply, see http://groups.google.com/group/comp.soft-sys.math.mathematica/browse_thread/thread/3cce53ef897d3368/02264f4f80d81214?hl=en&lnk=gst&q=Lists%3A+Row+Vectors+vs.#02264f4f80d81214 for the full discussion.

-------Number 2-------

(Below my response is an email Fred Simons sent me. I figured I'd include it for the benefit of others; you may want to read it before reading my reply.) If short on time, *at least read point 2 at the end of my post.*

Fred and the rest of the Group:

This discussion has been extremely helpful. Your replies prompted me to review materials on Euclidean spaces; here is a simple explanation to my formerly-confused self:

-----------
'Vector' is a term used widely throughout mathematics and does not always have the same *intended* meaning. Ideally, to avoid confusion later on, we should teach matrix algebra by always referring to dimensions; a 1xn matrix, rather than calling it a row vector, and an mx1 matrix, rather than saying it's a 'column vector'.

In general, a vector is just an ordered list of objects in some n space, such as R3, for example. *There's no reason to force such a concept into row or column form!*
-----------

Two remaining things I'd like to say:

1. I now feel a sense of frustration at the above lazy language in matrix algebra. It seems like a classic example where trying to make the material easier for a student to understand/visualize, actually ends up paving an intellectual cul-de-sac.

2. I'm still absolutely right about one thing: Mathematica needs to have a consistent way to programmatically create a matrix----that both *looks* like a matrix in StandardForm and *behaves* like one. What I mean is: On screen formatting and behavior just like Insert->Table/Matrix->New->Matrix. It seems logical that such a function would have the head Matrix, given that it's conveniently available for use in Mathematica. Now, does anyone want to whip up a frontend token to do this, and pass it along to their favorite contact at WRI? :)

I suppose a variant of Kevin's code would also work---BTW Kevin, thanks for teaching me the $Post trick.

-RG

PS - I also think Column[] should be ColumnForm (looks like there's some back and forth on this) and Row[] should be RowForm[]. Or, at the very least, let these definitions shadow one another, along with a hard-to-miss warning in the documentation about the Mathematica convention that xxxxForm[] is for formatting only. Not including 'Form' in Row[]
and Column[] makes it too easy to gloss over their intended use.

----------- Message from Fred Simons to RG------------------------------

Hello,

Some time ago you asked the above question in mathgroup. It happens to
be a topic which I always treat in my introductory courses on
Mathematica, so I followed the discussion with some interest. Now that
the discussion seems to be at an end, I have the feeling that you did
not get a very clear reply to your question about why Mathematica
behaves like it does.

The answer to that is just mathematics. In mathematics we have the
concept of a vector, often, but by no means always, a list of numbers,
and the concept of a linear mapping of a vector space. Linear mappings
of finite dimensional vector spaces can be described with matrices. So
in mathematics, and therefore in Mathematica, vectors and matrices are
different objects. (Kevin McCann to whom I sent a similar message,
replied to me that he completely disagrees, for him a vector is a one
row matrix. i.e. a row vector. When his definition holds, then the
transposed of a row vector, i.e. a column vector, is not a vector,
because usually it has more than one row. His identification of a
vector with a one row matrix is definitely not standard in
mathematics.)

Also the concept of inner product has nothing to do with matrices. For
two vectors in Euclideam space it can be defined as the product of the
two lengths and the cosine of the angle, etc.

So, completely in accordance with mathematics, Mathematica uses single
lists for vectors and double lists (the list of rows) for matrices.
There is a very general function Dot, that has a.o. the following
properties:

vector . vector gives a scalar, the inner product.
matrix . vector gives a vector
vector . matrix gives a vector
matrix . matrix gives a matrix, the matrix product
and we can go on to tensors in general.

What has this to do with row and column vectors? Actually, the
question is: what is a row vector and what is a column vector? Again,
mathematically it is simple. When you have a vector in a finite
dimensional space, you might think of this vector as a list of
coordinates. Now you can write down these coordinates in a lot of
ways: horizontally, vertically, diagonally, in a circle, and so on.
These are NOTATIONS for the vector, NOT THE VECTOR ITSELF. When we
write the coordinates horizontally, then we may see this as a matrix
of one row, incorrectly called a row vector. When we write the
coordinates vertically, we may see that notation of a matrix of one
column, incorrectly called a column vector. Obviously, transposing a
vector is impossible (consider the vector (2,5) in the plane, where in
the plane is the transposed vector?), but you can transpose the matrix
notation: the transposed of the row notation for a vector is the
column notation for the vector and conversely. This property enables
us to do a lot of vector computations as matrix computations. For
example, matrix . vector in Mathematica would be the matrix
multplication matrix . columnmatrix; the result is a column notation
for a vector and Mathematica returns the vector itself.

So this is behind it in Mathematica. For me as a professional
mathematician this is very natural. Computing an inner product as
vector . Transposed[vector] is for me absolute nonsense, since I
cannot transpose a vector. But using a row NOTATION for a vector, it
is one of the ways by which we can COMPUTE the inner product.

Therefore, Mathematica does not display a vector as a matrix, but as
long as you realize that a matrix is not a vector, you could define
your own matrix display for a vector.

I hope this is of some interest for you.

Kind regards,

Fred Simons
Eindhoven University of Technology
User avatar
telefunkenvf14
 
Posts: 46
Joined: Tue Apr 27, 2010 7:40 pm
Location: Lincoln, NE
Organization: University of Nebraska-Lincoln
Department: Economics


Return to General Mathematica Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron