Difference between revisions of "Scilab/C2/Scripts-and-Functions/Gujarati"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 233: Line 233:
 
|-
 
|-
 
| 08.39
 
| 08.39
|Functions are segments of code that have well defined input and output as well as local variables.  
+
|ફ્ન્ક્શનો કોડ સેગમેન્ટો છે જે  સારી રીતે વ્યાખ્યાયિત કરેલ  ઇનપુટ અને આઉટપુટ તેમજ લોકલ વેરીયેબલો હોય છે.
  
 
|-
 
|-
 
| 08.46
 
| 08.46
|The simplest way to define a function  is by using the command `deff'
+
|ફન્કશન વ્યાખ્યાયિત કરવા માટેનો સરળ માર્ગ 'deff ' આદેશનો ઉપયોગ દ્વારા છે
  
 
|-
 
|-
 
| 08.53
 
| 08.53
|Scilab allows the creation of in-line functions and are especially useful when the body of the function is short
+
|સાઈલેબ ઇન લાઇન ફન્કશન બનાવવા માટે પરવાનગી આપે છે અને તે ખાસ કરીને ત્યારે ઉપયોગી છે જયારે ફન્કશનની બોડી ટુકી હોય.
  
 
|-
 
|-
 
| 09.02
 
| 09.02
|This can be done with the help of the function deff().  
+
|deff() ફન્કશન ની મદદથી કરી શકાય છે.
  
 
|-
 
|-
 
| 09.07
 
| 09.07
|It takes two string parameters.  
+
|તે બે સ્ટ્રીંગ પેરામીટર લે છે.
  
 
|-
 
|-

Revision as of 15:07, 22 November 2013

Time Narration


00.01 સાઈલેબ સાથે સ્ક્રિપ્ટો અને ફ્ન્ક્શન્સ પરના સ્પોકન ટ્યુટોરીયલમાં તમારું સ્વાગત છે.
00.06 સાઈલેબ માં ફાઇલ ફોર્મેટ્સ માટે સંક્ષિપ્ત પરિચય સાથે શરૂ કરીએ.
00.12 જયારે ઘણાબધા આદેશો એક્ઝીક્યુટ કરવામાં આવે છે, ત્યારે તે સ્ટેટમેન્ટ સાઈલેબ એડિટરમાં ફાઇલમાં લખવું વધુ અનુકૂળ હોઈ શકે છે.
00.21 આ સ્ક્રિપ્ટ ફાઈલ તરીકે ઓળખવામાં આવે છે.
00.24 આવી સ્ક્રિપ્ટ ફાઈલમાં લખાયેલ આદેશો એક્ઝીક્યુટ કરવા માટે, સ્ક્રિપ્ટ ફાઈલનું નામ સાથે exec ફન્કશનનો ઉપયોગ કરી શકાય છે.
00.34 સામાન્ય રીતે તેના કન્ટેન્ટ પર આધાર રાખી આ ફાઈલનું એક્સ્ટેંશન .sce અથવા .sci હોય છે.
00.42 .sci એક્સ્ટેંશન ધરાવતી ફાઈલો સાઈલેબ ફ્ન્ક્શન્સ અને અથવા યુઝર ડીફાઇન્ડ ફ્ન્ક્શન્સ સમાવે છે
00.51 આ ફાઈલો એક્ઝીક્યુટ કરવાથી, સાઈલેબ ઇન્વાયરન્મન્ટમાં ફ્ન્ક્શન્સ લોડ થાય છે (પરંતુ તેમને એક્ઝીક્યુટ નથી કરતા) જ્યારે
01.00 .sce એક્સ્ટેંશન ધરાવતી ફાઈલો સાઈલેબ ફ્ન્ક્શન્સ અને યુઝર ડીફાઇન્ડ ફ્ન્ક્શન્સ સમાવે છે
01.08 યાદ રાખો કે .sce અને .sci તરીકે એક્સ્ટેંશનના નામકરણ રુપાંતરણ માટે નિયમો નથી, પરંતુ રુપાંતરણ સાઈલેબ સમુદાય દ્વારા અનુસરવામાં આવે છે.
01.21 ચાલો કમ્પ્યુટર પર સાઈલેબ કન્સોલ વિન્ડો ખોલીએ.
01.27 કમાંડ પ્રોમ્પ્ટ પર pwd આદેશ ટાઇપ કરીને વર્તમાન કાર્યરત ડિરેક્ટરી તપાસો.
01.35 સાઈલેબ કન્સોલ વિન્ડોના ટાસ્કબાર પર જાઓ અને સાઈલેબ એડિટર ખોલવા માટે editor વિકલ્પ પર ક્લિક કરો
01.49 મેં પહેલેથી જ ફાઈલમાં આદેશો લખ્યા છે અને helloworld.sce તરીકે સંગ્રહ કરી છે, તેથી હું Open a file શૉર્ટકટ આઈકોનનો ઉપયોગ કરીને તે ફાઇલ ખોલીશ.
02.03 ફાઈલ પસંદ કરો અને Open ઉપર ક્લિક કરો.
02.10 તમે નવી ફાઈલમાં આદેશો ટાઇપ કરી શકો છો અને ફાઇલ મેનૂ દ્વારા helloworld.sce તરીકે વર્તમાન કાર્યરત ડિરેક્ટરીમાં આ ફાઈલ સેવ કરી શકો છો.
02.20 સાઈલેબ એડિટર મેનુ બારમાં Execute બટન પર જાઓ અને ચલાવો અને Load into Scilab વિકલ્પ પસંદ કરો.
02.29 આ સાઈલેબ કન્સોલ માં ફાઇલને લોડ કરશે.
02.34 કન્સોલ પર ફાઈલ લોડ કર્યા પછી સ્ક્રિપ્ટ તમે જુઓ છો તે પ્રમાણે આઉટપુટ આપે છે:
02.43 તે આદેશો અને સંબંધિત આદેશો માટે પરિણામી આઉટપુટ બંને સમાવે છે.
02.49 હવે a ની વેલ્યુ 1 થી બદલો.
02.55 એડિટરમાં, File મેનુ પર જાઓ, અને Save ઉપર ક્લિક કરો.
03.02 આપણે exec આદેશ અને સ્ક્રિપ્ટ ફાઈલનો પાથ આપી સાઈલેબ ઈન્ટરપ્રીટરથી સીધી સ્ક્રિપ્ટ નીચે આપેલ પ્રમાણે એક્ઝીક્યુટ કરી શકો છો:
03.12 exec કૌંસ માં ડબલ અવતરણ ચિન્હમાં helloworld.sce માં જે ફાઇલ નામ છે અને Enter દબાવો.
03.31 સ્ક્રિપ્ટ ફાઈલ exec ફન્કશનના ઉપયોગ સાથે સમાન આઉટપુટ આપે છે.
03.37 ચાલો હવે ફ્ન્કશ્ન્સ વિશે વાત કરીએ:
03.39 ફન્કશન ડેફીનેશન function કીવર્ડ સાથે શરૂ થાય છે અને endfunction કીવર્ડ સાથે અંત થાય છે.
03.46 મેં પહેલેથી જ સાઈલેબ એડિટરની મદદથી function.sci માં ફન્કશન ફાઈલ સંગ્રહી છે.
03.57 હું તે ફાઈલ ખોલીશ.
04.03 તમે જોઈ શકો છો ફન્કશન અહીં વ્યાખ્યાયિત થયેલ છે.
04.08 અહીં radians2degrees ફન્કશન નામ માં degrees આઉટપુટ પેરામિટર છે,
04.21 અને radians ઈનપુટ પેરામિટર છે.
04.26 હું Execute મેનુ વિકલ્પની મદદથી આ ફન્કશન સાઈલેબમાં લોડ કરીશ.
04.40 ફન્કશન હવે સાઈલેબ કન્સોલમાં લોડ થયું છે.
04.44 તે exec આદેશની મદદથી પણ લોડ કરી શકાય છે.
04.47 ફન્કશન લોડ થઈ જાય, પછી તે ચોક્કસ આર્ગ્યુંમેન્ટ પાસ કર્યા દ્વારા અન્ય સાઈલેબ ફન્કશનની જેમ કોલ કરી શકાય છે.
04.56 પરસેન્ટ સાઇનની મનથી નોંધ લો અને તેના ઉપયોગના કારણ યાદ કરો.
05.02 હવે ચાલો radians2degrees of %pi/2 અને radians2degrees of (%pi/4) ની વેલ્યુઝ શોધીએ.
05.17 percent pi/2 અને radians2degrees percent pi by 4 (%pi/4)
05.28 હવે આપણે એક કરતાં વધુ ઇનપુટ અને આઉટપુટ આર્ગ્યુંમેન્ટ સાથે ફન્કશન જોઈશું.
05.33 આ ફન્કશન ઇનપુટ આર્ગ્યુંમેન્ટ તરીકે ધ્રુવીય કોઓર્ડિનેટ્સ લે છે અને આઉટપુટ આર્ગ્યુંમેન્ટ તરીકે લંબચોરસ કોઓર્ડિનેટ્સ આપે આવશે.
05.44 મેં પહેલેથી ટાઇપ કરેલ ફાઇલ ખોલીશ.
05.51 અહીં તમે જોઈ શકો છો polar2rect ફન્કશનમાં x અને y આઉટપુટ પેરામીટર છે અને r અને થીટા ઇનપુટ પેરામીટર છે .
06.06 હું exec વિકલ્પની મદદથી આ ફન્કશન સાઈલેબમાં લોડ કરીશ.


06.21 ફન્કશન લોડ થઈ જાય, પછી આપણે ફન્કશન કોલ કરવાની જરૂર છે. આ ફન્કશનમાં બે ઇનપુટ આર્ગ્યુંમેન્ટ અને બે આઉટપુટ આર્ગ્યુંમેન્ટ જરૂરી છે.
06.31 તેથી R = 2; થીટા = 45 છે અને હવે આપણે તેને કોલ કરીશું, x1 અલ્પવિરામ y1 આઉટપુટ પેરામીટર ઇકવલ ટુ, ફન્કશન નામ polar2rect કૌંસમાં R અલ્પવિરામ થીટા અને એન્ટર ડબાઓ.
07.25 તમે x1 અને y1 ની વેલ્યુ જોશો.
07.29 સાઈલેબનું એક રસપ્રદ લક્ષણ એ છે કે તમે કોઈ પણ સંખ્યામાં ફ્ન્ક્શનો એક જ .sci ફાઈલમાં વ્યાખ્યાયિત કરી શકો છો.
07.38 આ કરતા સમયે, યાદ રાખો કે ફન્કશનમાં વ્યાખ્યાયિત થયેલા તમામ વેરીયેબલો લોકલ છે, ચોક્કસ ફન્કશનમાં ઉપયોગ થયેલા આ વેરીયેબલોનો સ્કોપ ફન્કશન ડેફીનેશનના endfunction કીવર્ડ સાથે અંત થાય છે
07.55 આ લક્ષણનો લાભ એ છે કે આપણે અલગ અલગ ફન્કશનમાં સમાન ચલ નામોનો ઉપયોગ કરી શકીએ છીએ.
08.05 આપણે ગ્લોબલ વિકલ્પ ન વાપરીએ ત્યાં સુધી આ વેરીયેબલો મિશ્ર ન થશે.
08.10 ગ્લોબલ વેરિયેબલ વિષે વધુ જાણકારી માટે help global ટાઇપ કરો.
08.18 નોંધ લો કે કોઈપણ વેરિયેબલ "નિહાળવામાં" અથવા ફન્કશન અંદર મોનીટર કરવા માટે હોય, તો disp જરૂરી છે.
08.26 ફન્કશન ફાઈલની અંદર, તમે સ્ટેટમેન્ટના અંતમાં અર્ધવિરામ (;) મૂકી તેની અસર તપાસી શકો છો.
08.34 disp સ્ટેટમેન્ટો માટે પણ તપાસ કરો.
08.38 Inline Functions:
08.39 ફ્ન્ક્શનો કોડ સેગમેન્ટો છે જે સારી રીતે વ્યાખ્યાયિત કરેલ ઇનપુટ અને આઉટપુટ તેમજ લોકલ વેરીયેબલો હોય છે.
08.46 ફન્કશન વ્યાખ્યાયિત કરવા માટેનો સરળ માર્ગ 'deff ' આદેશનો ઉપયોગ દ્વારા છે
08.53 સાઈલેબ ઇન લાઇન ફન્કશન બનાવવા માટે પરવાનગી આપે છે અને તે ખાસ કરીને ત્યારે ઉપયોગી છે જયારે ફન્કશનની બોડી ટુકી હોય.
09.02 આ deff() ફન્કશન ની મદદથી કરી શકાય છે.
09.07 તે બે સ્ટ્રીંગ પેરામીટર લે છે.
09.10 The first string defines the interface to the function and the second string defines the statements of the function.
09.19 The deff command defines the function in the Scilab and also loads it.
09.26 There is no need to load the function defined by using deff command explicitly through execute menu option .
09.34 Let us see an example to illustrate this concept:
09.41 I will open a file inline.sci where I have writen the inline function
09.51 I will resize the editor window.
09.57 As mentioned earlier the first string defines the function declaration and the second string defines the statements of the function.
10.13 We will load this function in Scilab editor and use it to find the values of degrees2radians of 90 and degrees2radians of 45.
10.54 A function should call, not just other functions within itself, but also ITSELF.
11.00 This is "recursive" calling of a function.


11.03 This is required, for example, when writing a function to calculate the factorial of an integer.
11.10 Let us extend the discussion on file formats in Scilab:
11.14 As mentioned earlier SCILAB uses two types of file formats, namely the SCE file format and the SCI file format.
11.23 The files with the .sce file extension are the script files, which contain the SCILAB commands that you enter during an interactive kind of SCILAB session.
11.35 They can comprise comment lines utilized in documenting the function and they can also use the command EXEC to execute the script.
11.52 The files with the .sci file extension are the function files that start with the function statement.
12.00 A single .sci file can have multiple function definitions which themselves contain any number of SCILAB statements that perform operations on the function arguments, or on the output variables after they have been evaluated.
12.20 This brings us to the end of this spoken tutorial on Scripts and Functions in Scilab.
12.25 There are many other functions in Scilab which will be covered in other spoken tutorials.
12.31 Keep watching the Scilab links.


12.33 This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education (FOSSEE).
12.40 More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in
12.50 Supported by the National Mission on Eduction through ICT, MHRD, Government of India.


12.56 For more information, visit: http://spoken-tutorial.org/NMEICT-Intro
13.06 This is Anuradha Amrutkar from IIT Bombay signing off.
13.10 Thanks for joining us. Goodbye

Contributors and Content Editors

Jyotisolanki, Krupali, PoojaMoolya