Turning arguments into exponentsWhat is -(-2,3,4)?Replace rule also matching complex numbersCollecting terms of even exponentsApplying functions repeatedly on parts of complicated expressionsSplitBy with exponentsTurning table into association for ClassifyCollect with symbolic exponentscoordinate change in a list of pointsTurning a NB into a Repeatable Script?How to Append Sequence of Numbers to List?Expression replacement with variable exponents

Get ids only where one id is null and other isn't

Comparing two limsup's

Can I play a first turn Simic Growth Chamber to have 3 mana available in the second turn?

Rhombuses, kites etc

Single word for "refusing to move to next activity unless present one is completed."

Can I call 112 to check a police officer's identity in the Czech Republic?

Why would guns not work in the dungeon?

What is this welding tool I found in my attic?

How do you create draggable points inside a graphic image?

I wrote two alternate fugue expositions for one subject do both follow good harmonic conventions?

How might the United Kingdom become a republic?

How to disable wifi in Raspberry Pi 4

Why do players in the past play much longer tournaments than today's top players?

What's the minimum number of sensors for a hobby GPS waypoint-following UAV?

Keep milk (or milk alternative) for a day without a fridge

How does a Potion of Poison work?

Why didn't Thanos kill all the Dwarves on Nidavellir?

<schwitz>, <zwinker> etc. Does German always use 2nd Person Singular Imperative verbs for emoticons? If so, why?

Cubic programming and beyond?

Why do Americans say "less than five people"?

What does "it kind of works out" mean?

Leave PhD after one year or finish it to the end?

Matchmaker, Matchmaker, make me a match

SOLVED - GFCI - should my neutral and ground have continuity?



Turning arguments into exponents


What is -(-2,3,4)?Replace rule also matching complex numbersCollecting terms of even exponentsApplying functions repeatedly on parts of complicated expressionsSplitBy with exponentsTurning table into association for ClassifyCollect with symbolic exponentscoordinate change in a list of pointsTurning a NB into a Repeatable Script?How to Append Sequence of Numbers to List?Expression replacement with variable exponents






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4












$begingroup$


I'd like to replace every instance of L[stuff], e.g.,



L[-1,-2,-2]


in an expression with x^(-FromDigits[stuff]), e.g.



x^122


.
But I'm running into an issue-- I'd like to do this with the code



L[-1, -2, -2] /. L[a___] -> x^(FromDigits[-a])


but this produces



2/x^6 + x^4 + x^5.


In trouble-shooting, I noticed that while



L[-1, -2, -2] /. L[a___] -> a


produces the output I expected, namely -1,-2,-2, I found that



L[-1, -2, -2] /. L[a___] -> -a


just produces 4 rather than 1,2,2. I must be misunderstanding how Sequence behaves when it shows up in the right side of a Rule since when I try just inputting -Sequence[-1,-2,-2] I get the expected result 1,2,2. Does anyone see where I'm going wrong? Thanks!










share|improve this question









$endgroup$







  • 2




    $begingroup$
    funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
    $endgroup$
    – AccidentalFourierTransform
    8 hours ago











  • $begingroup$
    @AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
    $endgroup$
    – Diffycue
    8 hours ago

















4












$begingroup$


I'd like to replace every instance of L[stuff], e.g.,



L[-1,-2,-2]


in an expression with x^(-FromDigits[stuff]), e.g.



x^122


.
But I'm running into an issue-- I'd like to do this with the code



L[-1, -2, -2] /. L[a___] -> x^(FromDigits[-a])


but this produces



2/x^6 + x^4 + x^5.


In trouble-shooting, I noticed that while



L[-1, -2, -2] /. L[a___] -> a


produces the output I expected, namely -1,-2,-2, I found that



L[-1, -2, -2] /. L[a___] -> -a


just produces 4 rather than 1,2,2. I must be misunderstanding how Sequence behaves when it shows up in the right side of a Rule since when I try just inputting -Sequence[-1,-2,-2] I get the expected result 1,2,2. Does anyone see where I'm going wrong? Thanks!










share|improve this question









