When it is required to find the mean deviation of the elements of a list, the ‘sum’ method and the ‘len’ method is used.ExampleBelow is a demonstration of the samemy_list = [3, 5, 7, 10, 12] print("The list is :") print(my_list) my_mean = sum(my_list) / len(my_list) my_variance = sum([((x – my_mean) ** 2) for x in my_list]) / len(my_list) my_result = my_variance ** 0.5 print("The result is :") print(result)OutputThe original list : [3, 5, 7, 10, 12] the standard deviation of list is : 3.2619012860600183ExplanationA list is defined and is displayed on the console.The ‘sum’ of the ... Read More
To set labels in matplotlib.hlines, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Add a horizontal line across the axis, y=1, with y=1 label, color='orange'.Add a horizontal line across the axis, y=2, with y=2 label, color='red'.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt # Set the figure size plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True # Add horizontal line plt.hlines(y=1, xmin=1, xmax=4, lw=7, color='orange') plt.text(4, 1, 'y=1', ha='left', va='center') # Add another horizontal line plt.hlines(y=2, xmin=2, xmax=5, lw=7, color='red') plt.text(2, 2, 'y=2', ha='right', va='center') ... Read More
To make a scatter plot for clustering in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create x and y data points, Cluster and centers using numpy.Create a new figure or activate an existing figure.Add a subplot arrangement to the current figure.Plot the scatter data points using scatter() method.Iterate centers data and place marker using scatter() method.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True x = np.random.randn(10) y = np.random.randn(10) Cluster = np.array([0, 1, ... Read More
To put a circle with annotation in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create data points using numpy.Get the point coordinate to put circle with annotation.Get the current axis.Plot the data and data points using plot() method.Set X and Y axes scale.To put a circled marker, use the plot() method with marker='o' and some properties.Annotate that circle (Step 7) with arrow style.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.00, 3.50] plt.rcParams["figure.autolayout"] = True data = np.array([[5, ... Read More
To get a 3D plot, we can use fig.add_subplot(111, projection='3d') method to instantiate the axis. After that, we can use the scatter method to draw different data points on the x, y, and z axes.StepsCreate a new figure, or activate an existing figure.Add an `~.axes.Axes` to the figure as part of a subplot arrangement, where nrows = 1, ncols = 1, index = 1 and projection is ‘3d’.Iterate a list of marks, xs, ys and zs, to make scatter points.Set x, y, and z labels using set_xlabel, y_label, and z_label methods.Use plt.show() method to plot the figure.Exampleimport matplotlib.pyplot as plt import ... Read More
The differences between a single-phase and a three-phase induction motor are given below −A 1-phase induction motor requires single-phase AC supply, whereas a 3-phase induction motor need a source of 3-phase AC supply for its operation.1-phase induction motors produce low starting torque, whereas 3phase induction motors produce high starting torque.The efficiency of a 1-phase induction motor is less as compared to a 3phase induction motor.The power factor of a 1-phase induction motor is low, while the power factor of a 3-phase induction motor is high.1-phase induction motors are simple in construction, reliable and economical as compared to 3phase induction motors.1-phase ... Read More
The Arithmetic Average Return is calculated by adding the rate of returns of "n" sub-periods and then dividing the result by "n". In other words, the returns of "n" sub-periods are added and then divided by "n" to find the value of the average return. As it is also the process of finding the average of a series of numbers, the average return is sometimes called as "Arithmetic Average Return".Here is the formula to calculate Arithmetic Average Return −$$\mathrm{Average\:Return =\frac{Total\:Value\:of\:the\:Return}{Total\:Number\:of \:Returns}}$$Investors and market analysts normally use the arithmetic average return to check the past performance of a stock. It is ... Read More
The typical reason for an investor to invest in a financial instrument is to make current income from dividends and interest income. For a stable company, the investments will earn a reasonable return that is the Expected Rate of Return (ERR) on given investments. Some investments such as debentures, bank deposits, public deposits, bonds, etc. carry a predetermined fixed rate of return that is usually payable periodically.Note − The sole aim of the investor investing in a single asset is to get the maximum returns. Some fixed income instruments offer less returns, but they are less risky too. Increasingly risky ... Read More
Present Value of Growth Opportunities or PVGO represents the component of a company’s share value that relates to expectations of the investors in the growth of earnings. PVGO is the difference between the total value of a company’s shares from which the net present value of its earnings is deducted, assuming there is no growth in the values of the share. PVGO is also known as "value of growth".A company’s future income can be better represented in two layers: the first layer represents a perpetuity having constant return and the second layer represents the future growth in earnings.$$\mathrm{𝑉_{0} = PV_{NG} ... Read More
Rather than taking each rate of return and multiplying them with the weight to get the total weight of each asset, there is a simple formula to calculate the expected rate of return. The expected rate of return of a portfolio or simply the return of a portfolio is the given weighted average of the expected returns on the assets.ExampleLet's take an example of a two-asset portfolio and see how to calculate its expected return. Let’s assume an investor has invested 50% of his investment in X and 50% in Y.$$\mathrm{ERR\:of\:Portfolio = (Weight\:of\:Security\:X × 0.5) + (Weight\:of \:Security\:Y × 0.5)}$$Note ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP