Guest User

Untitled

a guest
Jan 22nd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. import sympy as sp
  2.  
  3. K0 = 2.00*10**-4
  4. x2, y2 = sp.symbols('x2, y2')
  5. x0 = 500
  6. y0 = 500
  7. R1 = ((x2 - x0)**2 + (y2 - y0)**2)**0.5
  8. R2 = K0 * R1
  9. H2 = sp.atan(R2 * (x2 - x0)/R1)
  10. V2 = sp.atan(R2 * (y2 - y0)/R1)
  11. x, y = sp.symbols('x, y')
  12. x0 = 1.0
  13. y0 = 2.0
  14. x = R1 * H2
  15. y = R1 * V2
  16. dat = sp.nsolve([x - x0, y - y0], [x2, y2], [512, 512]) # This line is the problem
  17. print "dat = %f, %f" % (dat[0], dat[1])
  18.  
  19. File "test.py", line 3, in <module>
  20. demo.test()
  21. File "demo.pyx", line 17, in demo.test
  22. dat = sp.nsolve([x - x0, y - y0], [x2, y2], [512, 512])
  23. File "C:...site-packagessympyutilitiesdecorator.py", line 91, in func_wrapper
  24. return func(*args, **kwargs)
  25. File "C:...site-packagessympysolverssolvers.py", line 2847, in nsolve
  26. x = findroot(f, x0, J=J, **kwargs)
  27. File "C:...site-packagesmpmathcalculusoptimization.py", line 960, in findroot
  28. for x, error in iterations:
  29. File "C:...site-packagesmpmathcalculusoptimization.py", line 658, in __iter__
  30. s = self.ctx.lu_solve(Jx, fxn)
  31. File "C:...site-packagesmpmathmatriceslinalg.py", line 227, in lu_solve
  32. A, p = ctx.LU_decomp(A)
  33. File "C:...site-packagesmpmathmatriceslinalg.py", line 137, in LU_decomp
  34. raise ZeroDivisionError('matrix is numerically singular')
  35. ZeroDivisionError: matrix is numerically singular
Add Comment
Please, Sign In to add comment