$endgroup$







  • 2




    $begingroup$
    funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
    $endgroup$
    – AccidentalFourierTransform
    8 hours ago











  • $begingroup$
    @AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
    $endgroup$
    – Diffycue
    8 hours ago













4












4








4





$begingroup$


I'd like to replace every instance of L[stuff], e.g.,



L[-1,-2,-2]


in an expression with x^(-FromDigits[stuff]), e.g.



x^122


.
But I'm running into an issue-- I'd like to do this with the code



L[-1, -2, -2] /. L[a___] -> x^(FromDigits[-a])


but this produces



2/x^6 + x^4 + x^5.


In trouble-shooting, I noticed that while



L[-1, -2, -2] /. L[a___] -> a


produces the output I expected, namely -1,-2,-2, I found that



L[-1, -2, -2] /. L[a___] -> -a


just produces 4 rather than 1,2,2. I must be misunderstanding how Sequence behaves when it shows up in the right side of a Rule since when I try just inputting -Sequence[-1,-2,-2] I get the expected result 1,2,2. Does anyone see where I'm going wrong? Thanks!










share|improve this question









$endgroup$




I'd like to replace every instance of L[stuff], e.g.,



L[-1,-2,-2]


in an expression with x^(-FromDigits[stuff]), e.g.



x^122


.
But I'm running into an issue-- I'd like to do this with the code



L[-1, -2, -2] /. L[a___] -> x^(FromDigits[-a])


but this produces



2/x^6 + x^4 + x^5.


In trouble-shooting, I noticed that while



L[-1, -2, -2] /. L[a___] -> a


produces the output I expected, namely -1,-2,-2, I found that



L[-1, -2, -2] /. L[a___] -> -a


just produces 4 rather than 1,2,2. I must be misunderstanding how Sequence behaves when it shows up in the right side of a Rule since when I try just inputting -Sequence[-1,-2,-2] I get the expected result 1,2,2. Does anyone see where I'm going wrong? Thanks!







list-manipulation replacement symbolic polynomials sequence






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









DiffycueDiffycue

2521 silver badge6 bronze badges




2521 silver badge6 bronze badges







  • 2




    $begingroup$
    funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
    $endgroup$
    – AccidentalFourierTransform
    8 hours ago











  • $begingroup$
    @AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
    $endgroup$
    – Diffycue
    8 hours ago












  • 2




    $begingroup$
    funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
    $endgroup$
    – AccidentalFourierTransform
    8 hours ago











  • $begingroup$
    @AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
    $endgroup$
    – Diffycue
    8 hours ago







2




2




$begingroup$
funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
$endgroup$
– AccidentalFourierTransform
8 hours ago





$begingroup$
funny, I asked a very similar question last week, I wonder if its the same issue. Anyway, here is a possible workaround: L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a]).
$endgroup$
– AccidentalFourierTransform
8 hours ago













$begingroup$
@AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
$endgroup$
– Diffycue
8 hours ago




$begingroup$
@AccidentalFourierTransform yup it would appear to be exactly the same issue and my reaction to FullForm[-b] was exactly the same as yours lol
$endgroup$
– Diffycue
8 hours ago










2 Answers
2






active

oldest

votes


















5












$begingroup$

Here's an explanation of why you get 4. As mentioned above, your problem is the use of Rule instead of RuleDelayed, which means the RHS of the rule evaluates before the rule is used. So, let's see what the RHS of the rule evaluates to:



-a //FullForm



List[Times[-1,a]]




So, when evaluated, the rule becomes:



L[a___] -> Times[-1, a]


Now, it should be clear what happens. When the rule is applied, a gets bound to the sequence -1, -2, -2, and so the output (before evaluation) is:



Times[-1, -1, -2, -2]


which evaluates to:




4







share|improve this answer









