8 views

Uploaded by Ritu Maheshwari

reasoning

reasoning

Attribution Non-Commercial (BY-NC)

- Logarithm Worksheets
- Foundations Of Computation harvarddmuddy
- ASTM D 2270
- Coffey M W - On Some Log-cosine Integrals Related to Zeta(3, Zeta(4), And Zeta(6) - J. Comput. and Appl. Math. 159 (2003) 205-215
- Elementary 2D Flow
- BENDFORF 2
- Algebra
- Using Logarithms in the Real World _ BetterExplained.pdf
- Lab Report
- M34 Post Versalog 1951
- Mathematics
- MTH110
- logic1
- Paperwork ADD Mathematics Form5
- Algebra 2 Solution
- Indices_and_logarithms.pdf
- Propositional Logiwkdc 2008 09
- Plotting and Model Building in MATLAB
- Additional Math Paper 1(Solaf)
- T_Alg2 Ind

You are on page 1of 6

Indicate the errors: (a) (b) (c) (d) (e) 2. 4,75,163, +-7567 3.64E 1.5 6.05E 6125 -

Which of the following BASIC strings are correct? (a) (b) (c) (d) (e) January 26, 1997 Sixty-two 5121942 100 - 40 =60 SUM "10"

3.

Write the following as ordinary numbers: (a) (b) (c) (d) (e) 1.23E6 1.5E - 5 - 3E + 2 5.865696 E + 6 - 1.2 E -2

24.8

ARITHMETIC EXPRESSIONS

A BASIC system can handle arithmetic expressions involving the five arithmetic operators + (addition), - (subtraction), *(multiplication), /(division) and ^ (exponentiation). The hierarchy of operations is as follows: (i) (ii) (iii) Exponentiation Multiplication and division Addition and subtraction

Thus, in a particular arithmetic expression, the order of execution is as per this hierarchy, i.e. all exponentiation operations are performed first, then multiplication/division and the addition/subtraction operations are the last to be carried out. Note that within a particular hierarchical group, the operations are executed form left to right. Normal hierarchy of operations can be altered by use of parentheses. The operations within the innermost parentheses are performed first and then the second innermost and so on. In addition to this hierarchy of operations, the following rules must be kept in mind in arithmetic expression: Two operations must not appear together. For example, C+-D, A/-C, etc are not permitted. String constants and string variables should not be used in arithmetic expressions. For example, P+P$ is wrong. When brackets are used, they must be used in pairs, i.e., every left bracket must be matched with a right bracket. Denominator of an expression should not be zero. Within a given pair of parentheses, the natural hierarchy of operations will apply.

Let us take an example where we give BASIC equivalents of a few algebraic expressions Algebraic Expression 2A+B A(B+C) BASIC Equivalent 2*A+B A*(B+C)

A +B ..................................( A + B ) /(C + D ) C +D

B2-4AC 24.9

B^2-4*A*C

2

A relational expression is formed by using any of the following relational operators: Meaning Equal to Greater than Less than

In the execution of programs, it is sometimes desired to compare two numerical quantities (or sometimes string quantities) and take decisions on achieving certain conditions. For example, we may be interested to check the number of repetitive calculations performed or to find out whether the denominator of an arithmetic expression has become zero or if a particular quantity is negative, and so on. Expressions written to compare two quantities using certain relational operators are known as relational expressions. These expressions take only one of the two values, namely, TRUE or FALSE, For instance, the relational expression A > B will be true if A is greater than B, otherwise FALSE. This test result is used to change the sequence of execution of statements in a program. The general form of a relational expression is as follows:

Relational operator

When expressions are used on either side of the relational operators, the expressions will be evaluated first and then the results of expressions compared. This means that relational operators come last in the hierarchy of operators. Logical expressions are used in IF---THEN Statements to determine the course of action of a running program. 24.10 LOGICAL OPERATORS Like relational operators, BASIC, also supports logical operators to perform logical operation on numerical values. Logical operators are used to connect two or more relations and return a TRUE or FALSE value to be used in a decision. The common logical operators are: AND Conjunction

OR NOT

For example, the expression A > 50 AND B > 150 is TRUE when A is more than 50 and at the same time B is more than 150. Logical operators return results as indicated in the following tables. T indicates a TRUE and F indicates a FALSE. X and Y are relational expressions.

AND Operator X T T F F Y T F T F OR Operator X T T F F Y T F T F NOT Operator X T F 24.11 LIBRARY FUNCTIONS IN BASIC NOT X F T X OR Y T T T F X AND Y T F F F

The word `library' stands for collection. In the context of computer languages, a library is essentially a collection of useful programs. These programs are used by the programmers to simplify their task of program development. These programs are often referred as subroutines. The programmer does not have to know the details of the sub-routine. Most of the programming languages are offered with a number of sub-routines called sub-routine

library or library functions. These built-in library functions are used to simplify some useful common functions like calculation of square root, log of a number or cosine of an angle. BASIC's library is rich with mathematical functions. For example, suppose you want to calculate the square root of a numeric variable A. In simple mathematics, square root of A, i.e., can be written as A. Thus in BASIC it can be written as: 10 LET B = A^0.5 The value of B will be the square root of A. Using a library function the operation can be performed as 10 LET B = SQR(A) Of course, from the example, it appears that there is hardly any benefit in using the library function. But imagine, if problem is little more complicated like calculation of the sine value of an angle or logarithm of a number. The programming algorithm to calculate these is not so simple. To find the logarithm of by using LOG function you write 10 LET Y = LOG (X), The variable Y will store the LOG value of X. From this example, we may deduce the rules, governing the use of a function. (a) Each function is assessed by the function name (LOG, SQR, etc.) followed by the function argument placed within the parenthesis. (b) The function argument is the information you supply to the function to act upon it. For mathematical factions, it has to be a numeric constant or variable. Listed below are some examples of mathematical functions in BASIC.

Function SIN

Name Sine

Example SIN(X)

value of an angle (in radians) LOG SQR LOG Square root Calculate the natural logarithm of a number Calculate the square root of a number

(c) The function name is to be written exactly as given. No deviation is permitted. (d) You cannot have a blank space between function name (SIN, LOG etc.) and the beginning of the opening parenthesis enclosing the argument. It should be noted that a library function program would produce the result faster than a BASIC program that has been written to perform the same task. For example, calculation of square root by the SQR function will be faster than writing in the form of a program. This is due to the fact that library functions are optimised for the particular BASIC interpreter provided by the supplier.

IN-TEXT QUESTION 2 1. Evaluate the following BASIC expressions: (a) (b) 3 * 4/2 ^ 3 + 1 2 * (3+4) / (5-3) * 7

2. Write the BASIC expression corresponding to each of the following algebraic expression: (a) (b) (c) (d) (x+y) 4 2x2 + 5x + 6 x/y + y/z (x-y)4 / (x+y)4

- Logarithm WorksheetsUploaded bySurya Prakash
- Foundations Of Computation harvarddmuddyUploaded by吴彤昀
- ASTM D 2270Uploaded byRudrendu Shekhar
- Coffey M W - On Some Log-cosine Integrals Related to Zeta(3, Zeta(4), And Zeta(6) - J. Comput. and Appl. Math. 159 (2003) 205-215Uploaded byRenee Bravo
- Elementary 2D FlowUploaded byEspada Esprezzo
- BENDFORF 2Uploaded byMSatie Nivelmat
- AlgebraUploaded byrochelle
- Using Logarithms in the Real World _ BetterExplained.pdfUploaded bykamayani_pr
- Lab ReportUploaded bycp4tj
- M34 Post Versalog 1951Uploaded byRon Smithy
- MathematicsUploaded byAamir Hussain Khawaja
- MTH110Uploaded byAnonymous nRgQtis
- logic1Uploaded byAlexander Black
- Algebra 2 SolutionUploaded byGeorge Ezar N. Quiriado
- Paperwork ADD Mathematics Form5Uploaded byMohd Rohim Zaid
- Indices_and_logarithms.pdfUploaded bySynnot Lee
- Propositional Logiwkdc 2008 09Uploaded byBabar Khan
- Plotting and Model Building in MATLABUploaded byMuhammad Shehzad Kamal
- Additional Math Paper 1(Solaf)Uploaded byRelify WE
- T_Alg2 IndUploaded bylusienopop
- Image Chapter3 Part1Uploaded bySiraj Ud-Doulla
- arithmetic dynamicsUploaded bysushmapalimar
- 12th-science-hsc-perfect-mathematics-i.pdfUploaded byDivya
- Som Project PaperUploaded bycactusblanket
- S0002-9939-1950-0038589-5Uploaded byKrijan Mali
- International Journal of Computational Engineering Research(IJCER)Uploaded byInternational Journal of computational Engineering research (IJCER)
- Projeck Work HelpUploaded byFadzilah Yaya
- 6 Introduction_23_aug_18.pptxUploaded bySamarth Singh
- Using Loss Data to Quantify Operationla RiskUploaded byajinkyan2000
- lct2Uploaded byJunaid Sabri

- Kanban System Proces FlowUploaded byVaibhav Rakhunde
- OutputUploaded byppzpanda
- Navdeep Gill, Patrick Hall - An Introduction to Machine Learning Interpretability (2018, O’Reilly Media, Inc.).pdfUploaded byWirawan Setialaksana
- Exercises 1AUploaded byKevïn Steven
- bell-projUploaded bySyams Fathur
- Dc Motor Speed Control System Without Tacho GeneratorUploaded byatanumaster1987
- PythonScientificUploaded byLuis Carvalheiro
- CE OrganizationUploaded byAnil Pal
- mca4_2Uploaded bydilipomi
- Lippe SaxScoreUploaded byPhilippe Trovão
- How to Install OLP-55 USB DriverUploaded byJoão Gilberto Fernandes
- ERD TutorialUploaded byPSH PML
- Spring 2014 Syllabus Med Inf 498Uploaded bysavvy_as_98-1
- MWconn ManualUploaded byPedro
- AQUICKINTRODUCTIONTOSLIDINGMODECONTROL.pdfUploaded byKamalesh
- Advance Agile HandoutUploaded byAjay Krish
- advantages and disadvantagesUploaded byapi-268521283
- AMPLE Using IGP Based Traffic EngineeringUploaded byseventhsensegroup
- multixpress_m537x_series.pdfUploaded byAlberto Tenorio
- As NZS 3827.1-1998 Lighting System Performance - Accuracies and Tolerances Overview and General RecommendatioUploaded bySAI Global - APAC
- Data Transmission ModesUploaded byJoel Gwenere
- acrp_rpt_079Uploaded byG GR
- Quick Start UpUploaded byhino_kagu
- Bill of Quantity (BoQ) RTUUploaded byRyani Aldora
- TCO!Stream Technical ComplianceUploaded byBadrul Bakar
- Generation of ComputersUploaded byMichael Gibbs
- A Guide to Installing CMG 2012 Software on WindowsUploaded byHERiTAGE1981
- Rescind DMV ContractUploaded byNoah Body
- Auto Tuning for Pid ControllersUploaded by69mike
- TMDXEVM6670L Technical Reference Manual 1V00Uploaded byhsmscribd