# Graphing functions help

**URL:** <https://forum.kirupa.com/t/graphing-functions-help/177820>\
**Category:** Uncategorized\
**Created:** [February 5, 2006, 4:45pm UTC](https://forum.kirupa.com/t/graphing-functions-help/177820 "2006-02-05T16:45:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nugget](https://avatars.discourse-cdn.com/v4/letter/n/ebca7d/32.png) [@nugget](https://forum.kirupa.com/u/nugget)\
**Post date:** [February 5, 2006, 4:45pm UTC](https://forum.kirupa.com/t/graphing-functions-help/177820/1 "2006-02-05T16:45:02Z")

</div>

im trying to make a graphing calculator with drawing API.  
I can’t get it so actionscript draws my line from the function that is produced from user input.

say i have an array

coefficients = [1,3,2,5];

where i is the coefficient of x^1 3 is the coefficient of x^2 and so on.  
i have a function that converts that array to a function like

(1\*(i^1))+(3\*(i^2))+(2\*(i^3))+(5\*(i^4))

and i want to graph this string in a for loop like so

```auto
 
function update(coeffs:Array) {
 func = "";
 len = coeffs.length;
 for (var i = 0; i<len; i++) {
  func += "("+coeffs*+"*(i^"+Number(i+1)+"))";
  i != len-1 ? func += "+" : func += "";
  _root.holder.clear();
  _root.holder.moveTo(0, 0);
  _root.holder.lineStyle(1, 0x000000, 100);
  _root.holder.lineTo(i*10,func);
//this is where i have trouble, it isn't picking up the "i" in the function string so it isn't graphing is what i think
 }
 trace(func);
// if the array is [1,3,2,5] this traces (1*(i^1))+(3*(i^2))+(2*(i^3))+(5*(i^4))
}

```

any help would be greatly appreciated

here is my fla if needed