$endgroup$




















    5












    $begingroup$

    It's just a matter of using RuleDelayed, or rather :> instead of ->.



    L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a])



    x^122




    L[-1, -2, -2] /. L[a___] :> -a



    1, 2, 2







    share|improve this answer









    $endgroup$















      Your Answer








      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',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      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%2f201948%2fturning-arguments-into-exponents%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5












      $begingroup$

      Here's an explanation of why you get 4. As mentioned above, your problem is the use of Rule instead of RuleDelayed, which means the RHS of the rule evaluates before the rule is used. So, let's see what the RHS of the rule evaluates to:



      -a //FullForm



      List[Times[-1,a]]




      So, when evaluated, the rule becomes:



      L[a___] -> Times[-1, a]


      Now, it should be clear what happens. When the rule is applied, a gets bound to the sequence -1, -2, -2, and so the output (before evaluation) is:



      Times[-1, -1, -2, -2]


      which evaluates to:




      4







      share|improve this answer









      $endgroup$

















        5












        $begingroup$

        Here's an explanation of why you get 4. As mentioned above, your problem is the use of Rule instead of RuleDelayed, which means the RHS of the rule evaluates before the rule is used. So, let's see what the RHS of the rule evaluates to:



        -a //FullForm



        List[Times[-1,a]]




        So, when evaluated, the rule becomes:



        L[a___] -> Times[-1, a]


        Now, it should be clear what happens. When the rule is applied, a gets bound to the sequence -1, -2, -2, and so the output (before evaluation) is:



        Times[-1, -1, -2, -2]


        which evaluates to:




        4







        share|improve this answer









        $endgroup$















          5












          5








          5





          $begingroup$

          Here's an explanation of why you get 4. As mentioned above, your problem is the use of Rule instead of RuleDelayed, which means the RHS of the rule evaluates before the rule is used. So, let's see what the RHS of the rule evaluates to:



          -a //FullForm



          List[Times[-1,a]]




          So, when evaluated, the rule becomes:



          L[a___] -> Times[-1, a]


          Now, it should be clear what happens. When the rule is applied, a gets bound to the sequence -1, -2, -2, and so the output (before evaluation) is:



          Times[-1, -1, -2, -2]


          which evaluates to:




          4







          share|improve this answer









          $endgroup$



          Here's an explanation of why you get 4. As mentioned above, your problem is the use of Rule instead of RuleDelayed, which means the RHS of the rule evaluates before the rule is used. So, let's see what the RHS of the rule evaluates to:



          -a //FullForm



          List[Times[-1,a]]




          So, when evaluated, the rule becomes:



          L[a___] -> Times[-1, a]


          Now, it should be clear what happens. When the rule is applied, a gets bound to the sequence -1, -2, -2, and so the output (before evaluation) is:



          Times[-1, -1, -2, -2]


          which evaluates to:




          4








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 7 hours ago









          Carl WollCarl Woll

          86.7k3 gold badges114 silver badges221 bronze badges




          86.7k3 gold badges114 silver badges221 bronze badges























              5












              $begingroup$

              It's just a matter of using RuleDelayed, or rather :> instead of ->.



              L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a])



              x^122




              L[-1, -2, -2] /. L[a___] :> -a



              1, 2, 2







              share|improve this answer









              $endgroup$

















                5












                $begingroup$

                It's just a matter of using RuleDelayed, or rather :> instead of ->.



                L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a])



                x^122




                L[-1, -2, -2] /. L[a___] :> -a



                1, 2, 2







                share|improve this answer









                $endgroup$















                  5












                  5








                  5





                  $begingroup$

                  It's just a matter of using RuleDelayed, or rather :> instead of ->.



                  L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a])



                  x^122




                  L[-1, -2, -2] /. L[a___] :> -a



                  1, 2, 2







                  share|improve this answer









                  $endgroup$



                  It's just a matter of using RuleDelayed, or rather :> instead of ->.



                  L[-1, -2, -2] /. L[a___] :> x^(FromDigits[-a])



                  x^122




                  L[-1, -2, -2] /. L[a___] :> -a



                  1, 2, 2








                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 8 hours ago









                  That Gravity GuyThat Gravity Guy

                  2,2311 gold badge6 silver badges15 bronze badges




                  2,2311 gold badge6 silver badges15 bronze badges



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f201948%2fturning-arguments-into-exponents%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її