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

Turning arguments into exponents

What is this welding tool I found in my attic?

Drawing color tiles using Tikz

When did the Roman Empire fall according to contemporaries?

What would be the ideal melee weapon made of "Phase Metal"?

Are neural networks prone to catastrophic forgetting?

Referring to different instances of the same character in time travel

Storming Area 51

Simple LED driver, transistor and GPIO

What's an appropriate title for a person who deals with conflicts of an Empire?

Can fluent English speakers distinguish “steel”, “still” and “steal”?

Rhombuses, kites etc

In Parshas Chukas, why is first mention of Parah Adumah "פָרָה" instead of "פָּרָה"?

How do you create draggable points inside a graphic image?

Why do people keep referring to Leia as Princess Leia, even after the destruction of Alderaan?

Supporting developers who insist on using their pet language

Machine learning and operations research projects

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

Robbers: The Hidden OEIS Substring

Professor falsely accusing me of cheating in a class he does not teach, two months after end of the class. What precautions should I take?

Why does Hellboy file down his horns?

Does the Dispel Magic spell work on the Mirror Image spell?

Why isn't there research to build a standard lunar, or Martian mobility platform?

What do the horizontal lines in a P-V phase diagram mean?



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

                      ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                      Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                      19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу