Python/C2/Getting-started-with-symbolics/Gujarati
From Script | Spoken-Tutorial
Revision as of 15:49, 23 October 2013 by Jyotisolanki (Talk | contribs)
Timing | Narration |
---|---|
0:02 | નમસ્કાર મિત્"Symbolics with Sage"પરનાં આ સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે. |
0:07 | આ ટ્યુટોરીયલની અંતમાં, તમે આપેલ વિશે સમર્થ હશો,
|
0:24 | આ ટ્યુટોરીયલ શરુ કરીએ તે પહેલા અમે તમને "Getting started with sage notebook" પૂર્ણ કરવા માટે આગ્રહ કરીએ છે. |
0:31 | બીજી વસ્તુઓના સાથે સાથેજ,Sageસાંકેતિક ગણિત પણ કરી શકે છે અને ઘણી બધી આપણે સેજ માં symbolic expressionsવ્યખિત કરવા સાથે શરૂઆત કરીશું. |
0:42 | તમારી Sage book ખુલ્લી રાખો. |
0:44 | જો નથી તો વિડીયો ને અટકાવો અને તમારી Sage book ચાલુ રાખો. |
0:49 | નોટબૂક માં ટાઈપ કરો sine y . |
1:08 | ત્યાર બાદshift enterદબાવો. |
1:12 | તે એક નામ એરર ઉત્પન કરે છે જે દર્શાવે che Yને વ્યાખિત કરાયુ નથી. |
1:14 | આપણને Y ને symbol તરીકે જાહેર કરવાની જરૂર છે. |
1:17 | આપણે તે varફન્કશન મદદ વડે કરીએ છે. |
1:19 | તો કૌંસમાં ટાઈપ કરો var અને એકલ અવતરણમાં Y |
1:28 | હવે જો તમે ટાઈપ કરો છો sinકૌંસમાં y,સામન્ય રીતે sageએક expression પાછુ આપે છે. |
1:32 | તો ટાઈપ કરો sin y |
1:37 | હવે સેજ sin of yને symbolic expression તરીકે વર્તે છે. |
1:42 | આપણે આને સેજ ના built-in constants અને expressions ના સિમ્બોલિક મેથ કરવા માટે વાપરી શકીએ છે. |
1:47 | ચાલો અમુક ઉદાહરણો નો પ્રયાસ કરીએ. |
1:50 | તો ચાલો ટાઈપ કરો varકૌંસમાં એકલ અવતરણમાં xઅલ્પવિરામ આલ્ફા અલ્પવિરામ y અલ્પવિરામ બીટા. |
1:59 | ત્યારબાદ પછીની લાઈન માં તમે ટાઈપ કરી શકો છો x charat 2 by alpha charat 2 plus y charat 2 by beta charat 2 |
2:10 | જે x squared by alpha squared plus y squared by beta squared છે. |
2:17 | અમે ચાર વેરીએબલો વ્યાખિત કર્યા છે.x,y, alphaઅને betaઅને તેમને વાપરીને symbolic expression વ્યાખિત કરી છે. |
2:25 | thetaમાં expression આ રહી. |
2:29 | તો તમે ટાઇપ કરી શકો છો કૌંસમાં var અને એકલ અવતરણ ચિન્હમાં theta |
2:38 | ત્યારબાદ sineકૌંસમાં thetaગુણ્યા sin કૌંસમાં theta વત્તા cosકૌંસમાં theta' ગુણ્યા cosકૌંસમાં theta. |
2:55 | હમણાં સુધી તમે જાણ્યું કે સેજ માં symbolic expressionsકેવી રીતે વ્યાખિત કરવી,અહી એક અભ્યાસ છે. |
3:01 | વિડીઓ ને અહી અટકવો અને આપેલ આભ્યાસનો પ્રયાસ કરો અને વિડીઓ ફરી ચાલુ કરો. |
3:05 | સેજ માં નીચે આપેલ expressionsને symbolic expressions તરીકે જાહેર કરો. |
3:11 | જે x વર્ગ વત્તા y વર્ગ છે. |
3:13 | અને આગળનું છે y વર્ગ ઓછા 4 ax |
3:18 | ઉકેલ મારી સ્ક્રીન પર છે. |
3:25 | જે છે varકૌંસમાં એકલ અવતરણમાં x,y ત્યારબાદ x વર્ગ વત્તા y વર્ગ જે છે x charat 2 વત્તા y |
3:33 | ત્યારબાદ આગળનું છે var 'કૌંસમાં એકલ અવતરણમાં a,x,y ત્યારબાદ y charat 2 ઓછા 4 into a ગુણ્યા x |
3:49 | સેજ built-in constants પણ પ્રદાન કરે છે જે સામન્ય રીતે ગણિતશાસ્ત્રમાં વપરાય છે.દા.ત. pi, e, infinity. |
3:56 | ફંક્શન nઆ તમામ કોનસ્ટંટની સંખ્યાત્મક વેલ્યુઓ આપે છે. |
4:00 | તો તમે ટાઈપ કરી શકો છો nકૌંસમાં pi ત્યારબાદ કૌંસમાં nકૌંસમાં eપછી nકૌંસમાં શૂન્ય શૂન્ય એટલેકે 00 |
4:18 | જો તમે n<tab> કરીને ફન્કશનમાં n દસ્તાવેજીક્ર્ણમાં અંદર જુઓ છો તો તમને દેખાશે તે શું આર્ગુમેનટલે છે અને શું પાછુ આઓએ છે. |
4:26 | તો તમે ટાઈપ કરી શકો છો nઅને tabદબાવો. |
4:30 | આ ખુબ મદદગર રહેશે જો તમે આ સ્ક્રીપ્ટના કોર્સમાં પરીચય કરવામાં આવેલ તમામ ફંક્શનો દસ્તાવેજીકરણ તરફે જુઓ છો. |
4:36 | એ સાથે આપણે આપણને કોન્સ્ટટ માં જોઈતા ડીજીટોના ક્રમાંક પણ વ્યાખિત કરી શકીએ છે. |
4:40 | આ માટે આપણે આર્ગુમેનટ -- digits કરવી પડશે. |
4:46 | તો તમે ટાઈપ કરી શકો છો n'કૌંસમાં pi અલ્પવિરામ સ્પેસ digits બરાબર 10 . |
5:01 | Apart from the constants Sage also has a lot of built-in functions like sin, cos, log, factorial, gamma, exp, arctan which stands for arctangent etc ... |
5:16 | તો ચાલો એમાના અમુક sage notbookનો પ્રયાસ કરીએ. |
5:21 | તો તમે ટાઈપ કરી શકો છો sine within brackets pi by 2 then arctan oo then log within brackets . |
5:44 | તો જયારે તમે artan ટાઈપ કરો છો arc માં એરર આવે છે તેથી આપણને arctan ટાઈપ કરવું પડે છે. |
5:54 | ત્યાર બાદ ટાઈપ કરો log e comma e |
6:03 | વિડીઓ અહી અટકાવો,આપેલ અભ્યાસનો પ્રયાસ કરો અને વિડીઓ ફરી ચાલુ કરો. |
6:06 | નીચે આપેલ કોન્સ્ત્નટ વેલ્યુઓ 6 અંક શુધી ચોક્કસ મેળવો. |
6:14 | પ્રથમ વિકલ્પ છે pi charat 2 |
6:18 | ત્યારબાદ euler underscore gamma charat 2 |
6:23 | Find the value of the following.નીચે આપેલની વેલ્યુ શોધો. |
6:26 | 1. sin of pi divided by 4 |
6:28 | આગળ . ln of 23. |
6:32 | ઉકેલ તમારી સ્ક્રીન પર છે. |
6:36 | જો કે nખુલ્લા કૌંસમાં piવર્ગ અલ્પવિરામ digitsબરાબર 6 આગળનું છે nકૌંસમાં sinબાય 4 અને ત્યારબાદ ત્રીજું છે nગુણ્યા કૌંસમાં log 23 અલ્પવિરામ e |
7:05 | Given that we have defined variables like x, y etc., we can define an arbitrary function with desired name in the following way. |
7:14 | So you can type var within brackets and single quotes x and then next line function within brackets and single quotes f comma x |
7:33 | Here f is the name of the function and x is the independent variable . |
7:37 | Now we can define f of x |
7:40 | that is f of x within brackets x is equal to x by 2 plus sin x. |
7:53 | Evaluating this function f for the value x=pi returns pi by 2. |
8:01 | So type f within brackets pi |
8:07 | so we will get the answer as 1 by 2 into pi. |
8:12 | We can also define functions that are not continuous but defined piecewise. |
8:18 | Let us define a function which is a parabola between 0 to 1 and a constant from 1 to 2 . |
8:24 | We shall use the function Piecewise which returns a piecewise function from a list of pairs. |
8:31 | We can type the following |
8:35 | var within brackets in single quotes x |
8:41 | then f of x is equal to x charat 2 |
8:52 | then v of x is equal to 1 |
8:58 | then next line we can type f is equal to piecewise within brackets 0 comma 1 then comma x then another bracket x then next square bracket it is 1,2, g of x comma x then type f |
9:21 | We can also define functions convergent series and other series. |
9:26 | We first define a function f(n) in the way discussed before. |
9:29 | So we can type var within brackets n in single quotes |
9:39 | then type function within brackets f,n |
9:53 | var('n')
function('f', n) To sum the function for a range of discrete values of n, we use the sage function sum. |
10:03 | For a convergent series , f(n)=1 by n raised to 2 we can say by typing
var('n') function('f', n) f(n) = 1/n^2 sum(f(n), n, 1, oo) |
10:55 | Let us now try another series
f(n) = (-1)^(n-1)*1/(2*n - 1) sum(f(n), n, 1, oo)
|
11:33 | This series converges to pi by 4. |
11:40 | Pause the video here, try out the following exercise and resume the video. |
11:46 | Define the piecewise function |
11:47 | f of x is equal to 3x plus 2 when x is in the closed interval 0 to 4. |
11:55 | f of x is equal to 4x squared between 4 to 6. |
12:03 | Sum of 1 by within brackets n squared -1 where n ranges from 1 to infinity. |
12:11 | The solution is on your screen |
12:13 | var('x') ,h(x) = 3 into x plus 2 g(x) is equal to 4 into x squared , f = Piecewise within brackets again square brackets and square brackets again and within closing brackets 0,4,h(x),(4,6),g(x),x |
12:40 | Next step you have to type var('n') f = 1/(n squared minus 1) sum(f(n), n, 1, oo) |
13:00 | Moving on let us see how to perform simple calculus operations using Sage |
13:05 | For example lets try an expression first |
13:18 | The diff function differentiates an expression or a function. |
13:27 | It's first argument is expression or function and second argument is the independent variable. |
13:33 | We have already tried an expression now lets try a function |
13:41 | f = exp(x^2) + arcsin(x)
diff(f(x),x) |
14:00 | To get a higher order differential we need to add an extra third argument for order so you can type
diff(f(x),x,3) |
14:35 | in this case it is 3. |
14:38 | Just like differentiation of expression you can also integrate them
x = var('x') s = integral(1/(1 + (tan(x))**2),x) |
15:18 | Many a times we need to find factors of an expression, we can use the "factor" function
y = (x^100 - x^70)*(cos(x)^2 + cos(x)^2*tan(x)^2) f = factor(y) |
15:46 | One can simplify complicated expression by using the function simplify.
f.simplify_full() |
16:06 | This simplifies the expression fully. |
16:07 | We can also do simplification of just the algebraic part and the trigonometric part
f.simplify_exp() |
16:24 | f.simplify_trig() |
16:33 | One can also find roots of an equation by using find_root function
phi = var('phi') find_root(cos(phi) == sin(phi),0,pi/2) |
17:07 | Let's substitute this solution into the equation and see we were correct
var('phi') f(phi) = cos(phi)-sin(phi) root = find_root(f(phi) == 0,0,pi/2) f.substitute(phi=root) |
17:55 | As we can see when we substitute the value the answer is almost = 0 showing the solution we got was correct. |
18:04 | Pause the video here, try out the following exercise and resume the video. |
18:10 | Differentiate the following. |
18:12 | 1. sin(x cubed) plus log(3x) , degree=2 |
18:24 | 2. x raised to 5 into log x raised to 7 , degree=4 |
18:32 | Integrate the given expression |
18:33 | sin(x squared)+exp(x cubed) |
18:44 | Find x |
18:45 | cos(x squared)-log(x)=0 |
18:50 | Does the equation have a root between 1,2. |
18:55 | The solution is on your screen |
18:56 | For the first one we have to type var('x') f(x)= x raised to 5 into log of x raised to 7 diff(f(x),x,5) |
19:15 | Next line we have to type var('x')then second line integral(x*sin(x^2),x) |
19:33 | For the third one we have to type var('x') then f=cos(x^2)-log(x) find_root(f(x)==0,1,2) |
19:53 | So let us now try some matrix algebra symbolically
var('a,b,c,d') A=matrix([[a,1,0],[0,b,0],[0,c,d]]) A |
20:29 | Now lets do some of the matrix operations on this matrix
A.det() A.inverse() |
20:46 | As we can see, we got the determinant and the inverse of the matrix respectively. |
20:50 | So pause the video here, try out the following exercise and resume the video. |
20:57 | Find the determinant and inverse of |
20:59 | A = within brackets and again brackets x,0,1 then again brackets y,1,0 again bracket z,0,y |
21:18 | The solution is on your screen |
21:20 | var('x,y,z') A = matrix([[x,0,1],[y,1,0],[z,0,y]])then third line you have to type A dot det function and next line you have to type A dot inverse function |
21:44 | This brings us to the end of this tutorial. |
21:48 | In this tutorial, we have learnt to, |
21:49 | Define symbolic expression and functions using the method var. |
21:53 | Then use built-in constants like pi,e,oo and functions like sum,sin,cos,log,exp and many more. |
22:00 | Then use <Tab> to see the documentation of a function. |
22:03 | 4. Do simple calculus using functions - diff()--to find a differential of a function - integral()--to integrate an expression - simplify--to simplify complicated expression. |
22:16 | 5. Substitute values in expressions using substitute function. |
22:19 | Then create symbolic matrices and perform operations on them like-- - det()--to find out the determinant of a matrix - inverse()--to find out the inverse of a matrix. |
22:29 | Here are some self assessment questions for you to solve |
22:32 | 1. How do you define a name 'y' as a symbol? |
22:37 | 2. Get the value of pi upto precision 5 digits using sage? |
22:41 | 3. Find third order differential function of f(x) = sin(x^2)+exp(x^3) |
22:50 | So, the answers, |
22:53 | 1. We define a symbol using the function var. |
22:57 | In this case it will be var('y') |
23:02 | 2. The value of pi upto precision 5 digits is given as, n(pi,5) |
23:11 | 3. The third order differential function can be found out by adding the third argument which states the order. |
23:18 | The syntax will be, diff(f(x),x,3) |
23:24 | Hope you have enjoyed this tutorial and found it useful. |