Just to clarify what Chris is saying, sympy.solve() *only* returns symbolic closed-form solutions. If the equation doesn't have any, or if it just doesn't have the algorithms to find them, it might return an empty solution set. That doesn't mean the equation has no solutions. It just means it couldn't find any closed-form ones.
If you just need a numerical answer, you are better off using nsolve() or a solver from a numeric library like scipy. See https://docs.sympy.org/latest/guides/solving/solve-numerically.html. If you really do want a symbolic solution here, and are convinced one exists, you'll have to do some work yourself manipulating the equations yourself to help SymPy find it, because it doesn't yet have the algorithms to find it on its own. If you find that a closed-form solution does exist, you can open an issue for SymPy to improve its solvers for this equation. Aaron Meurer On Tue, May 28, 2024 at 8:28 AM Chris Smith <smi...@gmail.com> wrote: > > `nsolve(eqs,list(ordered(eqs.free_symbols)),(.4,3,10))` (with eqs defined > with x1= 0,y1=10, x2=10, y2=10, length = 20) gives > `Matrix([[0.326920231236118], [-3.26920231236118], [10.0000000000000]])` > > I doubt there is a closed form solution. You can easily solve the first two > equations for `a` and `c` and then you only have the last equation in `b`. > > /c > > On Saturday, May 25, 2024 at 11:47:00 PM UTC-5 kushwahas...@gmail.com wrote: >> >> I'm sorry , I meant to write x1=0, x2=10. It gives >> >> Eq(Piecewise(((5 + b/(4*a))*sqrt(400*a**2 + 40*a*b + b**2 + 1) - log(4*a*b + >> 4*sqrt(b**2 + 1)*sqrt(a**2))/(4*sqrt(a**2)) + log(80*a**2 + 4*a*b + >> 4*sqrt(400*a**2 + 40*a*b + b**2 + 1)*sqrt(a**2))/(4*sqrt(a**2)) - >> b*sqrt(b**2 + 1)/(4*a), ((a > -oo) & (a < oo) & Ne(a, 0)) | (Ne(a**2, 0) & >> Ne(a*b, 0))), (-(b**2 + 1)**(3/2)/(6*a*b) + (40*a*b + b**2 + >> 1)**(3/2)/(6*a*b), Ne(a*b, 0)), (10*sqrt(b**2 + 1), True)), 20) >> >> but the solution I got is empty i.e. [ ] >> >> Thanks >> Shishir Kushwaha >> >> On Sunday 26 May 2024 at 06:58:37 UTC+5:30 asme...@gmail.com wrote: >>> >>> With x1 = x2 = 0, arc_length_expr is equal to 0, meaning your eq3 is >>> invalid. You can see this if you print eq3. It gets set to False, >>> because it is 0 = 10. >>> >>> Aaron Meurer >>> >>> On Sat, May 25, 2024 at 5:26 PM Shishir Kushwaha >>> <kushwahas...@gmail.com> wrote: >>> > >>> > In the following piece of code I am unable to get the values of a,b and c >>> > after solving them. >>> > Is there a different way to solve it and what am i doing wrong. Take x1 = >>> > 0 , y1=10, x2=0, y2=10, length = 20. >>> > >>> > def get_lowest_point(self): >>> > a, b, c, x = symbols('a b c x') >>> > >>> > x1, y1 = self._left_support >>> > x2, y2 = self._right_support >>> > length = self._length >>> > >>> > eq1 = Eq(a * x1**2 + b * x1 + c, y1) >>> > eq2 = Eq(a * x2**2 + b * x2 + c, y2) >>> > arc_length_expr = integrate(sqrt(1 + (2 * a * x + b)**2), >>> > (x, x1, x2)) >>> > eq3 = Eq(arc_length_expr, length) >>> > solution = solve((eq1, eq2, eq3), (a, b, c)) >>> > >>> > # Print the solution to debug >>> > print("Solution:", solution) >>> > >>> > return solution >>> > >>> > -- >>> > You received this message because you are subscribed to the Google Groups >>> > "sympy" group. >>> > To unsubscribe from this group and stop receiving emails from it, send an >>> > email to sympy+un...@googlegroups.com. >>> > To view this discussion on the web visit >>> > https://groups.google.com/d/msgid/sympy/6f9f85cf-e010-443a-9a5c-b03a359e1132n%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/8af88812-28a8-4841-87f3-ccb3877a9927n%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BAnM9QW%3DfFSS53Zy0FL25m3PTM%2BbTWiWn-3ZAAwRd4Qw%40mail.gmail.com.