Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Question about ordered pairs and dictionaries.

Hello, what I am trying to do is calculate the composition of two functions that are defined by ordered pairs. The code I have looks like this:

f = {-3:4, -2:2, -1:0, 0:1, 1:3, 2:4, 3:-1} g = {-3:-2, -2:0, -1:-4, 0:0, 1:-3, 2:1, 3:2}

show(g[f[g[0]]])

So, the way I intend for this to work is g[0] should return 0, which will become f[0] which returns 1, which becomes g[1] which should return -3. When I try to run this in sage 5.4, nothing appears to happen. Any help would be really great, thanks!

Question about ordered pairs and dictionaries.

Hello, what I am trying to do is calculate the composition of two use (math) functions within functions that are defined by ordered pairs. The code I have looks like this:

f = {-3:4, -2:2, -1:0, 0:1, 1:3, 2:4, 3:-1} g = {-3:-2, -2:0, -1:-4, 0:0, 1:-3, 2:1, 3:2}

show(g[f[g[0]]])

So, the way I intend for this to work is g[0] should return 0, which will become f[0] which returns 1, which becomes g[1] which should return -3. When I try to run this in sage 5.4, nothing appears to happen. Any help would be really great, thanks!

click to hide/show revision 3
No.3 Revision

Question about ordered pairs and dictionaries.

Hello, what I am trying to do is use (math) functions within functions that are defined by ordered pairs. The code I have looks like this:

f = {-3:4, -2:2, -1:0, 0:1, 1:3, 2:4, 3:-1} g = {-3:-2, -2:0, -1:-4, 0:0, 1:-3, 2:1, 3:2}

show(g[f[g[0]]])

show(g[f[g[0]]])

So, the way I intend for this to work is g[0] should return 0, which will become f[0] which returns 1, which becomes g[1] which should return -3. When I try to run this in sage 5.4, nothing appears to happen. Any help would be really great, thanks!