Scilab/C2/Scripts-and-Functions/Bengali

From Script | Spoken-Tutorial
Revision as of 19:55, 7 March 2017 by Kaushik Datta (Talk | contribs)

Jump to: navigation, search
Time Narration
00:01 scilab -এর script এবং function -এর ওপর এই স্পোকেন টিউটোরিয়ালটিতে আপনাদের স্বাগত জানাই।
00:06 রথমেই শুরু করা যাক scilab -এ ফাইল ফর্মাট -এর ওপর একটি সংক্ষিপ্ত উপস্থাপনাকে দিয়ে।
00:12 যখন কতগুলি কমান্ডসকে একসঙ্গে কার্যকর করতে হয় , তখন সেগুলি বা সেই statements গুলিকে scilab এডিটর -এর সাহায্যে একটি ফাইল -এ লেখা অনেক বেশী সুবিধাজনক।
00:21 এইগুলিকে স্ক্রিপ্ট ফাইলস বলে।
00:24 স্ক্রিপ্ট ফাইল -এ লিখিত কমান্ডগুলিকে কার্যকর বা সম্পাদন করতে হলে স্ক্রিপ্ট ফাইল-এর নাম দিয়ে exec ফাংশন ব্যবহার করা যেতে পারে।
00:34 এবং এটি নির্ভর করে ফাইল -এর content বা উপাদানের ওপর।
00:42 যে ফাইলগুলির extension .sci হয় ,সেইগুলির মধ্যে থাকে scilab -এর ফাংশন ,and /or user defined ফাংশনস বা ব্যবহারকারী নির্দিষ্ট ফাংশন
00:51 (কিন্তু সেগুলিকে সম্পাদন বা কার্যকর করে না)
01:00 আবার অন্যদিকে , যে ফাইলগুলির extension .সকে , সেইগুলি scilab function এবং কার্যকারী statements বা executable statements , দুটিই ধারণ করে।
01:08 তবে এটি একটি রীতি যা scilab কমিউনিটির দ্বারা অনুগমন করা হয়।
01:21 চলুন এবারে কম্পিউটার -এ scilab খুলি।
01:27 কমান্ড প্রম্পট -এর ওপর cd টাইপ করে বর্তমান কাজের নির্দেশিকাটি একবার দেখে নিন।
01:35 এবারে scilab কনসল উইন্ডো টাস্ক বার-এ গিয়ে এডিটর option -এ ক্লিক করুন scilab এডিটর খোলবার জন্যে।
01:49 আমি আগে থেকেই ফাইল-এ কমান্ড টাইপ করে save করেছি helloworld.sce নামে।
02:03 তাই এখন আমি ফাইলটি খুলবো ফাইল-এর শর্টকাট আইকন open করে। disp("Hello World")
02:10 আপনি নতুন ফাইল-এ কমান্ডগুলি টাইপ করে , ফাইল মেনুতে গিয়ে ফাইলটিকে বর্তমান কাজের নির্দেশিকাতে save করতে পারেন HelloWorld.sce নামে। এটা মনে রাখবেন যে ফাইল নামের মধ্যে কোনো space থাকবে না।
02:20 এরপর scilab এডিটর মেনুবার এ execute button -এ যান এবং scilab option -এ load -এ সেলেক্ট করুন।
02:29 এরফলে ফাইলটি scilab কনসল-এ load হয়ে যাবে।
02:34 scilab কনসোলে ফাইলটি load হবার পর যে output -টি স্ক্রিপ্ট থেকে পাওয়া যাবে, তা আপনি নিম্নলিখিতটিতে দেখতে পাচ্ছেন
02:43 Iতাহলে এটিতে কমান্ডস এবং এক একটি কমান্ডের ফল স্বরূপ যে output , তা উভয়েই আছে।
02:49 বারে এডিটর-এ গিয়ে a -এর মূল্য বা value পরিবর্তন করে 5 করুন।
02:55 ফাইল মেনুতে যান, আবার save সেলেক্ট করুন এবং এটিকে বন্ধ করুন।
03:02 আমার আবার scilab interpreter থেকে স্ক্রিপ্টকে সরাসরি সম্পাদন বা কার্যকর করতে পারি exec কমান্ডের সাহায্যে।
03:12 আমার আবার scilab interpreter থেকে স্ক্রিপ্টকে সরাসরি সম্পাদন বা কার্যকর করতে পারি exec কমান্ডের সাহায্যে।
03:31 exec কমান্ডটি ব্যবহারের স্ক্রিপ্ট ফাইলটি একই output দিছে
03:37 চলুন এবারে function নিয়ে আলোচনা করি।
03:39 unction -এর ব্যাখ্যা শুরু হয় function দিয়ে এবং শেষ হয় keyword endfunction দিয়ে।
03:46 স্সিলাব এডিটর ব্যবহার করে আমি আগে থেকেই function save করেছি ।
03:57 function.sci file -এ।
04:03 function -এর ব্যাখ্যা করা হয়েছে যেমনটি আপনি দেখতে পাচ্ছেন
04:08 এখানে radians2degrees নামক function -এ degree হল
04:21 output parameter এবং radians হল input parameter
04:26 এবারে Execute মেনু option ব্যবহার করে
04:40 আমি এই function -টি লাদ করব scilab -এ।
04:44 function -টি এখন scilab কনসোলে load হয়ে গেছে।
04:47 একবার function -টি load হয়ে গেলে scilab -এর অন্যান্য function -এর মত এটিকেও ব্যবহার করা যেতে পারে শর্ত বা arguments গুলিকে ওই function -এ পাঠিয়ে।
04:56 এখানে % সাইনটি দেখুন এবং এর ব্যবহার মনে করে দেখুন।
05:02 চলুন আমরা এবারে radians2degrees(%pi/2) এবং
05:17 radians2degrees(%pi/4)-এর মূল্য বের করি।
05:28 Now we will see a function with more than one input and output arguments.
05:33 This function will take polar coordinates as input argument and returns rectangular coordinates as output arguments.
05:44 I will open the file which I have already typed.
05:51 Here you can see, x and y are the output parameters and r and theta are the input parameters to the function polar2rect.
06:06 I will load this function in scilab using the exec option.
06:21 Once the function is loaded, we need to call the function. This function requires two input arguments and two output arguments.
06:31 Therefore r = 2,
06:37 theta = 45;
06:44 and now we will call it x1 comma y1, output parameters, is equal to function name polar2rect into bracket r comma theta and press Enter.
07:25 You will see the value of x1 and y1.
07:29 One of the interesting features of Scilab is, you can define any number of functions in a single .sci file.
07:38 While doing this, please remember that by default all the variables defined in a function are local, the scope of these variables used in a particular function ends with the endfunction keyword of the function definition.
07:55 Advantage of this feature is that, we can use same variable names in different function.
08:05 These variables won't get mixed up unless we use the global option.
08:10 To know more about the global variables, type help global.
08:18 Please note that if any variable is to be "watched" or monitored inside a function then disp is required.
08:26 Inside a function file, you can check for yourself the effect of putting a semicolon ( ; ) at the end of a statement.
08:34 Also check this for disp statements.
08:38 Inline Functions:
08:39 Functions are segments of code that have well defined input and output as well as local variables.
08:46 The simplest way to define a function is by using the command `deff.
08:53 Scilab allows the creation of in-line functions and are especially useful when the body of the function is short.
09:02 This can be done with the help of the function deff().
09:07 It takes two string parameters.
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 written 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 formats.
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

Kaushik Datta