Difference between revisions of "Mathematica/Elementary"

From PrattWiki
Jump to navigation Jump to search
 
(5 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
#* CTRL-= for natural language input  
 
#* CTRL-= for natural language input  
 
#* Graphics can be part of a list
 
#* Graphics can be part of a list
#* BarChart, PieChart, NumberLinePlot, Colulmn,  
+
#* BarChart, PieChart, NumberLinePlot, Column,  
 
# Operations on Lists (6:17)
 
# Operations on Lists (6:17)
 
#* List math operations are element-wise
 
#* List math operations are element-wise
Line 48: Line 48:
 
#* Importing the sample file did not work for me, nor did CurrentImage[] so I just imported another jpg I had
 
#* Importing the sample file did not work for me, nor did CurrentImage[] so I just imported another jpg I had
 
#* Import, Blur, Binarize, EdgeDetect, DominantColors, ImageAdd, ImageCollage, ExampleData
 
#* Import, Blur, Binarize, EdgeDetect, DominantColors, ImageAdd, ImageCollage, ExampleData
 +
# Strings and Text (7:55)
 +
#* Double quotes
 +
#* InputForm, StringLength, StringReverse, ToUpperCase, StringTake, StringJoin, Characters, TextWords, TextSentences, WikipediaData, WordCloud, WordList, RomanNumeral, IntegerName, AlphaBet, LetterNumber, FromLetterNumber, Transliterate, Rasterize
 +
#** StringLength and others are mapped onto lists of strings
 +
# Sound (8:32)
 +
#* Sound, SoundNote
 +
#** Note 0 is middle C, integer values are keys (including black keys) away from middle C
 +
#** To choose a style you also have to choose a duration
 +
# Arrays, or Lists of Lists (6:59)
 +
#* Table with extra sizes
 +
#* Grid, ArrayPlot, ImageData
 +
#* ArrayPlot colorizes in reverse...ArrayPlot[ImageData[image]] is reversed
 +
# Coordinates and Graphics (7:57)
 +
#* {{x1, y1}, {x2, y2}} etc
 +
#* Graphics primitives take centers, sizes, other info
 +
#* ListPlot, ListLinePlot, Point, Line, PointSize, Line, Polygon, Graphics3D, Sphere
 +
# Scope of the Wolfram Language (7:54)
 +
#* Help->Documentation
 +
#* Fast Introductions section
 +
#* ?FunctionName, ?*LastPart, ?FirstPart*
 +
#* Suggestions bar below result; code for result will be shown after using interactive suggestions
 +
# Real-World Data (8:05)
 +
#* Plain English: CTRL-= then type statement
 +
#* Can be indexed
 +
#* Properties follow CamelCase even if EntityProperties return does not appear to
 +
#* Entity, EntityClass, EntityList, EntityProperties
 +
# Units (8:38)
 +
#* Units using plain English
 +
#* InputForm to show how to enter using regular code
 +
#* UnitConvert[thing, "Conventional"] will simplify
 +
#* Quantity, InputForm, UnitConvert, CurrencyConvert, Rotate, esc-deg, AnglePath (turtle turns with step 1)
 +
# Geocomputation (6:23)
 +
#* Natural language for locations
 +
#* GeoListPlot, GeoGraphics, GeoPath, GeoDistance, GeoPosition, Here, GeoNearest
 +
# Dates and Times
 +
# Options (7:48)
 +
#* kwarg -> value
 +
#* Options[command, kwarg]
 +
# Graphs and Networks (9:43)
 +
#* Vertices and edges, not plots
 +
#* Rules in a list with -> to indicate relationships
 +
#* Graph, FindShortestPath, UndirectedGraph, Flatten, Import, FilePrint, CommunityGraphPlot
 +
# Machine Learning
 +
# More about Numbers
 +
# More Forms of Visualization
 +
# Ways to Apply Functions
 +
# Pure Anonymous Functions
 +
# Applying Functions Repeatedly
 +
# Tests and Conditionals
 +
# More about Pure Functions
 +
# Rearranging Lists
 +
# Parts of Lists
 +
# Patterns
 +
# Expressions and Their Structure
 +
# Associations
 +
# Natural Language Understanding
 +
# Creating Websites and Apps
 +
# Layout and Display
 +
# Assigning Names to Things
 +
# Immediate and Delayed Values
 +
# Defining Your Own Functions
 +
# More About Patterns
 +
# String Patterns and Templates
 +
# Storing Things
 +
# Importing and Exporting (7:00)
 +
#* Import web text, web links, web images
 +
#* $ImportFormats, $ExportFormats
 +
#* Import, LanguageIdentify, StringSplit, NestGraph, SocialMediaData, WebImageSearch, ResourceData, SendMail, Export
 +
# Datasets (9:22)
 +
# Writing Good Code
 +
# Debugging Your Code

Latest revision as of 18:20, 9 June 2021

These are draft notes from An Elementary Introduction to the Wolfram Language

  1. Starting Out: Elementary Arithmetic (4:10)
    • Shift-Enter to perform a calculation
    • ^ for powers
    • asterisk for multiplication or space if it is clear
    • Keeps numbers as rational fractions if possible; converts to float with any floats involved
  2. Introducing Functions (6:09)
    • Commands use CamelCase
    • Arguments in square brackets
    • Colors: Blue=unknown command, purple=bracket mismatch
    • Plus, Times, Power, Max, Min, RandomInteger
  3. First Look at Lists (6:26)
    • Usually with { }
    • Edit->Extend Selection or CTRL-. will "grow" a selection to the next largest complete expression
    • ListLinePlot, ListPlot, Reverse, Range, Join
      • Range starts with 1
  4. Displaying Lists (4:54)
    • CTRL-= for natural language input
    • Graphics can be part of a list
    • BarChart, PieChart, NumberLinePlot, Column,
  5. Operations on Lists (6:17)
    • List math operations are element-wise
    • [[ ]] will index from list
    • Sort, Length, Total, First, Last, Part, Take, Drop, Count, IntegerDigits
      • Mathematica is 1-indexed
  6. Making Tables (9:34)
    • Table
      • Table[item, number of items to generate]
      • Table[fcn[var], {var, start, end}]
      • Table[fcn[var], {var, start, end, step}]
      • Table[fcn[var], {var, {values}}]
    • The video has "ListPlot[Range[0, 1, 0.02]-Range[0, 1, 0.02]^2]" but "ListPlot[Table[x - x^2, {x, Range[0, 1, 0.02]}]]" seems more efficient
  7. Colors and Styles (7:22)
    • Red, Green, Blue, ColorNegate, Blend, RGBColor, Hue, RandomColor
    • Style takes an item along with information about color, size, and face
  8. Basic Graphics Options (7:54)
    • Graphics expression has graphics primitives that are changed by graphics directives
    • Graphics, Circle, Disk, RegularPolygon, Graphics3D, Sphere, Cone
    • Wrap graphics primitives with Style to change things
      • Thickness, Opacity
  9. Interactive Manipulation (7:30)
    • Manipulate creates a selector; effectively picks items from a list but can continuously change if variable is continuous
    • Can manipulate multiple items
      • polyfit example?
    • ColorSetter
  10. Images (5:22)
    • Importing the sample file did not work for me, nor did CurrentImage[] so I just imported another jpg I had
    • Import, Blur, Binarize, EdgeDetect, DominantColors, ImageAdd, ImageCollage, ExampleData
  11. Strings and Text (7:55)
    • Double quotes
    • InputForm, StringLength, StringReverse, ToUpperCase, StringTake, StringJoin, Characters, TextWords, TextSentences, WikipediaData, WordCloud, WordList, RomanNumeral, IntegerName, AlphaBet, LetterNumber, FromLetterNumber, Transliterate, Rasterize
      • StringLength and others are mapped onto lists of strings
  12. Sound (8:32)
    • Sound, SoundNote
      • Note 0 is middle C, integer values are keys (including black keys) away from middle C
      • To choose a style you also have to choose a duration
  13. Arrays, or Lists of Lists (6:59)
    • Table with extra sizes
    • Grid, ArrayPlot, ImageData
    • ArrayPlot colorizes in reverse...ArrayPlot[ImageData[image]] is reversed
  14. Coordinates and Graphics (7:57)
    • {{x1, y1}, {x2, y2}} etc
    • Graphics primitives take centers, sizes, other info
    • ListPlot, ListLinePlot, Point, Line, PointSize, Line, Polygon, Graphics3D, Sphere
  15. Scope of the Wolfram Language (7:54)
    • Help->Documentation
    • Fast Introductions section
    • ?FunctionName, ?*LastPart, ?FirstPart*
    • Suggestions bar below result; code for result will be shown after using interactive suggestions
  16. Real-World Data (8:05)
    • Plain English: CTRL-= then type statement
    • Can be indexed
    • Properties follow CamelCase even if EntityProperties return does not appear to
    • Entity, EntityClass, EntityList, EntityProperties
  17. Units (8:38)
    • Units using plain English
    • InputForm to show how to enter using regular code
    • UnitConvert[thing, "Conventional"] will simplify
    • Quantity, InputForm, UnitConvert, CurrencyConvert, Rotate, esc-deg, AnglePath (turtle turns with step 1)
  18. Geocomputation (6:23)
    • Natural language for locations
    • GeoListPlot, GeoGraphics, GeoPath, GeoDistance, GeoPosition, Here, GeoNearest
  19. Dates and Times
  20. Options (7:48)
    • kwarg -> value
    • Options[command, kwarg]
  21. Graphs and Networks (9:43)
    • Vertices and edges, not plots
    • Rules in a list with -> to indicate relationships
    • Graph, FindShortestPath, UndirectedGraph, Flatten, Import, FilePrint, CommunityGraphPlot
  22. Machine Learning
  23. More about Numbers
  24. More Forms of Visualization
  25. Ways to Apply Functions
  26. Pure Anonymous Functions
  27. Applying Functions Repeatedly
  28. Tests and Conditionals
  29. More about Pure Functions
  30. Rearranging Lists
  31. Parts of Lists
  32. Patterns
  33. Expressions and Their Structure
  34. Associations
  35. Natural Language Understanding
  36. Creating Websites and Apps
  37. Layout and Display
  38. Assigning Names to Things
  39. Immediate and Delayed Values
  40. Defining Your Own Functions
  41. More About Patterns
  42. String Patterns and Templates
  43. Storing Things
  44. Importing and Exporting (7:00)
    • Import web text, web links, web images
    • $ImportFormats, $ExportFormats
    • Import, LanguageIdentify, StringSplit, NestGraph, SocialMediaData, WebImageSearch, ResourceData, SendMail, Export
  45. Datasets (9:22)
  46. Writing Good Code
  47. Debugging Your Code