Eduardo Munizaga Asked: 2020-02-15 18:34:05 +0800 CST 2020-02-15 18:34:05 +0800 CST 2020-02-15 18:34:05 +0800 CST How to represent the Love Formula in Python? 772 In order to celebrate this February 14, it would be good to know how a computer scientist can represent the formula of love. The first thing is to indicate that this is the formula: If we clear the we will have the following solutions: And the task is to represent it in Python. python 1 Answers Voted Best Answer Eduardo Munizaga 2020-02-15T18:34:05+08:002020-02-15T18:34:05+08:00 The representation would be using numpyand matplotlibin this way: import numpy as np import matplotlib.pyplot as plt x = np.linspace(-1,1,50) y1 = np.sqrt(x * x) + np.sqrt(1 - x * x) y2 = np.sqrt(x * x) - np.sqrt(1 - x * x) plt.plot(x, y1, c='r', lw = 3) plt.plot(x, y2, c='r', lw = 3) plt.show() And the result: Happy Valentines Day ! Note: Idea copied verbatim from here .
The representation would be using
numpy
andmatplotlib
in this way:And the result:
Happy Valentines Day !
Note: Idea copied verbatim from here .