In Grapher, is there any way of indexing multi-values (e.g. "{0,2..10}") or point sets? That is, is there an function (or operator) that takes a multi-valued expression and an integer and returns the i-th item of the expression (an f such that e.g. "f({0,2,5}, 2)" is 2 (for 1 based indexing) or 5 (for 0 based indexing); I don't care about where indexing starts)? Is there a function that takes a point set, a row index and column index and returns the item in the point set at the given row and column? I tried subscripting a multi-valued constant, but it didn't work.
What I'm trying to accomplish overall is to graph a family of equations differing only in the values of coefficients, each of which is dependent on one another. For example, say we want to graph y=mx+b for (m, b) in {(-1, 1), (2, 3), (4, 2)}. If I define m and b as separate sets (m={-1, 2, 4}, b={1, 3, 2}), then the coefficients used are the cross product of m and b and I'll get extraneous pairings (e.g. (m,b)=(-1, 2)).
One solution for two or three coefficients is to define a constant as a set of vectors, then multiply the transpose of a basis vector by the constant to extract a component from a vector. The two problems with this option is that it's a little verbose for my tastes (requiring extra constants for the basis vectors) and doesn't work for four or more coefficients. In the case of the example equation (and writing column vectors as row vectors), we would define:
Another solution is to use the ternary "if-then-else" operator or piecewise form (
). This option is much to verbose for my liking. Example:
What other approaches can you think of, elegant or not?
I could use a more powerful math program to graph the family of equations, but the point here is to get Grapher to do it. Hopefully, someone will come up with something worthy enough to put on the MacRumors' Grapher guide.
Looking for ideas, I've read through Yves Baros' guide, checked Terry Lindenmuth's documentation and the Curvus Pro 3.1 manual with no success.
What I'm trying to accomplish overall is to graph a family of equations differing only in the values of coefficients, each of which is dependent on one another. For example, say we want to graph y=mx+b for (m, b) in {(-1, 1), (2, 3), (4, 2)}. If I define m and b as separate sets (m={-1, 2, 4}, b={1, 3, 2}), then the coefficients used are the cross product of m and b and I'll get extraneous pairings (e.g. (m,b)=(-1, 2)).
One solution for two or three coefficients is to define a constant as a set of vectors, then multiply the transpose of a basis vector by the constant to extract a component from a vector. The two problems with this option is that it's a little verbose for my tastes (requiring extra constants for the basis vectors) and doesn't work for four or more coefficients. In the case of the example equation (and writing column vectors as row vectors), we would define:
- mb := {<-1, 1>, <2,3>, <4,2>}
- e_0 := <1,0>
- e_1 := <0,1>
- y = (e_0^T mb) x + (e_1^T mb)
Another solution is to use the ternary "if-then-else" operator or piecewise form (

- n := {0..2}
- m(n) := (n==0) ? -1 : ((n==1) ? 2 : ((n==2) ? 4 : 0))
- y = m(n) x + b(n)
What other approaches can you think of, elegant or not?
I could use a more powerful math program to graph the family of equations, but the point here is to get Grapher to do it. Hopefully, someone will come up with something worthy enough to put on the MacRumors' Grapher guide.
Looking for ideas, I've read through Yves Baros' guide, checked Terry Lindenmuth's documentation and the Curvus Pro 3.1 manual with no success.
Last edited: