[Tutor] Trajectory Syntax Error

Alan Gauld alan.gauld at btinternet.com
Wed Mar 30 19:07:45 CEST 2011


"Carla Jenkins" <carlarjenkins at yahoo.com> wrote

> When I try using trajectory I receive an error.  

What is trajectory? Its not a standard Python function 
so we can't be too helpful in fixing errors unless we 
know more about it.

> Here is the code:
> 
> def logistic(x):
>      return 4*x*(1-x)

This is OK so far...

> ds_logistic11=trajectory(logistic,0.11)

Now this passes your function and a value to trajectory.
That could be right if trajectory looks like:

def trajectory(f,v): return f(v)

but if trajectory looks like:

def trajectory(v): return v

Then your code needs some extra parens adding.

> SyntaxError: invalid syntax

But even then the error would be different so can 
you paste the complete error message so that we 
can see exactly what it says?

But well done for trying to do the code yourself first, 
we do appreciate you taking that effort.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list