mathematics and me

We must know, We will know。 -----Hilbert

2014年2月3日星期一

(转)Mathematica学习资源

本文转自Mathematica Stack Exchange上问题“Where can I find examples of good Mathematica programming practice?”
这是第一个回答Faysal Aberkane):
Here's a collection of resources that I started on Mathgroup (A collection of Mathematica learning resources ) and updated here at StackOverflow. As this site is dedicated to Mathematica it makes more sense to maintain it here. This represents a huge amount of information; of course it's not exhaustive so feel free to improve it! Also, don't hesitate to share it and suggest other interesting links! Remember, you can always search the online Documentation Center of Mathematica, that is identical to the built-in help of the latest software version.
Links to more advanced aspects of the program that you can start to appreciate once you understand the basics are provided in separate answers (below) as this post became too large.

Introduction

Basic advices for people new to Mathematica

Functional style
Avoid iterative programming using loops like For or Do, use instead functional programming functions Map, Scan, MapThread, Fold, FoldList, ... and pure functions. This makes the code cleaner and faster.
Transpose and dimensions
  • Something not easy to guess alone at the beginning: if you have x={1,2} and y={3,4}, doing Transpose[{x,y}] or {x,y}ESC tr ESC in the front end will produce {{1,3},{2,4}} (format compatible with ListPlot). This animation helps understand why.
  • You can also use the second argument of Transpose to reorder the indices of a multidimensional list.
  • Don't forget to regularly control the output of the lists you generate using Dimensions.
Get familiar with shorthand syntax (@, &, ##, /@, /., etc.)
  • Operator Input Forms
  • It may happen that you are not sure about which shorthand expression will get executed first, in this case test the correctness of your input using something like Hold[inputExpression]//FullForm
Programming easily
  • Getting help: Execute ?Map for example for a short description of a function, or press F1 on a function name for more details and examples about it. You can solve many problems by adapting examples to your needs.
  • Auto-completion: Start typing the name of a function and (in Mathematica 9+) select from the pop-up auto-completion menu, or press Ctrl+k to get a list of functions which names start with what has already been entered. Once the name of the function is written completely press Ctrl+Shift+k (on Mac, Cmd+k) to get a list of its arguments.
  • Function templates: In Mathematica 9, after typing a function name, press Ctrl+Shift+k (on Mac, Cmd+Shift+k) and click on the desired form from the pop-up menu to insert a template with named placeholders for the arguments.
    Other useful shortcuts are described in the post Using the Mathematica front-end efficiently for editing notebooks.
  • Use palettes in the Palettes menu especially when you're beginning.
  • In Mathematica 8, use the natural input capability of Wolfram Alpha, for example type "= graph 2 x + 1 between 0 and 3" without the quotes and see the command associated with the result.

Tutorials

FAQ

Books

Wolfram Websites

Learn
Examples
Resources
Blogs
Other related sites
Virtual conferences
Mathematica one liner competition
Wolfram technology conferences

Blogs

Personal websites

Calculus
Resources on other languages

Forums

MathGroup
Stack... sites

Links to some packages

Packages for preparing publication-quality scientific figures
  • LevelScheme by Mark Caprio (latest version: 3.52, Sep 2011, for Mathematica 6 and higher)
  • Presentations and other packages by David Park (latest version: 25 Aug 2011)
  • A WorkLife Framework by Scientific Arts LLC (extendable and customizable toolset that broadens Mathematica's scope across many aspects of daily work)
  • FeynArts by Thomas Hahn (latest version: 3.7, 27 Mar 2012, package for generation and visualization of Feynman diagrams and amplitudes)
  • Writing and Publishing a Book with Mathematica by Paul R. Wellin (2005, available from the Wolfram Library Archive)

Useful non-free tools for development, deployment, distribution, linking, etc.

这是第二个回答Faysal Aberkane):
My original post above became too big so I'm splitting it in two posts. The tips and tricks section that I used to keep track of interesting new posts mostly on this site was big so here it is.
Note the tags at the end of each question on this site in order to read related questions.
I'm further dividing this post. See my third answer on Advanced evaluation and patterns below.

Tips and tricks

Top posts
General tricks
Tips for writing faster code
Reap and Sow
Compile
Using links to other languages
Packed arrays
Debugging
Data Structures
Objects
Traversal of an expression
Graphs
Optional Values
Accessing data in different ways
Rules and replacement (the backbone of Mathematica, more advanced)
Getting ideas from Lisp
Memoization/Caching
Undocumented features
Mathematica functions and environment
Manipulate/Dynamic
Palettes
Finance (but not only)
Correlation
Proba/Stats
Misc
Neat algorithms
补充:原作者 ( Faysal Aberkane )的第三个回答
Third part of my collection of links, dedicated to advanced evaluation and pattern matching.
Advanced evaluation of expressions
Pattern matching
A pattern is a way to quickly describe the structure of expressions and do computations on them, using /. or Cases for example.

没有评论:

发表评论