The electron theory of matter is one of the most successful and experimentally proved theory that can explain the nature of electricity. Although the study of electricity has been attracting the attention of scientists for several hundred years, and there were several experiments and theories developed to understand the nature of electricity. The only theory that has explained it successfully is the electron theory of matter. The electron theory of matter is the result of experiments and researches conducted by many scientists like J. J. Thomson, R. A. Millikan, Earnest Rutherford and Bohr. This article is meant for explaining the ... Read More
Engineering materials can be classified into two broad categories namely metals and nonmetals. This classification of engineering materials is based on their physical and chemical properties. In this article, we shall discuss the differences between metals and non-metal, but before we will learn that what metals and non-metals are. What are Metals? Metals are the crystalline materials that have a number of differentially oriented fine crystals. At normal temperature, all metals are generally found in solid state. However, there are some exceptions such as mercury which found in liquid state at the normal temperature. All metals have comparatively high conductivity ... Read More
In electrical and electronic circuits, the power is one of the most significant quantities used to analyze the circuits for practical applications. The electrical power defined as the time rate of expanding or absorbing energy in a circuit, i.e., $$\mathrm{Power, P=\frac{Energy \;expanded\; or\; absorbed (𝑊)}{Time(𝑡)}}.....(1)$$ This article is meant for explaining power relations in AC circuits. Where, an AC circuit is one which is excited from a source alternating voltage. Instantaneous Power in an AC Circuit The value of electric power in an AC circuit measured at a certain instant of time is known as instantaneous power. It is generally ... Read More
In this article we will discuss about how to get the magnitude of a number in Go language. Magnitude of a quantity is defined as its numeric value. Magnitude of a number is always positive. In this article we will discuss about different methods by which we can obtain the magnitude of any number. Syntax func Abs(number float64) float64 Abs() is a method defined in math library. This method accepts a 64 bit float number as an argument and return the absolute value of it excluding the sign. The source code to the above stated problem is compiled and ... Read More
In this article we will discuss about how to display prime numbers between two intervals using functions in Go language. Syntax func Sieve(n int) []int func IsPrime(n int) bool If else conditionals in GO language: If condition { // code to be executed } else { // code to be executed } For loop as a while loop in GO language: for condition { // code to be executed // increment or decrement the count variable. } Sieve() function defined in primes package accepts ... Read More
In this tutorial we will learn how to create Complex numbers from given imaginary parts in Go programming language. A complex number is a basic data type of GoLang and is a combination of the real and imaginary part, where both parts of the complex number will be float type in golang. Complex Number = Real Number + Imaginary Number The function complex()in Go programming language is a built-in function that is used to construct a complex number from two floating-point values. The real and imaginary parts of the complex value must be of the same size and the return ... Read More
In this tutorial, we will learn how to convert string variables to double in Go programming language. String is a data type which is used to store characters or alphabets. Strings have a size of 1 byte or 8 bits. Whereas double is a data type which is used to store double precision floating point numbers. The size of double is 64 bits or 8 bytes. Program to Convert String type Variable to Double Using ParseFloat() Method Syntax func ParseFloat (s string, bitsize int) (float 64, error) ParseFloat() function is used to convert strings to float type values. This ... Read More
In this tutorial, we will learn how to convert string type variables into int in Go programming language. For this task various types of string conversions are needed, to perform the conversions “strconv” package is imported in the go language program, Strings can be transformed into integer values using the ParseInt function. It decodes a string in the specified base (0, 2 to 36) and bit size (0, 64), and then it returns the equivalent result. Convert String Type Variable Into Int Syntax func ParseInt(s string, radix/base int, bitSize int) (i int64, err error) ParseInt() function is used to ... Read More
In this tutorial, we will learn how to f convert string type variables into Boolean in Go programming language. Boolean Vs String Boolean is a data type having 1-byte size. It can store any one of the three values mainly True, False or none. It acts like a flag to show whether a condition is correct or not. String data type is used to store a sequence of characters. it can be in the form of literals or alphabets. The size of string variable is 1 byte or 8 bits. For this task various types of string conversions are needed, ... Read More
In this article you will know how to convert the decimal number to octal in Go language. For this we are going to use the FormatInt() function of strconv package. When we say convert the decimal number to octal, it means to convert the number with the base value 10 to the base value 8. The base value means the number of digits required to represent the numeric value. Example 1: Go Language Program to convert Decimal Number to Octal using Library Function Syntax func FormatInt(input int64, base int) string for [condition | ( init; condition; increment) | Range] ... Read More