Help me on function definition

castironpi at gmail.com castironpi at gmail.com
Sat Mar 29 10:11:19 EDT 2008


On Mar 29, 4:18 am, Roel Schroeven <rschroev_nospam... at fastmail.fm>
wrote:
> aeneng schreef:
>
>
>
>
>
> > Hello everyone,
>
> > I am just starting to use python in numerical cacluation.
> > I need you to help me to see what's wrong with the following piece of
> > codes, which computes the cross product of two vectors and returns
> > the result. u and v are two 3x1 matrix.
>
> > when I import the function, error message show like this
> >>>> import cross
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> >   File "cross.py", line 8
> >     ppp2=u[2]*v[0]-u[0]*v[2]
> >     ^
> > SyntaxError: invalid syntax
>
> > WHAT IS WRONG WITH MY CODE?
>
> > I appreciate your help.
>
> > ##here is the function definition.
> > ##cross.py##
> > def cross(u,v)
> >     """input two vectors u and v in 3-D space,    
> >        output a cross product of vector w, in column or in row
> > accordingly."""
> >     ppp1,ppp2,ppp3=0.0,0.0,0.0
>
> You forgot the : after def cross(u, v)

No; directional is only signed and unsigned.  </tangent>

There's a laptop on my computer.



More information about the Python-list mailing list