Mathematica 学习资源2

原文在这里

A collection of Mathematica learning resources -- Part II

Tips and tricks

Top posts

  • What are the most common pitfalls awaiting new users?
    Programming paradigm change
  • Can one identify the design patterns of Mathematica?
  • What is in yourMathematica Toolbag

General tricks

  • http://www.verbeia.com/mathematica/tips/Tricks.html (Ted Ersek's tricks)
    http://library.wolfram.com/infocenter/MathSource/4557/ (Ted Ersek's tricks as notebooks)
  • http://szhorvat.net/pelican/pages/mathematica.html (Szabolcs' tricks)
  • http://www.verbeia.com/mathematica/tips/tips.html (Verbeia's tricks)
  • http://www.nhn.ou.edu/~morrison/Mathematica/ (Tip sheets)
  • As pointed out by Mr. Wizard, have a look at the available packages in your install directory for getting new ideas!
  • Tricks of the trade in the Mathematica Journal
  • How do I designate arguments in a nested map?
  • Levels: how do they work?
  • Elegant operations on matrix rows and columns
    http://reference.wolfram.com/mathematica/tutorial/LinearAlgebraMatrixAndTensorOperations.html

Tips for writing faster code

  • Performance tuning in Mathematica?
  • http://blog.wolfram.com/2011/12/07/10-tips-for-writing-fast-mathematica-code
  • Programming for speed
  • Benchmarking expressions (timeAvg function)
    Profiling from Mathematica
  • http://www.dbaileyconsultancy.co.uk/m_performance/m_performance.html
  • http://library.wolfram.com/infocenter/Conferences/7005/ (Principles of efficient MM programs, tips for writing fast code)
  • http://library.wolfram.com/infocenter/Conferences/320/ (Generally Efficient Numerics Programming in Mathematica)
  • Writing Efficient Mathematica Code
  • Dispatch tables
    Using Mathematica's Dispatch
    Efficiently extracting an array subset given a separate array
    How to speed up calculations with large number of replacement rules? (Experimental`OptimizeExpression)
  • Alternatives to procedural loops and iterating over lists in Mathematica
    Are there any cases when For[] loops are reasonable?
    Alternatives to While Loops?
    Is Table the only functional way to construct nested loops in Mathematica?
    How to transform Do loop to more efficient codes?
    Replace For-loop with functional code
    Equivalent Nested Loop Structure
    "do ... while" loop equivalent in Mathematica
  • Evaluate while external command is being run
  • Transferring a large amount of data in parallel calculations
    Are built-in Mathematica functions already parallelized?
    Does parallel programming use up large quantities of memory in Mathematica?
    Why is this parallel evaluation with Dispatch[] so slow?
    Computing Many Slow I/O Operations
  • Use Internal`Bag as a linked list (see links in Data Structures paragraph below)

Reap and Sow

  • Collecting Expressions during Evaluation
    Reap and Sow can be used with StepMonitor
  • SelectEquivalents (my personal favorite Mathematica function, basically it allows to define classes of equivalence and apply a function on the elements of each class, using Reap and Sow)
    How would you do a PivotTable in Mathematica?
  • Reap and Sow can also be used for debugging, see for example how it's used inShowIt
  • How to collect result continuously (interruptible calculation) when running parallel calculations?

Compile

  • How to compile effectively?
    How well does Mathematica code exported to C compare to code directly written for C? (Note the function Experimental`OptimizeExpression)
    Has this implementation of FDM touched the speed limit of Mathematica?
  • Note the instruction (<< CompiledFunctionTools`; StringFreeQ[CompilePrint[cf], "MainEvaluate"]) to quickly verify that a compiled function doesn't need calls to external functions, available as from v8.
  • http://reference.wolfram.com/mathematica/Compile/tutorial/Overview.html
  • http://library.wolfram.com/infocenter/Conferences/7968/ (Effective Use of the Mathematica Compiler and Code Generation)
    What kinds of uses of SymbolicC (introduced in Mathematica 8) do you foresee? Are there any neat examples already?
  • List of compilable functions
    Why is there a huge performance gap using Map with more than 100 List entries
  • Shaving the last 50 ms off NMinimize (Advanced tricks for a very fast Nelder-Mead optimizer)
    Minimization by Nelder-Mead
    Using Apply inside Compile
    Removing calls to MainEvalute when using inlined compiled closures
  • JIT compilation
    Implementing a function which generalizes the merging step in merge sort
    A fast, robust DropWhile
  • Retaining and reusing a one-to-one mapping from a sort
  • Is it possible to use Compile on a function with optional arguments?
  • Compiling more functions
    How can I compile this function
    Compiling more functions that don't call MainEvaluate
  • Does Mathematica have a "MATLAB Builder" equivalent?
    http://reference.wolfram.com/mathematica/CCodeGenerator/tutorial/CodeGeneration.html
    http://reference.wolfram.com/mathematica/CCodeGenerator/ref/LibraryGenerate.html
  • Third argument of Compile

Using links to other languages

  • System interfaces and deployment
  • Faster alternatives for DayOfWeek (Java)
    Working with Java hashmaps from Mathematica
  • Minimal effort method for integrating C++ functions into Mathematica
    Converting other C++ classes to MTensor in LibraryLink
    How can I use shared libraries in LibraryLink code and ensure Mathematica will find them?
    How to understand shared passing of a MTensor in LibraryLink?
    Using Boost with CreateLibrary
    Write C/C++ programs calling Mathematica functions
    Example program for calling Mathematica from C
    Returning multiple results from a LibraryLink function
    Calling Mathematica from Visual Studio - example
    Which Distributions can be Compiled using RandomVariate
    Librarylink made easier to use with C++11
    Calling Mathematica from Visual Studio - example
  • How to use C language functions in Mathematica?
  • Mathematica Functions from VBA
  • Linking FORTRAN with Librarylink
  • MATLink, link between Mathematica and Matlab
    Is it possible to export the equations from Mathematica to MATLAB?
  • Calling IronPython code from Mathematica
  • JLink
    JLink classes' reference

Packed arrays

  • http://library.wolfram.com/infocenter/TechNotes/391/ (Packed Arrays)
  • What is a Mathematica packed array? (instruction for being warned when a packed array is unpacked)
    Mathematica memory management for large arrays
  • Avoid mixing integers with reals in a list, which would unpack the list and slow computations. For example use 1. instead of 1 if you have to enter manually an entry in a list of reals.
  • Isn't it possible to Pack a SparseArray?

Debugging

  • A debug utility to print or extract intermediate data from a program (ShowIt, a useful variant of Print)
  • The clearest way to represent Mathematica's evaluation sequence
    How do I evaluate only one step of an expression?
  • Debugging memory leaks
    Profiling memory usage in Mathematica
    Preventing Mathematica from eating up all your memory (not a bug but the info can be useful)
    How to un-eat memory?
  • Using the Mathematica debugger, and other interesting possibilities
    Debugging Mathematica Code
  • DebugTrace
  • How to program a F::argx message?
    How to abort on any message generated?
    Best practices in error reporting
    How to leave function unevaluated programmatically?
    Setting up diagnostic error messages in large Mathematica projects
    Dealing with errors and resuming the code after one
    Interrupting package evaluation, handling error
    Prepend Information to Warning Messages
    Need help with exception handling
    Error checking and trapping techniques with Throw and Catch
    Exception/Error handling using returns codes
    How do I get Mathematica to return a function call unevaluated?
  • Wolfram Workbench has an integrated debugger and profiler. See here for posts about it on this site:http://mathematica.stackexchange.com/questions/tagged/workbench
    Inspecting non-variable state from a breakpoint in Workbench
    workbench: how to see values of global variables during debugging
  • Mathematica Debuggability
  • Automatically generating a dependency graph of an arbitrary Mathematica function?
    Is there an analogue of the Variables command for general expressions?

Data Structures

  • Data structures and efficient algorithms, from Daniel Lichtblau
    Kd-list, Kd-tree (applied to Gröbner bases)
  • Expr Bag
    Internal`Bag inside Compile
    Efficiently collecting results inside a compiled function
  • Linked lists
    Mathematica “linked lists” and performance
    Merge-sort
    Variant of the cutting-stock problem in Mathematica
    The answer of Leonid is a reference on the topic: Can one identify the design patterns of Mathematica?
    Searching linked lists that contain lists?
  • Efficient circular buffer?
  • Efficient priority queues?
  • BTree
    Using Memoization with a Mutable Object
    How to speed up Minimum Spanning Tree algorithm?
    How to make Huffman coding by using tree representation
    What is the fastest way to maintain a large set of expressions?
    Generating an ordered list of pairs of elements from ordered lists

Objects

  • How to create strong types?
    How to implement FittedModel like objects
    How can one define a custom data object?
  • Struct equivalent in Mathematica?
    Implementing a dictionary data structure
    Is there HashTable structure in Wolfram Mathematica?
    Is there a method to enumerate the keys/values of System`Utilities`HashTable
    A usage example in the answer of Oleksandr R. or in the answer to the post
    How can you give a Module a context and have its local variables and Modules belong to that context?
    What's fastest way of defining 10^5 down values?
  • Once more on object orientation in Mathematica: does it have to be so hard?
    Builder pattern for complex objects construction
  • OOP applied to manipulate
  • Question about designing a particular data structure
  • Code Readability and Object-Oriented Code
  • Polymorphism and the pattern-matcher
  • Inheritance in Mathematica using pattern matching on UpValues
  • How to implement the Observer design pattern?

Traversal of an expression

  • How to perform a depth-first preorder traversal of an expression?
  • How to perform a breadth-first traversal of an expression?
  • Determining all possible traversals of a tree
  • Uses for MapAll (//@)
    myHold examples with MapAll (1,2)
  • Can a Trie be implemented efficiently?
  • Concatenate strings from different levels of list

Graphs

  • GraphUtilities
  • How to play with Facebook data inside Mathematica?

Optional Values

  • Functions with Options
  • How can I create a function with optional arguments and options?
  • Can a function be made to accept a variable amount of inputs?
  • Dealing with nested options
  • Evaluation of OptionValue[]
  • Custom functions by delegating options in a specific way and using core functions (withOptionConfiguration)
  • Specifying optional arguments with variables
  • Is there any way to define pure functions with optional arguments?
    Is it possible to separately call the default value of a variable which isn't at the end of the sequence?
  • Why doesn't Mathematica use uniform criteria for validating Options?
  • How to inherit options by scoping?
  • How to make a function with its own options as well as passing options to other functions
  • Using a held option

Accessing data in different ways

  • Cases[data,Colon[key,_]] vs. Cases[data,key:_] toward XPath, XQuery
  • Emulating R data frame getters with UpValues
    Creating a R DataFrame like construct in Mathematica
    How to achieve Set+Part like behaviour in custom Set function?
  • The gap between MapAt and ReplacePart for 2D data tables with headers
  • Data Table Manipulation in Mathematica
    Data Table Manipulation in Mathematica: Step 2
    How can a big table be treated as a database?
  • Path queries for tree-structured data
  • Splitting up delimited data in lists
    Partitioning with varying partition size (dynamicPartition)
    Splitting a list by specifying section headers
  • Accessing list elements by name

Association/Dataset

  • How to make use of Associations?
    Normal // Association // Dataset workaround for some user query operators
    Can't get Append to append a record (association) to a dataset
    How can I save a Manipulate's control settings to a dataset?
    V10's Operator Forms - what are they good for?
    What is the natural way of using Dataset to get a FittedModel?
    Dataset: get number of levels and elements
    Is there a comprehensive list of functions with V10 operator forms?
    Converting structured data to a dataset
    How can I add a column into a existing Dataset?
    GroupBy several keys while keeping the Dataset as a Table (List of Associations)
    Learning Resources for Data Science in the Wolfram Language (many usage examples of List/Association/Dataset)
    SQL-like computation on Dataset: Aggregate function

Rules and replacement (the backbone of Mathematica, more advanced)

  • Where definitions are stored
  • What is the distinction between DownValues, UpValues, SubValues, and OwnValues?

Getting ideas from Lisp

  • Structure and interpretation of computer programs,Common Lisp The Language, On Lisp, Practical Common Lisp ...
  • repl.it has an online interpreter for Scheme with some examples.
  • Is there a Mathematica/Lisp link?
  • Other functional languages : Scala, Haskell, Erlang, Clojure, Caml, F#, Maude ...
  • FAQ on functional programming

Memoization/Caching

  • The answer of Leonid is a reference on the topic: Can one identify the design patterns of Mathematica?
  • What does the construct f[x_] := f[x] = ... mean?
  • Avoid repeated calls to Interpolation (Interesting answers and links about caching values and expressions)
  • Function that caches when it returns unevaluated
  • Why is there no PositionFunction in Mathematica?
  • Built-in Mathematica data: are they cached? how to speed up the loading?

Undocumented features

  • What are some useful, undocumented Mathematica functions?
  • How can one find undocumented options or option values in Mathematica?
  • What is the complete list of valid Front End Tokens?
  • How do you convert a string containing a number in C scientific notation to a Mathematica number?
  • What is the complete list of valid FrontEnd Packet types?
  • How can I get the unchanged Box form of an arbitrary expression?
  • How can I manipulate TemporalData?
  • How to work with Experimental`NumericalFunction?
  • Full documentation for AppearanceElements
  • How to create internally optimized expression for computing with high WorkingPrecision?
  • What are all the named Mathematica styles?

Mathematica functions and environment

  • How to specify Mathematica as a programming language?
    http://www.wolfram.com/mathematica/quick-revision-history.html
    http://12000.org/my_notes/compare_mathematica/index.htm
    How to get complete Documentation Center graph of guide pages?
    Automated testing for compatibility with older Mathematica versions
    Integrating notebooks to Mathematica's documentation center (Using Wolfram Workbench is easier for building a help but the answer is still interesting)
    List of dangerous functions
    What are all the named Mathematica styles?
  • Wolfram Workbench
    How can I dynamically get a file whenever it is saved in Workbench?
    How to work with Application Project files in Wolfram Workbench?
    Managing formatted usage messages in Wolfram Workbench
    What's the difference between these two ways of specifying dependent packages?
    Creating cross-version compatible documentation with Workbench
    How to install the Wolfram Workbench plugin into Eclipse Kepler?
    Renaming projects in Wolfram Workbench
    Creating Mathematica packages
    How to setup Team Development for a Mathematica project?
    What is a "Paclet"?
    What are recommended guidelines for developing packages?
    How to unload automatically loaded packages?
    How can I use shared libraries in LibraryLink code and ensure Mathematica will find them?
  • How does Plot work?
    How to examine the structure of Graphics objects
    Symbolic derivatives are being calculated numerically
    Embed Code Into Image
  • How can I set up a versioning system within a notebook?
    Is there a notebook autosave frequency configuration?
    Are there suitable versioning systems for Mathematica notebooks?
  • How to find a specific error message?
  • The Joy of Tagging: Manipulating and Mining Notebooks in Mathematica
  • Programmatic formatting for Mathematica code - possible?
    Syntax highlighting for your own functions
    Customizing syntax highlighting for private cell styles
    Special Mathematica Cell to work with R code
  • Is it possible to improve Mathematica's auto-completion feature?
  • Creating a notebook that has cells of a certain style password protected
    Advanced typesetting
    Resources for beautiful Mathematica Stylesheets
    Some tutorials on formatting notebook for exporting to pdf
  • Adding a label to an expression result
    How to fold output cells by default?
  • Open-source IntelliJIDEA plugin to support Mathematica development
  • Automatic e-mail/text message when a calculation has finished?
    Keep MathKernel Running In Background - Speed Up Execution Time
  • Simpler input for the new unit support
  • Quality of random numbers
  • Will Mathematica install and run on Raspberry Pi computer?
  • Scheduling Mathematica scripts to run from a command line
  • How to keep $FrontEnd options from resetting?
  • How do I add new menuitems to menus?
  • Mathematica color schemes for the colorblind

Manipulate/Dynamic

  • Got Manipulate? (Seminar slides)
    Manipulate secrects revealed
  • What is the equivalent of a prototypical Manipulate in lower level functions?
    Selective evaluation of blocks of code in a Manipulate
  • Understanding CDF
  • How to modularize custom controls for Manipulate?
    http://reference.wolfram.com/mathematica/tutorial/AdvancedManipulateFunctionality.html (See last paragraph)
  • Question about collections of custom GUI controls for Mathematica
  • How to execute a function each time the slider is dragged?
    How can I make controls have Button-like behaviour?
  • How can I effectively performance-profile Dynamics?
  • Multiplayer game in Mathematica: how to communicate between kernels?
  • Mathematica Manipulate with macros AND variable number of controls (persistence desired)
  • How to wrap this dynamic code inside a Manipulate?
  • For[] or While[] can't be used inside Manipulate[]?
  • Manipulate with explicit updates
  • Wrapping EventHandler by Table
  • Generalized input (look at Interpretation)
  • What does None mean in a control specification for Manipulate?
  • How to anchor a Pane's scroll position to the bottom?
  • How to visualize/edit a big matrix as a table?
  • Button evaluation inside DynamicModule
  • Altering layout and sizing of Manipulate controls?
  • Unexpected Setter Bar Behavior when Manipulate Nested in Dynamic Module
  • How can I use Dynamic to run a script when a new file is added to a directory?
  • Using list elements in TrackedSymbols for Dynamic
  • Evaluation order control
  • How to make slider in/visible in Manipulate?
  • How to visualize the structure of this dynamic programming code
  • Slider resistance and Play-Pausing with Manipulate, TabView, and attempt an granular TrackedSymbols?
    trouble with Dynamic range in SetterBar
  • How to save Manipulate bookmarks permanently?
  • Writing a simple application: interactive quiz for multiplication table practice
  • Dynamically Updating Function
  • How can I create an advanced grid interface on Mathematica?
  • Alternative updating of a dynamic expression
    How to anchor a Pane's scroll position to the bottom?
  • How to Initiate a queued evaluation from a Dynamic GUI without using a Button
    Evaluation order control
  • How to avoid an expensive subset of a Manipulate computation when dependent variables have not changed?
    Slider resistance and Play-Pausing with Manipulate, TabView, and attempt an granular TrackedSymbols?
    OOP applied to manipulate
  • Event driven GUI
  • Using Refresh[..] with TrackedSymbols
  • SaveDefinitions considered dangerous

Palettes

  • Can I easily post images to this site directly from Mathematica? (Yes!)
  • A palette of accumulated expertise
  • For Sale! Three potentially useful palettes
  • What are the most common (usual) ways to make palettes with non-trivial functionality?

Finance (but not only)

  • Learning Finance with Mathematica
  • http://www.wolfram.com/events/chicago2011/nVidiaFinancePresentation.nb
  • High-Performance Computing in Finance
  • http://blog.wolfram.com/category/finance/
  • How can you compute Itō Integrals with Mathematica?
    Fast Simulations with Compile
  • Problem with Financial Data
  • Growth theory with Mathematica
    How to model Macroeconomic dynamics?
  • Making a Stock Options Database in Mathematica
    How to request financial data from Yahoo's YQL and Quandl?
    Graph databases / Nosql with Mathematica
  • http://www.mathestate.com/
  • Problem with Financial Data
  • How can I connect to the IB TWS platform from Mathematica?

Correlation

  • What is the best way to create a correlation matrix heatmap with values?
  • Correcting a correlation matrix to be positive semidefinite

Proba/Stats

  • DistributionFitTest[] for custom distributions in Mathematica (How to define a custom probability distribution in Mathematica 8)
  • Probability: proportion of 1000 random lists for x that contain the same nrs
  • Filtering beat-to-beat heart rate data
  • Time-series decomposition in Mathematica
  • http://blog.wolfram.com/2013/02/01/the-ultimate-univariate-probability-distribution-explorer
  • Mathematica code for hidden Markov models (HMM)
  • Autoregressive distributed lag model
  • Finding the likeliest path in a Markov process

Misc

  • Open Excel file with Mathematica
    Exporting data from Excel into Mathematica using clipboard
  • Tricks for making graphics for the math book
  • Automating FTP upload within Mathematica?
  • How to include Mathematica animation in a PowerPoint presentation?
  • Calling external commands without showing command prompt on windows
  • Web Browsing Automationwith Mathematica

你可能感兴趣的:(Mathematica 学习资源2)