On Fri, Feb 10, 2012 at 12:17 PM, Laereom <jamesdbo...@gmail.com> wrote: > Curioser and curioser. > > sym_x, sym_y = symbols('x,y') > z = int(origin['z']) > print origin > print destination > > dest_x = int(destination['x']) > dest_y = int(destination['y']) > dest_z = int(destination['z']) > equation = Eq( sqrt( (sym_x-dest_x)**2 + (sym_y-dest_y)**2 + > (z-dest_z)**2 ) , 2 ) > #This should give us a line to walk towards. > print solve( equation,sym_x) > > Output: > {'y': 0, 'x': 0, 'z': 2} > {'y': 3, 'x': 3, 'z': 3} > []
So your equation is (I think) sqrt((x-3)**3+(y-3)**2+(2-3)**2) = 2 No problem is apparent. Make sure you are using the latest sympy; upgrades have been made to solve. > > > I noticed you're using vars, I'm guessing those are sympy related? > Any reason I should worry about using hardcoded values like I am? I > can't imagine why there would be, but I'm not exactly brimming with > solutions. What I'm doing looks pretty similar to what you're doing. > > > On Feb 9, 10:20 pm, Chris Smith <smi...@gmail.com> wrote: >> Can you print your origin and destination variables? When using the >> following, I don't have any problem: >> >> >>> var('a,b,c,x,y,z') >> (a, b, c, x, y, z) >> >>> eq=Eq(sqrt((x-a)**2+(1-b)**2+(z-c)**2), 2) >> >>> solve(eq, x) >> >> [a - sqrt(-b**2 + 2*b - c**2 + 2*c*z - z**2 + 3), a + sqrt(-b**2 + 2*b - >> c**2 + >> 2*c*z - z**2 + 3)] > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.