Mathematica एउटा प्रोग्रामिंग सफ्टवेयर हो, यो एक CUI (Character User Interface क्यारेक्टर यूजर इन्टरफेस) मा आधारित प्रोग्रामिङ सफ्टवेयर हो, जसले गणित शिक्षाको लागि डिजिटल यन्त्र को रुपमा काम गर्छ। यसले गणितीय तथ्यलाई गणना गर्न र दृश्यमा देखाउन मद्दत गर्दछ। यो सफ्टवेयर सिक्नको लागी सकेसम्म धेरै उदाहरणहरू र समस्याहरू समाधानको प्रयास गर्नु पर्छ। Mathematica मा कम्प्युटेशनल इन्जिनको भन्ने कर्नेल हुन्छ जसले पृष्ठभूमिमा काम गर्दछ। हामिले इनपुट मार्फत दिएको निर्देशनहरूले कर्नेलसँग काम गर्दछ जवाफको रुपमा र संख्याहरू, ग्राफहरू, म्याट्रिक्सहरू, र अन्य गणितिय तथ्यहरुको प्रदर्शन गर्दछ् । जब हामीले Mathematica सफ्टवेयर खोल्छौं, हामी इनपुट स्क्रिन देख्छौ र यो स्क्रिनलाई नोटबुक भनिन्छ। यो नोटबुक प्रयोगकर्ता र कर्नेल बीचको इन्टरफेस हो। यसलाई फ्रन्ट एन्ड पनि भनिन्छ।
Mathematica Wolfram Language मा लेखिएको प्रोग्रामिंग सफ्टवेयर हो। Wolfram Language एउटा कम्प्युटर भाषा हो। कम्प्युटरमा धेरै भाषाहरू छन्, जस्तै C++, Java, Python र JavaScript। त्यस्तै Wolfram Language पनि ज्ञानमा आधारित एउटा भाषा हो जसले चाहेको कुरा वर्णन गर्न र प्रोग्रामिंग लाऐ सकेसम्म सजिलो बनाउने प्रयास गरेको छ। Wolfram Language प्रयोग गरेर कम्प्युटरमा कसरी communication गर्ने भनेर सिक्न सकिने छ। Wolfram Language को प्रयोग गरेर गणितिय तथ्यहरुलाई दृश्य, पाठ्य, वा अन्तरक्रियात्मक वस्तु बनाउन सक्नुहुन्छ , प्रोग्रामहरू लेख्न Wolfram Language कसरी प्रयोग गर्ने भनेर सिक्नुहुनेछ।
Wolfram Language इनपुट प्रविष्ट गरेपछि, सामान्यतया Shift+Enter वा Shift+Return key थिच्नुपर्छ यसपछि, तुरुन्तै यसको आउटपुट गणना हुन्छ।
Day 1 # Mathematica
Resources👉 Click Here
Resources and Exercise
Do the activities as shown below number-wise
- Sign in into https://www.wolframcloud.com/;(if you have no account, create your account and login
- Click on five minutes hands-on introduction ;https://www.wolframcloud.com/env/cloud-content/FirstFiveMinutes.nb#sidebar=none;Do the activities as shown in the screen
- Watch 1 minute video on USING NOTEBOOK
#********************************************#
तल दिएका क्रियाकलापहरुलाई क्रम अनुसार गर्नुहोस
- https://www.wolframcloud.com/; मा साईन इन गर्नुहोस (Wolfram Cloud मा खाता खोल्नु भएको छैन भने, Wolfram Cloud मा खाता खोल्नुहोस र साईन इन गर्नुहोस)
- ;https://www.wolframcloud.com/env/cloud-content/FirstFiveMinutes.nb#sidebar=none; Five minutes hands-on introduction मा click गर्नुहोस। Screen मा देखाईएका activities हरु गर्नुहोस
- 1 minute video on USING NOTEBOOK लाई राम्ररी हेर्नुहोस
Mathematica Basics Rules
- All commands starts with Capital Letter
For example: Graphics, PointSize, GridLines, Axes, True, Sin..
- The argument of the function is always enclosed by [ ... ]
For example: Sin[x], f[x], .....
- The range of function is always enclosed by {...}
For example: {1,2,3}, {x,-3,3}, {y,-Pi,Pi}
- The "Enter" key results with new line
The "Shift+Enter" key results with output
- For any help, always use "Documentation Center"
- Use "semicolon ;" to suppress the output
Basics Typesetting
Symbol Keyboard input
1 → ->
Day 2 # Mathematica
Resources👉 Click Here
Resources and Exercise
How to open Mathematica Notebook
1. Click on window button
2. Search for Mathematica (Do not use Mathematica Kernel)
3. Click on the Mathematica programme
4. Click on file menu
5. Click on New menu
6. Click on Notebook(.nb) menu (a new Mathematica notebook will open)
Vocabulary: Elementary Arithmetic
2+2 addition
5-2 subtraction
2*3 multiplication (2 3 also works)
6/2 division
3^2 raising to a power (e.g. squaring)
Exercise: Elementary Arithmetic
1.1 Compute 1+2+3. Write syntax and press Shift+Enter Key
1+2+3
or
Plus[1,2,3]
1.2 Add the numbers 1, 2, 3, 4, 5. Write syntax and press Shift+Enter Key
1+2+3+4+5
or
Plus[1,2,3,4,5]
1.3 Multiply the numbers 1, 2, 3, 4, 5.Write syntax and press Shift+Enter Key
1 2 3 4 5
or
1*2*3*4*5
or
Times[1,2,3,4,5]
1.4 Compute 5 squared .Write syntax and press Shift+Enter Key
5 5
or
5*5
or
Power[5,2]
1.5 Compute 3 raised to the fourth power.
3^4
1.6 Compute 10 raised to the power 12 .
10^12
1.7 Compute 3 raised to the power 7×8.
3^(7 8)
1.8 Add parentheses to 4-2*3+4 to make 14.
(4-2)*(3+4)
1.9 Compute twenty-nine thousand multiplied by seventy-three.
29000 x 73
+1.1 Add all integers from -3 to +3.
Total[Range[-3,3]]
+1.2 Compute 24 divided by 3.
45/2
+1.3 Compute 5 raised to the power 100.
5^(100)
+1.4 Subtract 5 squared from 100.
100-5^2
+1.5 Multiply 6 by 5 squared, and add 7.
6*5^2+7
+1.6 Compute 3 squared minus 2 cubed.
3^2-2^3
+1.7 Compute 2 cubed times 3 squared.
2^3*3^2
+1.8 Compute “double the sum of eight and negative eleven”.
2*((8+(-11))
Vocabulary: Introducing Function
Plus[2,2] 2+2 addition
Subtract[5,2] 5-2 subtraction
Times[2,3] 2*3 multiplication (2 3 also works)
Divide[6,2] 6/2 division
Power[3,2] 3^2 raising to a power
Max[3,4] maximum (largest)
Min[3,4] minimum (smallest)
RandomInteger[10] random whole number
Exercise: Introducing Function
2.1 Compute 7+6+5 using the function Plus.
Plus[7,6,5]
2.2 Compute 2×(3+4) using Times and Plus.
Times[ Plus[3,4],2]
2.3 Use Max to find the larger of 6×8 and 5×9.
Max[Times[6,8],Times[5,9]]
2.4 Use RandomInteger to generate a random number between 0 and 1000.
RandomInteger[1000]
2.5 Use Plus and RandomInteger to generate a number between 10 and 20.
Plus[RandomInteger[10],10]
+2.1 Compute 5×4×3×2 using Times.
Times[5,4,3,2]
+2.2 Compute 2−3 using Subtract.
Subtract[2,3]
+2.3 Compute (8+7)*(9+2) using Times and Plus.
Times[Plus[8,7],Plus[9,2]]
+2.4 Compute (26−89)/9 using Subtract and Divide.
+2.5 Compute 100−5^2 using Subtract and Power.
+2.6 Find the larger of 3^5 and 5^3.
+2.7 Multiply 3 and the larger of 4^3 and 3^4.
+2.8 Add two random numbers each between 0 and 1000.
Vocabulary: List Function
{1,2,3,4} list of elements
ListPlot[{1,2,3,4}] plot a list of numbers
Range[10] range of numbers
Reverse[{1,2,3}] reverse a list
Join[{4,5,6},{2,3,2}] join lists together
Exercise: List Function
3.1 Use Range to create the list {1, 2, 3, 4}.
Range[4]
3.2 Make a list of numbers up to 100.
Range[100]
3.3 Use Range and Reverse to create {4, 3, 2, 1}.
Reverse[Range[4]]
3.4 Make a list of numbers from 1 to 50 in reverse order.
Reverse[Range[50]]
3.5 Use Range, Reverse and Join to create {1, 2, 3, 4, 4, 3, 2, 1}.
Join[Range[4],Reverse[Range[4]]]
3.6 Plot a list that counts up from 1 to 100, then down to 1.
ListPlot[Join[Range[100],Reverse[Range[100]]]]
3.7 Use Range and RandomInteger to make a list with a random length up to 10.
Range[RandomInteger[10]]
3.8 Find a simpler form for Reverse[Reverse[Range[10]]].
Range[10]
3.9 Find a simpler form for Join[{1, 2}, Join[{3, 4}, {5}]].
Join[{1,2},{3,4},{5}]
3.10 Find a simpler form for Join[Range[10], Join[Range[10], Range[5]]].
Join[Range[10],Range[10],Range[5]]
3.11 Find a simpler form for Reverse[Join[Range[20], Reverse[Range[20]]]].
Join[Range[20],Reverse[Range[20]]]
+3.1 Compute the reverse of the reverse of {1, 2, 3, 4}.
+3.2 Use Range, Reverse and Join to create the list {1, 2, 3, 4, 5, 4, 3, 2, 1}.
+3.3 Use Range, Reverse and Join to create {3, 2, 1, 4, 3, 2, 1, 5, 4, 3, 2, 1}.
+3.4 Plot the list of numbers {10, 11, 12, 13, 14}.
+3.5 Find a simpler form for Join[Join[Range[10], Reverse[Range[10]]], Range[10]].
Vocabulary: Disply using List
ListLinePlot[{1,2,5}] values joined by a line
BarChart[{1,2,5}] bar chart (values give bar heights)
PieChart[{1,2,5}] pie chart (values give wedge sizes)
NumberLinePlot[{1,2,5}] numbers arranged on a line
Column[{1,2,5}] elements displayed in a column
Vocabulary: Display using List
4.1 Make a bar chart of {1, 1, 2, 3, 5}.
BarChart[{1,1,2,3,5}]
4.2 Make a pie chart of numbers from 1 to 10.
PieChart[Range[10]]
4.3 Make a bar chart of numbers counting down from 20 to 1.
BarChart[Reverse[Range[20]]]
4.4 Display numbers from 1 to 5 in a column.
Display numbers from 1 to 5 in a column.
4.5 Make a number line plot of the squares {1, 4, 9, 16, 25}.
NumberLinePlot[Range[5]^2]
4.6 Make a pie chart with 10 identical segments, each of size 1.
PieChart[Table[1,10]]
4.7 Make a column of pie charts with 1, 2 and 3 identical segments.
Column[{PieChart[{1}],PieChart[{1,1}],PieChart[{1,1,1}]}]
+4.1 Make a list of pie charts with 1, 2 and 3 identical segments.
+4.2 Make a bar chart of the sequence 1, 2, 3, ..., 9, 10, 9, 8, 7, ..., 1.
+4.3 Make a list of a pie chart, bar chart and line plot of the numbers from 1 to 10.
+4.4 Make a list of a pie chart and a bar chart of {1, 1, 2, 3, 5, 8, 13, 21, 34, 55}.
+4.5 Make a column of two number line plots of {1, 2, 3, 4, 5}.
+4.6 Make a number line of fractions 1/2, 1/3, ... through 1/9.
Vocabulary: Operation on List
{2,3,4}+{5,6,2} arithmetic on lists
Sort[{5,7,1}] sort a list into order
Length[{3,3}] length of a list (number of elements)
Total[{1,1,2}] total of all elements in a list
Count[{3,2,3},3] count occurrences of an element
First[{2,3}] first element in a list
Last[{6,7,8}] last element in a list
Part[{3,1,4},2] particular part of a list, also written as {3, 1, 4}[[2]]
Take[{6,4,3,1},2] take elements from the beginning of a list
Drop[{6,4,3,1},2] drop elements from the beginning of a list
IntegerDigits[1234] list of digits in a number
Exercise: Operation on List
5.1 Make a list of the first 10 squares, in reverse order.
Reverse[Range[10]^2]
5.2 Find the total of the first 10 squares.
Total[Range[10]^2]
5.3 Make a plot of the first 10 squares, starting at 1.
ListPlot[Range[10]^2]
5.4 Use Sort, Join and Range to create {1, 1, 2, 2, 3, 3, 4, 4}.
Sort[Join[Range[4],Range[4]]]
5.5 Use Range and + to make a list of numbers from 10 to 20, inclusive.
Range[11]+9
5.6 Make a combined list of the first 5 squares and cubes, sorted into order.
Sort[Join[Range[5]^2,Range[5]^3]]
5.7 Find the number of digits in 2^128.
Length[IntegerDigits[2^128]]
5.8 Find the first digit of 2^32.
IntegerDigits[2^32][[1]]
5.9 Find the first 10 digits in 2^100.
Take[IntegerDigits[2^100],10]
5.10 Find the largest digit that appears in 2^20.
Max[IntegerDigits[2^20]]
5.11 Find how many zeros appear in the digits of 2^1000.
Count[IntegerDigits[2^1000],0]
5.12 Use Part, Sort and IntegerDigits to find the second-smallest digit in 2^20.
Sort[IntegerDigits[2^20]]
5.13 Make a line plot of the sequence of digits that appear in 2^128.
ListLinePlot[IntegerDigits[2^128]]
5.14 Use Take and Drop to get the sequence 11 through 20 from Range[100].
Drop[Take[Range[100],20],10]
+5.1 Make a list of the first 10 multiples of 3.
Range[10]*3
+5.2 Make a list of the first 10 squares using only Range and Times.
Times[Range[10],Range[10]]
+5.3 Find the last digit of 2^37.
Last[IntegerDigits[2^37]]
+5.4 Find the second-to-last digit of 2^32.
IntegerDigits[2^32][[-2]]
+5.5 Find the sum of all the digits of 3^126.
Total[IntegerDigits[3^126]]
+5.6 Make a pie chart of the sequence of digits that appear in 2^32.
PieChart[IntegerDigits[2^32]]
+5.7 Make a list of pie charts for the sequence of digits in 2^20, 2^40, 2^60.
List[PieChart[IntegerDigits[2^20]],PieChart[IntegerDigits[2^40]],PieChart[IntegerDigits[2^60]]]
Vocabulary: Tables
Table[x,5] list of 5 copies of x
Table[f[n],{n,10}] list of values of f[n] with n going up to 10
Table[f[n],{n,2,10}] list of values with n going from 2 to 10
Table[f[n],{n,2,10,4}] list of values with n going from 2 to 10 in steps of 4
Range[5,10] list of numbers from 5 to 10
Range[10,20,2] list of numbers from 10 to 20 in steps of 2
RandomInteger[10,20] list of 20 random integers up to 10
Exercise: Tables
6.1 Make a list in which the number 1000 is repeated 5 times.
Table[1000,5]
6.2 Make a table of the values of n^3 for n from 10 to 20.
Table[n^3,{n,10,20}]
6.3 Make a number line plot of the first 20 squares.
NumberLinePlot[Table[n^2,{n,20}]]
6.4 Make a list of the even numbers (2, 4, 6, ...) up to 20.
Table[2 n,{n,1,10}]
6.5 Use Table to get the same result as Range[10].
Table[n,{n,1,10}]
6.6 Make a bar chart of the first 10 squares.
BarChart[Table[n^2,{n,1,10}]]
6.7 Make a table of lists of digits for the first 10 squares.
Table[IntegerDigits[n^2],{n,1,10}]
6.8 Make a list line plot of the length of the sequence of digits for each of the first 100 squares.
ListLinePlot[Table[Length[IntegerDigits[n^2]],{n,1,100}]]
6.9 Make a table of the first digit of the first 20 squares.
Table[First[IntegerDigits[n^2]],{n,1,20}]
6.10 Make a list line plot of the first digits of the first 100 squares.
ListLinePlot[Table[First[IntegerDigits[n^2]],{n,1,100}]]
+6.1 Make a list of the differences between n^3 and n^2 with n up to 10.
Table[n^3-n^2,{n,1,10}]
+6.2 Make a list of the odd numbers (1, 3, 5, ...) up to 100.
Table[2 n-1,{n,1,50}]
+6.3 Make a list of the squares of even numbers up to 100.
Table[(2 n)^2,{n,1,50}]
+6.4 Create the list {-3, -2, -1, 0, 1, 2} using Range.
Range[-3,2]
+6.5 Make a list for numbers n up to 20 in which each element is a column of the values of n, n^2 and n^3.
Table[Column[{n,n^2,n^3}],{n,1,20}]
+6.6 Make a list line plot of the last digits of the first 100 squares.
ListLinePlot[Table[Last[IntegerDigits[n^2]],{n,1,100}]]
+6.7 Make a list line plot of the first digit of the first 100 multiples of 3.
ListLinePlot[Table[First[IntegerDigits[3 n]],{n,1,100}]]
+6.8 Make a list line plot of the total of the digits for each number up to 200.
ListLinePlot[Table[Total[IntegerDigits[n]],{n,1,200}]]
+6.9 Make a list line plot of the total of the digits for each of the first 100 squares.
ListLinePlot[Table[Total[IntegerDigits[n^2]],{n,1,100}]]
+6.10 Make a number line plot of the numbers 1/n with n from 1 to 20.
NumberLinePlot[Table[1/n,{n,1,20}]]
+6.11 Make a line plot of a list of 100 random integers where the nth integer is between 0 and n.
ListLinePlot[Table[RandomInteger[n],{n,1,100}]]
Day 3 # Mathematica
Resources👉 Click Here
Resources and Exercise
Vocabulary: Basic Graphics Objects
Circle[ ] specify a circle
Disk[ ] specify a filled‐in disk
RegularPolygon[n] specify a regular polygon with n sides
Graphics[object] display an object as graphics
Sphere[ ], Cylinder[ ], Cone[ ], ... specify 3D geometric shapes
Graphics3D[object] display an object as 3D graphics
Exercise: Basic Graphics Objects
8.1 Use RegularPolygon to draw a triangle.
Graphics[RegularPolygon[3]]
8.2 Make graphics of a red circle.
Graphics[{Red,Circle[]}]
8.3 Make a red octagon.
Graphics[{Red,RegularPolygon[8]}]
8.4 Make a list whose elements are disks with hues varying from 0 to 1 in steps of 0.1.
Table[Graphics[{Hue[i],Disk[]}],{i,0,1,0.1}]
8.5 Make a column of a red and a green triangle.
Column[Table[Graphics[{i,RegularPolygon[3]}],{i,{Red,Green}}]]
8.6 Make a list giving the regular polygons with 5 through 10 sides, with each polygon being colored pink.
Table[Graphics[{Pink,RegularPolygon[n]}],{n,5,10}]
8.7 Make a graphic of a purple cylinder.
Graphics3D[{Purple,Cylinder[]}]
8.8 Make a list of polygons with 8, 7, 6, ... , 3 sides, and colored with RandomColor, then show them all overlaid with the triangle on top (hint: apply Graphics to the list).
Graphics[Table[{RandomColor[],RegularPolygon[n]},{n,8,3,-1}]]
+8.1 Make a list of 10 regular pentagons with random colors.
Table[Graphics[{RandomColor[],RegularPolygon[5]}],10]
+8.2 Make a list of a 20-sided regular polygon and a disk.
List[Graphics[RegularPolygon[20]],Graphics[Disk[]]]
+8.3 Make a list of polygons with 10, 9, ... , 3 sides.
Table[Graphics[RegularPolygon[n]],{n,10,3,-1}]
Vocabulary: Interactive Manipulation
Manipulate[anything,{n,0,10,1}] manipulate anything with n varying in steps of 1
Manipulate[anything,{x,0,10}] manipulate anything with x varying continuously
Exercise: Interactive Manipulation
9.1 Make a Manipulate to show Range[n] with n varying from 0 to 100.
Manipulate[Range[n],{n,0,100}]
9.2 Make a Manipulate to plot the whole numbers up to n, where n can range from 5 to 50.
Manipulate[ListPlot[Range[n]],{n,5,50,1}]
9.3 Make a Manipulate to show a column of between 1 and 10 copies of x.
Manipulate[Column[Table[x,n]],{n,1,10}]
9.4 Make a Manipulate to show a disk with a hue varying from 0 to 1.
Manipulate[Graphics[Style[Disk[],Hue[h]]],{h,0,1}]
9.5 Make a Manipulate to show a disk with red, green and blue color components varying from 0 to 1.
Manipulate[Graphics[Style[Disk[],RGBcolor[red,green,blue]]],{red,0,1},{green,0,1},{blue,0,1}]
9.6 Make a Manipulate to show digit sequences of 4-digit integers (between 1000 and 9999).
Manipulate[IntegerDigits[n],{n,1000,9999,1}]
9.7 Make a Manipulate to create a list of between 5 and 50 equally spaced hues.
Manipulate[ Table[Hue[i/n], {i, 0, n - 1}], {n, 5, 50, 1}]
9.8 Make a Manipulate that shows a list of a variable number of hexagons (between 1 and 10), and with variable hues.
Manipulate[Table[Graphics[Style[RegularPolygon[6],Hue[h]]],n],{n,1,10},{h,0,1,1/n}]
9.9 Make a Manipulate that lets you show a regular polygon with between 5 and 20 sides, in red, yellow or blue.
Manipulate[Graphics[{c,RegularPolygon[n]}],{n,5,20,1},{c,{Red, Yellow,Blue}}]
9.10 Make a Manipulate that shows a pie chart with a number of equal segments varying from 1 to 10.
Manipulate[Graphics[PieChart[Table[1,n]]],{n,1,10}]
9.11 Make a Manipulate that gives a bar chart of the 3 digits in integers from 100 to 999.
Manipulate[BarChart[IntegerDigits[n]],{n,100,999,1}]
9.12 Make a Manipulate that shows n random colors, where n can range from 1 to 50.
Manipulate[RandomColor[n],{n,1,50,1}]
9.13 Make a Manipulate to display a column of integer powers with bases from 1 to 25 and exponents from 1 to 10.
Manipulate[Column[Table[a^k,{k,1,n,1}]],{n,1,10,1},{a,1,25,1}]
9.14 Make a Manipulate of a number line of values of x^n for integer x from 1 to 10, with n varying from 0 to 5.
Manipulate[NumberLinePlot[Range[10]^n],{n,0,5,1}]
9.15 Make a Manipulate to show a sphere that can vary in color from green to red.
Manipulate[Graphics3D[{Hue[n],Sphere[]}],{n,0.33,1}]
+9.1 Make a Manipulate to plot numbers from 1 to 100 raised to powers that can vary between −1 and +1.
Manipulate[ListPlot[Range[100]^n],{n,-1,1,1}]
+9.2 Make a Manipulate to display 1000 at sizes between 5 and 100.
Manipulate[Style["1000",n],{n,5,100,1}]
+9.3 Make a Manipulate to show a bar chart with 4 bars, each with a height that can be between 0 and 10.
Vocabulary: Coordinates and Graphics
Point[{x,y}] a point at coordinates {x, y}
Line[{{1,1},{2,4},{1,2}}] a line connecting specified coordinates
Circle[{x,y}] a circle with center at {x, y}
Circle[{x,y},r] a circle with center at {x, y} and radius r
RegularPolygon[{x,y},s,n] a regular polygon with center {x, y} and n sides each s long
Polygon[{{1,1},{2,4},{1,2}}] a polygon with the specified corners
Sphere[{x,y,z}] a sphere with center at {x, y, z}
Sphere[{x,y,z},r] a sphere with center at {x, y, z} and radius r
Opacity[level] specify an opacity level (0: transparent; 1: solid)
Exercise: Coordinates and Graphics
14.1 Make graphics of 5 concentric circles centered at {0, 0} with radii 1, 2, ... , 5.
Graphics[Table[Circle[{0,0},r],{r,5}]]
14.2 Make 10 concentric circles with random colors.
Graphics[Table[{RandomColor[],Circle[{0,0},r]},{r,10}]]
14.3 Make graphics of a 10×10 grid of circles with radius 1 centered at integer points {x, y}.
Graphics[Table[Circle[{x,y}],{x,1,10},{y,1,10}]]
14.4 Make a 10×10 grid of points with coordinates at integer positions up to 10.
Graphics[Table[Point[{x,y}],{x,1,10},{y,1,10}]]
14.5 Make a Manipulate with between 1 and 20 concentric circles.
Manipulate[Graphics[Table[Circle[{0,0},r],{r,1,n}]],{n,1,20}]
14.6 Place 50 spheres with random colors at random integer coordinates up to 10.
Graphics3D[Table[{RandomColor[],Sphere[RandomInteger[10,3]]},50]]
14.7 Make a 10×10×10 array of spheres with RGB components ranging from 0 to 1. The spheres should be centered at integer coordinates, and should just touch each other. The RGB components of each sphere should be in direct proportion to the x,y,z components of that sphere's center.
Graphics3D[ Table[Style[Sphere[{x, y, z}, 0.5], RGBColor[x/10, y/10, z/10]], {x,10}, {y,10}, {z, 10}]]
14.8 Make a Manipulate with t varying between −2 and +2 that contains circles of radius x centered at {t*x, 0} with x going from 1 to 10.
Manipulate[Graphics[Table[Circle[{t*x,0},x],{x,1,10,1}]],{t,-2,2}]
14.9 Make a 5×5 array of regular hexagons with size 1/2, centered at integer points.
Graphics[Table[RegularPolygon[{x,y},1/2,6],{x,5},{y,5}]]
14.10 Make a line in 3D that goes through 50 random points with integer coordinates randomly chosen up to 50.
Graphics3D[Line[Table[RandomInteger[50,3],50]]]
+14.1 Make a Manipulate to create an n×n regular grid of points at integer positions, with n going from 5 to 20.
Manipulate[Graphics[Table[Point[{x,y}],{x,1,n},{y,1,n}]],{n,5,20}]
+14.2 Place 30 radius-1 circles with random colors at random integer coordinates up to 10.
Graphics[Table[{RandomColor[],Circle[RandomInteger[10,2],1]},30]]
+14.3 Display 100 polygons with side length 10, opacity .5, and random choices of colors, sides between 3 and 8, and integer coordinates up to 100.
Graphics[Table[Style[RegularPolygon[RandomInteger[100,2],10,RandomInteger[{3,8}]],RandomColor[],Opacity[0.5]],100]]
+14.4 Make a 10×10×10 array of points in 3D, with each point having a random color.
Graphics3D[Table[{RandomColor[],Point[{x,y,z}]},{x,10},{y,10},{z,10}]]
+14.5 Take the first two digits of numbers from 10 to 100 and draw a line that uses them as coordinates.
Graphics[Line[Table[Take[IntegerDigits[x],2],{x,10,100,1}]]]
+14.6 Take the first 3 digits of numbers from 100 to 1000 and draw a line in 3D that uses them as coordinates.
Graphics3D[Line[Table[Take[IntegerDigits[x],3],{x,100,1000,1}]]]
Day 4 # 2D and 3D Graphics in Mathematica
Resources👉 Click Here
Question 1
Plot a function f(x)=Sin(2x)+Sin(x^2) in Mathematica within range 0 to Pi and show its (a) zeros in red color, (b) extreme points in black color.
Use the command
1. Plot
2. MeshFunction
3. MeshStyle
4. Evaluate
5. Derivative
Question 2
Plot a function f(x)=(10 x y)/(2x^2+3y^2) within range -3 to 3 and show its limit behavior (a) x->y, (b) x->-y (c) x->0, (d) x->2y
Use the command
1. Table
2. Plot3D
3. RegionFunction
4. Limit
Day 5 # Probability and Statistics in Mathematica
Resources👉 Click Here
Question 1
Plot a normal distribution probability function in Mathematica within range -3 to 3 and taking its (a) mean -0.5,0,0.5 (b) standard deviation 0.5,1,1.5,2.
Use the command
1. Plot
2. PDF
3. NormalDistribution
4. Manipulate
Question 2
Compute Mean, Median, Standrad deviation, Kurtosis and skewnwss from a data set of 10 randomly genenerated integer between 10 and 50.
Use the command
1. Mean
2. Median
3. StandardDeviation
4. Kurtosis
5. Skewness
6. RandomInteger
Mathematica Advance
TNB frame
r[t_] := {t Sin[t], t Cos[t], t};
uT[r_][t_] := Normalize[r'[t]];
uN[r_][t_] := Normalize[r''[t]];
uB[r_][t_] := uT[r][t]\[Cross]uN[r][t];
Manipulate[Show[
ParametricPlot3D[r[t], {t, -Pi, Pi}, BoxRatios -> {1, 1, 1},
PlotRange -> {{-4, 4}, {-4, 4}, {-4, 4}}],
Graphics3D[{Red, Arrow[{r[t0], r[t0] + 2 uT[r][t0]}]}],
Graphics3D[{Green, Arrow[{r[t0], r[t0] + 2 uN[r][t0]}]}],
Graphics3D[{Blue, Arrow[{r[t0], r[t0] + 2 uB[r][t0]}]}]
], {t0, -Pi, Pi}]
Osculating Circle 2D
r[t_] := {t Cos[t], t Sin[t]};
uT[r_][t_] := Normalize[r'[t]];
uN[r_][t_] := {-uT[r][t][[2]], uT[r][t][[1]]};
rho[r_][t_] :=
Norm[r'[t]]^3/(r'[t][[1]]*r''[t][[2]] - r'[t][[2]]*r''[t][[1]]);
Manipulate[
Show[ParametricPlot[r[t], {t, -Pi, Pi},
PlotRange -> {{-4, 4}, {-4, 4}}],
ParametricPlot[{
r[t][[1]] + rho[r][t]*uN[r][t][[1]] + rho[r][t]*Cos[u],
r[t][[2]] + rho[r][t]*uN[r][t][[2]] + rho[r][t]*Sin[u]
}, {u, 0, 2 Pi}, PlotStyle -> Red]],
{t, -2.5, 2.5}]
Osculating Circle 3D
r[t_] := {t Sin[t], t Cos[t], t};
uT[r_][t_] := Normalize[r'[t]];
uN[r_][t_] := Normalize[r''[t]];
uB[r_][t_] := uT[r][t]\[Cross]uN[r][t];
rho[r_][t_] := Norm[r'[t]]^3/Norm[r'[t]\[Cross]r''[t]];
sig[r_][t_] := (r'[t].r''[t]\[Cross]r'''[t])/
Norm[r'[t]\[Cross]r''[t]]^2;
Manipulate[Show[
ParametricPlot3D[r[t], {t, -Pi, Pi}, BoxRatios -> {1, 1, 1},
PlotRange -> {{-4, 4}, {-4, 4}, {-4, 4}}],
ParametricPlot3D[
{
r[t][[1]] + rho[r][t]*uN[r][t][[1]] +
rho[r][t] (Cos[u]*uT[r][t][[1]] + Sin[u]*uN[r][t][[1]]),
r[t][[2]] + rho[r][t]*uN[r][t][[2]] +
rho[r][t] (Cos[u]*uT[r][t][[2]] + Sin[u]*uN[r][t][[2]]),
r[t][[3]] + rho[r][t]*uN[r][t][[3]] +
rho[r][t] (Cos[u]*uT[r][t][[3]] + Sin[u]*uN[r][t][[3]])
}
, {u, 0, 2 Pi}, PlotStyle -> Red]
],
{t, -2.5, 2.5}]
Osculating Sphere
r[t_] := {t Sin[t], t Cos[t], t};
uT[r_][t_] := Normalize[r'[t]];
uN[r_][t_] := Normalize[r''[t]];
uB[r_][t_] := uT[r][t]\[Cross]uN[r][t];
rho[r_][t_] :=
Sqrt[r'[t].r'[t]]^3/
Sqrt[Cross[r'[t], r''[t]].Cross[r'[t], r''[t]]];
sig[r_][t_] := (Cross[r'[t], r''[t]].Cross[r'[t], r''[t]])/
Dot[Cross[r'[t], r''[t]], r'''[t]];
c[r_][t_] :=
r[t] + rho[r][t]* uN[r][t] + sig[r][t]*rho[r]'[t]*uB[r][t];
a[r_][t_] := Sqrt[(rho[r][t])^2 + (sig[r][t]*rho[r]'[t])^2];
Manipulate[Show[Graphics3D[Sphere[{c[r][t]}, a[r][t]]],
ParametricPlot3D[r[t], {t, -6, 6}],
PlotRange -> {{-6, 6}, {-6, 6}, {-10, 10}}], {{t, -2}, -2, 2}]
Berrand Curve 2D
c1[t_] := { t Cos[t] , t Sin[t]};
b1[t_] := c1[t] + (4)*Normalize[c1''[t]];
ParametricPlot[{c1[t], b1[t]}, {t, -Pi, Pi}]
c2[t_] := { t Cos[t] , t Sin[t]};
b2[t_] := c2[t] + (4)*Normalize[c2''[t]];
ParametricPlot[{c2[t], b2[t]}, {t, -Pi, Pi},
Epilog ->
Table[{Orange, Line[{c2[t0], b2[t0]}]}, {t0, -Pi, Pi, 0.2}]]
c3[t_] := { t Cos[t] , t Sin[t]};
b3[t_] := c3[t] + (4)*Normalize[c3''[t]];
Manipulate[Show[
ParametricPlot[{c3[t], b3[t]}, {t, -Pi, Pi},
PlotStyle -> {Red, Blue}, PlotRange -> {{-4, 4}, {-4, 4}},
AspectRatio -> 1],
Graphics[Arrow[{c3[t0], b3[t0]}]]], {t0, -Pi, Pi}]
Berrand Curve 3D
r[t_] := { t Cos[t] , t Sin[t], t};
r1[t_] := r[t] + (5)*Normalize[r''[t]];
un[t_] := Normalize[r''[t]];
ut[t_] := Normalize[r'[t]];
ub[t_] := Normalize[Cross[ut[t], un[t]]];
Manipulate[Show[
ParametricPlot3D[{r[t], r1[t]}, {t, -Pi, Pi}],
Graphics3D[{Red, Arrow[{r[t0], r[t0] + 5 un[t0]}]}]
], {t0, -Pi, Pi}]
Involute
r[t_] := { Cos[t] , 2 Sin[t]};
ut[t_] := Normalize[r'[t]];
r1[t_] := r[t] + (0 - t)*ut[t];
Manipulate[
Show[ParametricPlot[{r[t], r1[t]}, {t, 0, 2 Pi}, PlotRange -> Full,
PlotStyle -> {Blue, Red}, PlotRange -> Full,
Epilog -> {Orange, Arrow[{r[t0], r1[t0]}]}],
Graphics[{Orange, PointSize[Large], Point[r[t0]],
Point[r1[t0]]}]], {t0, 0, 2 Pi}]
FullSimplify[r1[t], Assumptions -> {Trig -> True, t \[Element] Reals}]
r[t_] := {Cos[t] , 2 Sin[t]};
ut[t_] := Normalize[r'[t]];
r1[t_] :=
r[t] + (0 - t)*ut[t]; ParametricPlot[{r[t], r1[t]}, {t, 0.1, 2 Pi},
Epilog ->
Table[{Orange, Line[{r[t0], r1[t0]}]}, {t0, 0.1, 2 Pi, 0.1}]]
Evolute
r[t_] := {t Cos[t], t Sin[t]}
ut[t_] := Normalize[r'[t]];
un[t_] := Normalize[r''[t]];
rho[t_] :=
Sqrt[r'[t].r'[t]]^3/
Sqrt[r'[t][[1]]*r''[t][[2]] - r'[t][[2]]*r''[t][[1]]];
r1[t_] := r[t] + rho[t]*un[t];
ParametricPlot[{r[t], r1[t]}, {t, 0.1, Pi}]
No comments:
Post a Comment