Hello all, is there in Sage a function which tests, if expression1
depends on expression2 ?
Something like Maxima's command freeof?

I searched Sage sources against 'freeof 'and found nothing relevant.

If not, I think that it will be usefull to add the following function
into Sage, but I have no idea, which file is suitable for this
inclusion and where to state that it should be imported automatically
at the begining.

Robert Marik


def freeof(part,expression):
    r"""
    test if expression depends on part

    INPUT: two expressions

    OUTPUT: True or False

    EXAMPLES:
    sage: y=function('y',x)
    sage: x=var('x')
    sage: freeof(x,x^2+3)
    False
    sage: freeof(x^2,x^2+3)
    False
    sage: freeof(x^6,x^2+3)
    True
    sage: freeof(y,x^2+3)
    True
    sage: freeof(diff(y,x),diff(y,x)-4==2)
    False
    sage: freeof(diff(y,x,x),diff(y,x)-4==2)
    True


    ALGORITHM: Calls Maxima's command freeof

    AUTHOR: Robert Marik (10-2009)

    """
    part=part._maxima_()
    ans=part.freeof(expression).str()
    if ans=='true':
        return True
    if ans=='false':
        return False
    else:
        raise NotImplementedError, "freeof cannot find the answer to
your question."
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to