Followers 0

# Where did I make a mistake. (Simple math)

## 3 posts in this topic

I'm working in java script and I'm having a hard time finding my error. My error started with a var named fx. fx is a math expression and I was sure I did everything correctly but I don't know. fx is a representation of the math expression below. Please help me fix this syntax error.

```var xcoord = 0;
var ycoord = 100;
var degreeOfRotation = 0;
var degree = (-degreeOfRotation *Math.PI)/180;
var smoother = 10;
var innerDisplacement = -3;

var fx =(
smoother
*
Math.pow
(
(
(
(-ycoord*Math.sin(degree))+(-xcoord*cos(degree))-xcoord)
+
xcoord
)
,
)
)
```

##### Share on other sites

It doesn't look like you copied the function properly. You've given just one argument to the Math.pow() function because of the parentheses. You're using a sine and cosine, though those aren't part of the equation, and the cosine isn't using the right Javascript function for it. You should make this an actual function that can be reused as well.

I'd need to see more context to know what all the function constants are for.

This is the actual representation of the function Javascript:

```var xcoord = 0;
var ycoord = 100;
var smoother = 10;

function f(x) {
smoother * Math.pow(x + xcoord, tipAdjuster) + ycoord;
}```

##### Share on other sites

Posted (edited)

Is this what you are trying to do?

a = (-1) * ycoord * Math.sin(degree)
b = (-1) * xcoord * Math.cos(degree)
c = (-1) * xcoord

d = a + b + c

Certainly it does not match f(x).

Edited by iwato