Group Abstract Group Abstract

Message Boards Message Boards

30
|
122K Views
|
22 Replies
|
121 Total Likes
View groups...
Share
Share this post:

[CALL] Most common pitfalls for beginners of Wolfram Language

POSTED BY: Vitaliy Kaurov
22 Replies
Posted 4 years ago

Keyboard combinations and keyboard mistakes. I'm a longtime Mathematica user but am surprised by the recent inadvertent results when trying to add comments to input. The second line below, the red square, is particularly problematic. It appears at the beginning of the input line and will change the properties of what is usually a variable and assignment operator (set). If it occurs with a variable that is subscripted, I have to reboot Mathematica; undo, Clear[], ClearAll[] will not fix whatever that red square does to my subscripted variables. The freeform input symbol shown is easy to search for (orange box with equals sign), but not so with the red box and other mistakes shown....

Wolfram Notebook

POSTED BY: Mark Bourland
Posted 4 years ago
POSTED BY: Pedro Cabral
POSTED BY: Jon McLoone
POSTED BY: Sander Huisman

Subscripted variables are a pain...use [i] indexing instead.

POSTED BY: Yaroslav Bulatov
Attachments:
POSTED BY: Raspi Rascal
Posted 9 years ago
POSTED BY: David Proffer

Numerical vs Symbolic -- What to do when plots are blank (and other strange errors)

The plotting functions require numerical inputs. This sounds obvious but most people have trouble debugging plots that come out empty. When something does not plot, the first thing to do is to evaluate the expression and look for undefined variables or typos.

Consider the following:

A = 12;
b = 3;
expr = a* b sin[theta];
Plot[expr, {theta, 0, 10}]

which yields a less than informative plot:

enter image description here

The best approach is to take the plot argument and evaluate it at a point somewhere in the plot range and see that it is numerical. It is often a good idea to evaluate it at the two extremes and the middle to make sure it is numerical everywhere.

expr /. theta -> 0
expr /. theta -> 5
expr /. theta -> 10

to get

 (* 3 a sin[0] 
3 a sin[5] 
3 a sin[10] *)

It becomes clear that the a is undefined and that sin does not evaluate (because of the lower case 's')

POSTED BY: Neil Singer
POSTED BY: Aeyoss Antelope
POSTED BY: Benjamin Goodman
POSTED BY: Michael Rogers
POSTED BY: Sander Huisman
POSTED BY: Raspi Rascal

Thanks, had added a previous version of ApplyTo, now fixed, and also added [Application]. (https://reference.wolfram.com/language/ref/Application.html)

POSTED BY: Sander Huisman

see "x|->f — new syntax for Function with named variables"

btw your post is the only bookmark I am keeping from this community site.

POSTED BY: Raspi Rascal
POSTED BY: Sander Huisman
POSTED BY: Peter Burbery
Posted 4 years ago

Not sure how you are entering the left and right floor brackets but that is the problem,

\[LeftFloor]5.5\[RightFloor]
(* 5 *)

To enter from the keyboard esclfesc and escrfesc where esc is escape.

POSTED BY: Rohit Namjoshi
POSTED BY: Sander Huisman
POSTED BY: Sander Huisman
POSTED BY: Patrick Scheibe
POSTED BY: Marina Shchitova
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard