Ahhh...I haven't gotten used to noticing the **foo** being interpreted as bold 
by my OutlookExpress. I see that the y*2 and e*2 should actually be y**2 and 
e**2.

The comments I made still apply and the only difference is that the two values 
of y should be substituted into eq3. Doing so yields (quickly) the following 4 
solutions:

0.24915 0.294148
4.4 8.76118
0.24915 0.294148
4.4 8.76118

I see that there are duplicates so perhaps you can take either value of y to 
generate the solution. If so, then what I said/showed before will still work: 
just take y[0] and continue on with the solution process. 

Also, I would recommend that you pass the parameters to hyperplot. I put 
everything together below. Notice that your a2 are the numerical values, but 
symbolically they are handled as na2, etc... in the general-solving part of the 
routine.

def hyperplot(a2, b2, c2, d2, e2):
    """e2 is the distance between foci and a2,b2,c2,d2 are the times
       of arrival the foci, c2 is at the center"""

    a, b, c, e, na2, nb2, nc2, nd2, ne2 = symbols('a b c e na2 nb2 nc2 nd2 ne2')
    r1=dict(
        a = ((na2 - nc2)/2)**2,
        b = ((nb2 - nc2)/2)**2,
        c = ((nd2 - nc2)/2)**2,
        e = ne2/2 )
    r2=dict(
        na2 = a2,
        nb2 = b2,
        nc2 = c2,
        nd2 = d2,
        ne2 = e2)

    eq1 = y**2/(e**2 - a) - (x + e)**2/a + 1
    eq3 = y**2/(e**2 - c) - (x - e)**2/c + 1

    #fails
    #return solve([eq1, eq3], [x, y]) 

    ans = []
    ys = solve(eq1, y)[0] # the two solutions yield duplicate so take first
    xs = solve(eq3.subs(y, yi).as_numer_denom()[0], x)

    # now make subs x->x2; x2->numerical x2
    for xi in xs:
       xi = xi.subs(r1).subs(r2).n()
       yi = ys.subs(r1).subs(r2).subs(x, xi).n()
       ans.append((xi, yi))

    return ans

sol = hyperplot(
    a2 = 5.10125066033543,
    b2 = 1.844025414703168,
    c2 = 2.303750131640994,
    d2 = 0,
    e2 = 3)
for s in sol:
    print '%g %g' % s

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to