LoginSignup
4
1

More than 3 years have passed since last update.

Splunkの中心で愛を叫ぶ Splunk>, with Love

Last updated at Posted at 2020-02-01

:raised_hands:バレンタインデー記念 Celebrate St. Valentine's Day:raised_hands:

Splunk>Answersでもやりました。

Love.png

Love.spl
| makeresults count=2
| streamstats count as x
| eval x=if(x=1,0.00000,1.80000)
| makecontinuous x span=0.01
| eval z=split("A#B#C#D","#")
| stats values(x) as x by z
| stats count by x z
| eval y = case(x < 1 AND (z="A" OR z="C"),exact(pow(x,(2/3))) + exact(sqrt(1 - pow(x,2)))
,x < 1 AND (z="B" OR z="D"),exact(pow(x,(2/3))) - exact(sqrt(1 - pow(x,2))))
| eval x = if(z="C" OR z="D",x * -1, x)
| table x , y
| sort 0 x
| rename y as LOVE

まとめ Conclusion

:grin:チョコ食べたい。:chocolate_bar: I want to eat chocolate.

蛇足的ななにか Superfluity

cf. ハートの方程式 TheFormulaOfHeart
この図は一つのXの点に対して二つのYの点を描画することになります。

それもあり、四象限用の数列を作成するため
makecontinuousで一つの象限の数列を(0〜1)作成し、それをstatsmvexpandで4つに増やしています。

- +
+ C A
- D B

方程式のプラスマイナスは象限により変わりますので、それをeval if()で制御しつつ、Y軸で対象の図形であるため、-1をかけて変換しています。

This figure will draw two Y points for one X point.
Also, to create a sequence for four quadrants
makecontinuous creates a sequence of quadrants (0-1) and increases it to four withstats and mvexpand.

Since the plus and minus of the equation varies depending on the quadrant,
while controlling it with eval if(), since it is the target figure on the Y axis, -1 is multiplied and converted.

4
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1