Hello batchers, We’re back with an update to the older version of the Plot function. The Plot Function 2.0 is an amazing function, it is based on the pure use of** mathematics**. As you know, it can plot various points (**coordinates**) on the console in the same manner as we are plotting in our math class.

Graphs help us in many ways, they provide a **simple and easy view of complex equations **or problems. You can analyze any system using the graphs or plots easily. Although many other languages can implement this easily, it is a* great learning challenge!*

## ADVANCED MATHEMATICAL PLOTTING IN CMD

Here, we’re trying to understand “**how do the advanced programming languages become so advanced**?” using our *batch programming*** **skills. Playing with mathematics is so much fun when you try to calculate and achieve something, and only one mathematics technique can provide you with everything.

The feeling of getting the thing we want by our own understood methods is amazing. Now, without wasting any time. Let’s talk about this version of the** Plot Function 2.0**.

## Problems with Plot Function 1.0

In the previous version, we’ve achieved the displacement of CMD’s **default console origin** from *TOP-LEFT CORNER* to the center of the console window, with the ability to plot **co-ordinates** according to the shifted NEW-ORIGIN.

But, the problem with Plot Function 1.0 was that it can only plot on the console according to the **size of the console**. E.g. **You can’t plot 45, 45 on the console screen with a size of 25×80**, this is because 45 of Y lie outside the console co-ordinate limit, as the console has 25 lines. Thus, it gives different outputs than the original.

You can see in the above screenshot that all the other co-ordinates above the console size limit will be placed somewhere else. To show these required co-ordinates, you need to change the size of the console window (*via ‘ Mode’ command*) and then re-plot these co-ordinates.

## WHAT’S NEW IN PLOT FUNCTION 2.0?

But, it is not possible to **change the CMD screen size **every time. The function should be intelligent enough to understand the points and adjust itself according to that. This is our goal.

So, for fulfilling this requirement, we analyzed the function more and tried to **make some more calculations** to adjust the output according to the input given by the user. After spending some hours with a pen and copy, we finally made a **mathematical model **of the requirement we want in the function. Now, the function started working more intelligently than the previous version.

But, the problem was not solved completely yet. The user knows the position of the plots as he has given the input. But there is no method of determining the value of a point by simply looking at the graph.

## While There’s Code – There’s BUG!

Now, the **algorithm for displaying the numbers **beside the x-axis and y-axis should be built. After a few hours and with a lot of effort, we finally did it. We will explain it below.

Now, you can print and analyze some of the mathematical equations of various shapes. We have tested** parabola** and **line equations**. The same above program gives the following output with Version 1.0 of this function.

And now, we know that by watching both images, you will know the difference of 2.0 versus 1.0. Both the functions are using the SAME PLOT FILE for printing the output on the CMD console. But still, for formality, we have to show the usage and input file example to the users, before they download and start using this awesome batch extension.

A Thinker

Think TWICE, Code ONCE!

The layout or format of the **plot file **is the same as of 1.0. All lines starting with ‘**#**’ are comments and rest you can see in the image or download and analyze the properties of the Plot File on your own. Check it out!

You can even find the intersection of two equations **graphically** via using this plot function. **For example**, to find the intersection of Lines in the format:

```
Y=5x+5
and
Y=-5x+5
```

Just calculate the corresponding values of ‘Y’, with respect to ‘X’ using a **for loop**, for both the equations and plot the co-ordinates using this plot function. You can see a result below.

## From The Editor’s Desk

As you can see in the image above, the intersection is at **0,5 **position. You can verify it by solving both the equations **mathematically** also. At last, we hope you like our work. Give your response and suggestions via your comments below, or contact us on Discord or WhatsApp!

HASH Code - For Verification - (SHA-256)

1c59733f557fbb36e03bea9cd6b81f1fa3dca30aa30a15caefea54bbe6d912ca

Keep learning, keep sharing….

TheBATeam

Be happy, spread happiness…

**Download Link**