# How to create Parabola?

**URL:** <https://discourse.processing.org/t/how-to-create-parabola/14213>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [September 26, 2019, 9:11am UTC](https://discourse.processing.org/t/how-to-create-parabola/14213 "2019-09-26T09:11:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![OBadstue](https://avatars.discourse-cdn.com/v4/letter/o/5f8ce5/32.png) [@OBadstue](https://discourse.processing.org/u/OBadstue)\
**Post date:** [September 26, 2019, 9:11am UTC](https://discourse.processing.org/t/how-to-create-parabola/14213/1 "2019-09-26T09:11:19Z")

</div>

So I’m doing a project for school (only been using processing for a week or two), and I’ve been tasked with creating a program that can draw Bézier curves (which i kinda sorted out), and parabolas (preferably on top of eachother). The thing is, i just can’t figure out how to get processing to actually calculate or draw a parabola. I’ve read some people saying i need to use ‘point’, but I couldn’t find any information saying this works.  
Anybody got some info that could help?  
Thanks

My code so far:

```auto
float P0x =100;
float P0y = 260;
float P1x = random(1, 1280);
float P1y = random(1, 720);
float P2x = random(1, 1280);
float P2y = random(1, 720);
float a = 12;
float b = 13;
float c = 14;
float x = 15;
float fx = a*(x*x)+b*x+c;

void setup() {

  size (1280, 720);
  noFill();
  strokeWeight(5);
  stroke(66, 133, 244);
  line(P0x, P0y, P1x, P1y);
  line(P1x, P1y, P2x, P2y);
  stroke(234, 67, 53);
  bezier(P0x, P0y, P1x, P1y, P1x, P1y, P2x, P2y);

  stroke(0);
  fx = a*(x*x)+b*x+c;
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [September 26, 2019, 12:45pm UTC](https://discourse.processing.org/t/how-to-create-parabola/14213/2 "2019-09-26T12:45:12Z")

</div>

Do you know how to make a parable in maths?

Make a for loop x from -100 to 100

then say

```auto

    float scale = 0.08; 
    float y = scale * (x*x);

```

Then `point (x, height-y);` (which maps the y-value upside down)

After this, close the for loop `}`

at the start of `draw()` say `translate(width/2, -30);`

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [September 26, 2019, 1:02pm UTC](https://discourse.processing.org/t/how-to-create-parabola/14213/3 "2019-09-26T13:02:07Z")

</div>

> [@OBadstue](#):
>
> fx = a\*(x _x)+b_ x+c;

fx is my y; the rest see above

Chrisir
