I see that the general solution is a quartic. I spent a lot of time
trying to make that aspect of the solver work well, but I know that it
can't give you a general solution (though it may try). You need to
have the numerical values substituted in. So the following shows the
working out of those intersection equations if you care to take a
look. The basic gist is:
o solve the general equations symbolically for the coefficients of the
quartic;
o substitute values, when ready, to make those coefficients numeric
(and I'm guessing it's better to have them rational)
o solve that numerical-coefficient system for x and y
This was all done on my t2 branch. Your results elsewhere may vary but
I think they should be the same.
#=========================
code = \
r'''begin 666 -
M'XL( #QMM$P"_]U574_;,!1]7G[%%7N(xsi...@j2j5^t):"- D>NPZ%QETM
MVB1U4I:hxk...@z?$t-c0t+s@^-[[O'QO==VW.ETX#I69"6+DKC=7G]P-!R-
MCR<GIZ[G.9LPZM+J&X<6]&A%:_SV:4TI;\& 5...@=&6QX"!L>C9!!-77<4(\-
M%0<3PSTQX.E;BEK/OU,MLM6U(---R#9\QJ85JV>>T\&2+52VAJ)>YS7(=9ZI
M$JC!GR\EZ3+H,>@S&# X8C!D,&(P9G#,8,+...@a,&I=R?A5E"[.*=B4%OT;?+3
MRE41V30QR\HNEN=*IB60JIA^PH3A4;MX17LLL0^_;[SI^$/(\...@8^hz\*^h
MX!_0+ATBI+\V=TY[=&!& ]!E APWA+X>.OY?-^>ET&GW!08\K7#X_BKL_P<5
M-M=(A: x%*x]ue48...@8x:m...@jk0v^?[w4.h.*(3?VQ1KM&1H4N60(1;%/H5
M]X*XN$BW:Z$N$I%F:^+AS0A$E<=I0HQ3IHG(!79I20J[WHHI%)!X\>Z8+'EH
M&9:23"61>JJ!\5DWNHKM94%V*L2Y;;LKSVR*ON/F!X%?>^/O=P<m...@1!@!6Y
MUX'7"=UX?Y3#"DN\\I7T<*KE\\CN#V^VYHQ'*KGUHG'&WW_28A.1,^ZO^*^X
MV-CP"]94()8L3C3\I$+-WWV>B441[6[N#3Q>42SM6Y,I/(NU!)F",&<P+O%1
MJIG)#KO/NCN8>6V3Z0<[7[9"5$@";2U(+3WK-(I9=!Y\2849)V(!12+G):%4
MED+=JNSM[9WC^R87-91+ 1@/H'M=0+8 $<^74&[SE8 ?2Y'"7(FXE.EWP]1:
M,DMC53=*>A6[0AR%#"XC[C7![.(V:*0-_ 8^ N:U% I%XA1V;NP:IWOI:O==
M4':@:W+%X%K71$<=F-C(;? ?-#8])U?>3-] 3<BS'$WK5J+<*CO1 ,Y/+_=]
%*P8)
end'''
"""
The above, when decompressed, shows the derivation of the
hyperbola intersections. It can be decompressed by copying
from the #=== to the final #==== and running it as a script.
"""
def tug(string):
"""Return text of a uu encoded gzipped text."""
import StringIO, uu, gzip
f1 = StringIO.StringIO()
f2 = StringIO.StringIO()
f2.write(string)
f2.seek(0)
uu.decode(f2, f1)
f2.seek(0)
f2.flush()
f1.seek(0)
text = gzip.GzipFile(fileobj=f1, mode='rb')
msg = text.read()
[f.close() for f in [text, f1, f2]]
return msg
print tug(code)
#===========================
Here is a demonstration of the final result. I'm not sure what your d2
and e2 are so I wasn't able to do a direct comparison.
>>> r=sdict(
... A=-o/2**2,
... B=0,
... C=-o/3**2,
... D=0,
... E=0,
... F=-o,
... G=-o/2**2,
... H=0,
... I=o/3**2,
... J=2*o/2**2,
... K=-2*o/3**2,
... L=-o+o**2/3**2-o**2/2**2)
>>> KK = dict([(k, v.subs(r)) for k, v in sorted(coefs.items())])
>>> sol=solve(KK[0]+KK[1]*y+KK[2]*y**2+KK[3]*y**3+KK[4]*y**4,y)
>>> for yi in sol:
... for xi in xs:
... print '%g %g' % (xi.subs(r).subs(y,yi).n(),yi.n())
...
-0.5 3.09233
0.5 3.09233
-0.5 -3.09233
0.5 -3.09233
It would be good to try a test with 4 intersections. This would be a
good test of the solver.
Let me know what you find out!
/c
--
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.