Selecting parts of algebraic expressions?

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











up vote
5
down vote

favorite












 (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


Is there a command to select factor polynomial



(a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)


and exponent of E



(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


from the top expression?










share|improve this question



























    up vote
    5
    down vote

    favorite












     (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


    Is there a command to select factor polynomial



    (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)


    and exponent of E



    (a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


    from the top expression?










    share|improve this question

























      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











       (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


      Is there a command to select factor polynomial



      (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)


      and exponent of E



      (a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


      from the top expression?










      share|improve this question















       (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


      Is there a command to select factor polynomial



      (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1)


      and exponent of E



      (a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2)


      from the top expression?







      algebraic-manipulation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 1 at 6:51









      kglr

      164k8188388




      164k8188388










      asked Oct 1 at 6:00









      Chandan Sharma

      795




      795




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          6
          down vote













          myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1) 
          E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

          myEq /. a_ E^b_ -> a


          and



          myEq /. a_ E^b_ -> b





          share|improve this answer



























            up vote
            5
            down vote













            You can use Exponent and Coefficient as follows:



            exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

            Exponent[exp, E]



            e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2




            Coefficient[exp, E, Exponent[exp, E]]



            e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2







            share|improve this answer



























              up vote
              1
              down vote













              Another way. It works because both of the sub-expressions to be extracted have head Plus and are the only ones to do so.



              expr = 
              (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
              E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
              expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];




              factr



              e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2



              expon



              e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2






              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
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182915%2fselecting-parts-of-algebraic-expressions%23new-answer', 'question_page');

                );

                Post as a guest






























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                6
                down vote













                myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1) 
                E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                myEq /. a_ E^b_ -> a


                and



                myEq /. a_ E^b_ -> b





                share|improve this answer
























                  up vote
                  6
                  down vote













                  myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1) 
                  E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                  myEq /. a_ E^b_ -> a


                  and



                  myEq /. a_ E^b_ -> b





                  share|improve this answer






















                    up vote
                    6
                    down vote










                    up vote
                    6
                    down vote









                    myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1) 
                    E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                    myEq /. a_ E^b_ -> a


                    and



                    myEq /. a_ E^b_ -> b





                    share|improve this answer












                    myEq = (a1 q1^2 + b1 p1^2 + +c1 q1 + d1 p1 + e1) 
                    E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                    myEq /. a_ E^b_ -> a


                    and



                    myEq /. a_ E^b_ -> b






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 1 at 6:24









                    David G. Stork

                    21.7k11747




                    21.7k11747




















                        up vote
                        5
                        down vote













                        You can use Exponent and Coefficient as follows:



                        exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                        Exponent[exp, E]



                        e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2




                        Coefficient[exp, E, Exponent[exp, E]]



                        e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2







                        share|improve this answer
























                          up vote
                          5
                          down vote













                          You can use Exponent and Coefficient as follows:



                          exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                          Exponent[exp, E]



                          e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2




                          Coefficient[exp, E, Exponent[exp, E]]



                          e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2







                          share|improve this answer






















                            up vote
                            5
                            down vote










                            up vote
                            5
                            down vote









                            You can use Exponent and Coefficient as follows:



                            exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                            Exponent[exp, E]



                            e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2




                            Coefficient[exp, E, Exponent[exp, E]]



                            e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2







                            share|improve this answer












                            You can use Exponent and Coefficient as follows:



                            exp = (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1) E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);

                            Exponent[exp, E]



                            e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2




                            Coefficient[exp, E, Exponent[exp, E]]



                            e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2








                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Oct 1 at 6:48









                            kglr

                            164k8188388




                            164k8188388




















                                up vote
                                1
                                down vote













                                Another way. It works because both of the sub-expressions to be extracted have head Plus and are the only ones to do so.



                                expr = 
                                (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
                                E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
                                expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];




                                factr



                                e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2



                                expon



                                e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2






                                share|improve this answer


























                                  up vote
                                  1
                                  down vote













                                  Another way. It works because both of the sub-expressions to be extracted have head Plus and are the only ones to do so.



                                  expr = 
                                  (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
                                  E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
                                  expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];




                                  factr



                                  e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2



                                  expon



                                  e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2






                                  share|improve this answer
























                                    up vote
                                    1
                                    down vote










                                    up vote
                                    1
                                    down vote









                                    Another way. It works because both of the sub-expressions to be extracted have head Plus and are the only ones to do so.



                                    expr = 
                                    (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
                                    E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
                                    expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];




                                    factr



                                    e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2



                                    expon



                                    e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2






                                    share|improve this answer














                                    Another way. It works because both of the sub-expressions to be extracted have head Plus and are the only ones to do so.



                                    expr = 
                                    (a1 q1^2 + b1 p1^2 + c1 q1 + d1 p1 + e1)
                                    E^(a2 q1^2 + b2 p1^2 + c2 q1 + d2 p1 + e2);
                                    expon, factr = Extract[expr, Delete[-1] /@ Position[expr, Plus]];




                                    factr



                                    e1 + d1 p1 + b1 p1^2 + c1 q1 + a1 q1^2



                                    expon



                                    e2 + d2 p1 + b2 p1^2 + c2 q1 + a2 q1^2







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Oct 1 at 15:09

























                                    answered Oct 1 at 7:15









                                    m_goldberg

                                    82.5k869190




                                    82.5k869190



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182915%2fselecting-parts-of-algebraic-expressions%23new-answer', 'question_page');

                                        );

                                        Post as a guest













































































                                        Popular posts from this blog

                                        How to check contact read email or not when send email to Individual?

                                        Displaying single band from multi-band raster using QGIS

                                        How many registers does an x86_64 CPU actually have?