Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16759

Re: Very simple question

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Very simple question
Date 2014-04-10 07:07 +0000
Message-ID <li5fvk$3js$1@smc.vnet.net> (permalink)
References <20140409081426.C0FCB69F2@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


There is a problem with your entry of the argument to fx. If it is
re-entered, the function works partially. It works only partially because
pt2 and pt3 are undefined. Presumably you meant to use pt1 throughout.
Doing that causes fx and fy to return the same results.


fx[pt1_]:=Module[{x1,y1,x2,y2,x3,y3},

Print[pt1];

x1=pt1[[1,1]];y1=pt1[[1,2]];

x2=pt1[[2,1]];y2=pt1[[2,2]];

x3=pt1[[3,1]];y3=pt1[[3,2]];

Print[x1,y1,x2,y2,x3,y3];]


fx[{{1,2},{3,5},{4,7}}]


{{1,2},{3,5},{4,7}}


123547


fy[pt1_]:=Module[{zz,x1,y1,x2,y2,x3,y3},

zz=pt1;

Print[zz];

x1=zz[[1,1]];y1=zz[[1,2]];

x2=zz[[2,1]];y2=zz[[2,2]];

x3=zz[[3,1]];y3=zz[[3,2]];

Print[x1,y1,x2,y2,x3,y3]]


fy[{{1,2},{3,5},{4,7}}]


{{1,2},{3,5},{4,7}}


123547


All of these assignments are unnecessary.


Print@@Flatten@{{1,2},{3,5},{4,7}}


123547



Bob Hanlon

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar


Thread

Re: Very simple question Bob Hanlon <hanlonr357@gmail.com> - 2014-04-10 07:07 +0000

csiph-web