Checking what a function depends on

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
7
down vote

favorite
1












I'd like to define specific partial derivative operators that change based on if the passed expression is a function of, for example, x vs. xi. I'm not finding anything in the documentation on how to code a check for the expressions dependence. My question is, if given some function f[x,y], how can I check the variables that it depends on?







share|improve this question









New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 3




    Possible duplicate of How to define custom differential operator using the arguments of the expression?
    – Carl Woll
    Sep 5 at 21:43










  • I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
    – Nasser
    Sep 6 at 1:50















up vote
7
down vote

favorite
1












I'd like to define specific partial derivative operators that change based on if the passed expression is a function of, for example, x vs. xi. I'm not finding anything in the documentation on how to code a check for the expressions dependence. My question is, if given some function f[x,y], how can I check the variables that it depends on?







share|improve this question









New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • 3




    Possible duplicate of How to define custom differential operator using the arguments of the expression?
    – Carl Woll
    Sep 5 at 21:43










  • I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
    – Nasser
    Sep 6 at 1:50













up vote
7
down vote

favorite
1









up vote
7
down vote

favorite
1






1





I'd like to define specific partial derivative operators that change based on if the passed expression is a function of, for example, x vs. xi. I'm not finding anything in the documentation on how to code a check for the expressions dependence. My question is, if given some function f[x,y], how can I check the variables that it depends on?







share|improve this question









New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










I'd like to define specific partial derivative operators that change based on if the passed expression is a function of, for example, x vs. xi. I'm not finding anything in the documentation on how to code a check for the expressions dependence. My question is, if given some function f[x,y], how can I check the variables that it depends on?









share|improve this question









New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Sep 5 at 21:31









kglr

159k8183383




159k8183383






New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Sep 5 at 21:12









mads

383




383




New contributor




mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






mads is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 3




    Possible duplicate of How to define custom differential operator using the arguments of the expression?
    – Carl Woll
    Sep 5 at 21:43










  • I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
    – Nasser
    Sep 6 at 1:50













  • 3




    Possible duplicate of How to define custom differential operator using the arguments of the expression?
    – Carl Woll
    Sep 5 at 21:43










  • I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
    – Nasser
    Sep 6 at 1:50








3




3




Possible duplicate of How to define custom differential operator using the arguments of the expression?
– Carl Woll
Sep 5 at 21:43




Possible duplicate of How to define custom differential operator using the arguments of the expression?
– Carl Woll
Sep 5 at 21:43












I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
– Nasser
Sep 6 at 1:50





I think it should be possible to also use DownValues[f] to find what the function depends on, since the DownValues has the function signature right there. It just needs to be parsed out and to extract all the symbols from inside f[x_,y_,....] and this part might be tricky to do. ?DownValues
– Nasser
Sep 6 at 1:50











1 Answer
1






active

oldest

votes

















up vote
12
down vote



accepted










Perhaps Internal`DependsOnQ:



h = f[x, g[y]];
Internal`DependsOnQ[h, #] & /@ x, y, g[y], w



True, True, True, False







share|improve this answer




















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "387"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );






    mads is a new contributor. Be nice, and check out our Code of Conduct.









     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181300%2fchecking-what-a-function-depends-on%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    12
    down vote



    accepted










    Perhaps Internal`DependsOnQ:



    h = f[x, g[y]];
    Internal`DependsOnQ[h, #] & /@ x, y, g[y], w



    True, True, True, False







    share|improve this answer
























      up vote
      12
      down vote



      accepted










      Perhaps Internal`DependsOnQ:



      h = f[x, g[y]];
      Internal`DependsOnQ[h, #] & /@ x, y, g[y], w



      True, True, True, False







      share|improve this answer






















        up vote
        12
        down vote



        accepted







        up vote
        12
        down vote



        accepted






        Perhaps Internal`DependsOnQ:



        h = f[x, g[y]];
        Internal`DependsOnQ[h, #] & /@ x, y, g[y], w



        True, True, True, False







        share|improve this answer












        Perhaps Internal`DependsOnQ:



        h = f[x, g[y]];
        Internal`DependsOnQ[h, #] & /@ x, y, g[y], w



        True, True, True, False








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 5 at 21:30









        kglr

        159k8183383




        159k8183383




















            mads is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            mads is a new contributor. Be nice, and check out our Code of Conduct.












            mads is a new contributor. Be nice, and check out our Code of Conduct.











            mads is a new contributor. Be nice, and check out our Code of Conduct.













             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181300%2fchecking-what-a-function-depends-on%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            How to decode/decipher Mozilla Firefox proprietary .jsonlz4 format? (sessionstore-backups/recovery.jsonlz4)

            White Anglo-Saxon Protestant

            How to be valuable when automation & IT are stealing my job (and maybe my whole career)? [closed]