On Tue, Sep 1, 2009 at 6:44 AM, Colin<colinjcot...@gmail.com> wrote:
>
> Dear Sympy list,
>  I'm trying to solve a quartic equation that comes from the numerical
> dispersion relation of a finite element method I am working on. If I
> type
>
>>>> solve(fn,w)
>
> I get
>
> []
>
> which is not what I expected. It's a rather complicated expression so
> I have included it at the bottom of this file. I'd be most grateful if
> someone could point out what I am doing wrong.
>
> best wishes
> --Colin
>
> from sympy import *
> p,q,w,g,f = symbols('pqwgf')
> fn = w*((70400*f**2*g**2 - 2592000*g**3 + 12420*g*f**4 + 132*f**6)*cos
> (p) + (70400*f**2*g**2 - 2592000*g**3 + 12420*g*f**4 + 132*f**6)*cos
> (q) + (70400*f**2*g**2 - 2592000*g**3 + 12420*g*f**4 + 132*f**6)*cos(p
> - q) + (1600*f**2*g**2 - 48000*g**3 + 180*g*f**4 - 12*f**6)*cos(-2*q +
> 2*p) + (25600*f**2*g**2 - 224000*g**3 - 360*g*f**4 + 12*f**6)*cos(p +
> q) + (25600*f**2*g**2 - 224000*g**3 - 360*g*f**4 + 12*f**6)*cos(p -
> 2*q) + (25600*f**2*g**2 - 224000*g**3 - 360*g*f**4 + 12*f**6)*cos(q -
> 2*p)) + w**2*((-800*g**2 - 180*g*f**2 + 18*f**4)*cos(-2*q + 2*p) +
> (-35200*g**2 - 12420*g*f**2 - 198*f**4)*cos(p) + (-35200*g**2 -
> 12420*g*f**2 - 198*f**4)*cos(q) + (-35200*g**2 - 12420*g*f**2 -
> 198*f**4)*cos(p - q) + (-12800*g**2 + 360*g*f**2 - 18*f**4)*cos(p + q)
> + (-12800*g**2 + 360*g*f**2 - 18*f**4)*cos(p - 2*q) + (-12800*g**2 +
> 360*g*f**2 - 18*f**4)*cos(q - 2*p)) + w**3*((-120*g + 12*f**2)*cos(p +
> q) + (-120*g + 12*f**2)*cos(p - 2*q) + (-120*g + 12*f**2)*cos(q - 2*p)
> + (60*g - 12*f**2)*cos(-2*q + 2*p) + (4140*g + 132*f**2)*cos(p) +
> (4140*g + 132*f**2)*cos(q) + (4140*g + 132*f**2)*cos(p - q)) + w**4*
> (-33*cos(p) - 33*cos(q) - 33*cos(p - q) - 3*cos(p + q) - 3*cos(p -
> 2*q) - 3*cos(q - 2*p) + 3*cos(-2*q + 2*p)) + (-35200*f**4*g**2 +
> 2592000*f**2*g**3 - 47360000*g**4 - 4140*g*f**6 - 33*f**8)*cos(p) +
> (-35200*f**4*g**2 + 2592000*f**2*g**3 - 47360000*g**4 - 4140*g*f**6 -
> 33*f**8)*cos(q) + (-35200*f**4*g**2 + 2592000*f**2*g**3 -
> 47360000*g**4 - 4140*g*f**6 - 33*f**8)*cos(p - q) + (-12800*f**4*g**2
> + 224000*f**2*g**3 - 3840000*g**4 + 120*g*f**6 - 3*f**8)*cos(p + q) +
> (-12800*f**4*g**2 + 224000*f**2*g**3 - 3840000*g**4 + 120*g*f**6 -
> 3*f**8)*cos(p - 2*q) + (-12800*f**4*g**2 + 224000*f**2*g**3 -
> 3840000*g**4 + 120*g*f**6 - 3*f**8)*cos(q - 2*p) + (-800*f**4*g**2 +
> 48000*f**2*g**3 - 640000*g**4 - 60*g*f**6 + 3*f**8)*cos(-2*q + 2*p)


With the latest git master, I am even getting an exception:

Traceback (most recent call last):
  File "q.py", line 4, in <module>
    print solve(fn,w)
  File "/home/ondrej/repos/sympy/sympy/solvers/solvers.py", line 207, in solve
    result = roots(poly, cubics=True, quartics=True).keys()
  File "/home/ondrej/repos/sympy/sympy/polys/rootfinding.py", line 291, in roots
    _, factors = poly_factors(f)
  File "/home/ondrej/repos/sympy/sympy/polys/factortools.py", line 36,
in poly_factors
    F = Poly(f, *symbols)
  File "/home/ondrej/repos/sympy/sympy/polys/polynomial.py", line 389,
in __new__
    terms = Poly._decompose(poly.as_basic(), *symbols)
  File "/home/ondrej/repos/sympy/sympy/polys/polynomial.py", line 545,
in _decompose
    raise PolynomialError("Can't decompose %s" % factor)
sympy.polys.polynomial.PolynomialError: Can't decompose cos(q - p)


So that is a bug, I reported it:

http://code.google.com/p/sympy/issues/detail?id=1629

so I think we can't solve it yet, but Chris Smichr is working on
solving quartic equations, even though mostly with numbers, not
symbols as coefficients so far. Maybe he knows how to solve it.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to