# Maths functions

I’m trying to use this trajectory formula in Dynamo.

y =(h + xtan(x)) - (gx²/2V₀²cos²(x))

You can see I’ve commented out line 21: d = (math.cos^2(angle))
When I try to run it I get the error >> int is not callable<<
which confuses me as it’s not an integer?

also on line 24 when I try to run that line I get the error >>TypeError: unsupported operand type(s) for ^: ‘float’ and ‘int’<<
but the line before does the exact same thing and works fine!

Can anyone shed some light on this please?

@Alien , hi

i use `x**2`

1 Like

Thanks… but x^2 should work the same as x**2

Strange, it fixed line g = square of e

However it’s still not working for cosine squared (line 21)

I think the square comes after the cos(), So, cos(x)^2 or cos(x)**2.

It’s the cosine that’s squared, not the angle tho?

Ah, after very much googling I find   So… going with this which seems to be OK… we shall see  Also apparently; x^2 is a bitwise XOR… um…

OK… have to admit, something doesn’t look ‘quite’ right here.

1 Like

Hi @Alien ,

Try something like this:

``````y = ystart + x * Math.Tan(angle) - gravity * (Math.Pow(x,2)) / (2 * (Math.Pow(velocity,2) * (Math.Pow(Math.Cos(angle),2))));
``````

2 Likes

Thanks I forgot to say I did fix it:

I’d like to add a bounce - either on the floor or against a wall…
But … it’s scary Just to clarify, it’s the same thing. Mathematically, sin²(x) = sin(x)². However, sin(x)² is not the same as sin(x²). Hopefully that makes things a little clearer.

1 Like

Thanks! Having to read up on all of this is time consuming!
I wish I’d stayed in school I had to double check myself. It’s been a while lol.

And just to reiterate… This forum is awesome and I really, really, really (yes, that much) appreciate all the help 1 Like