Why is this code so slow? The 2019 Stack Overflow Developer Survey Results Are InWhy is FindRoot initial value far from the specified one?Newton-Raphson Method and the Van der Waal Equation Coding questionWhat are the hidden specifications for FindRootHow can I resolve the insufficient memory to complete the computation problem for solving function with iterated variables?Why does this function inside FindRoot fail to evaluate?Very slow mathematica finite differencesManipulate+FindRoot+Plot3D very slow/crashAttacking a “Mathematica can't solve” problemErrors using FindRoot on slow numerical functionAvoiding a for loop to create a list

What must someone know in statistics and machine learning?

Kerning for subscripts of sigma?

A word that means fill it to the required quantity

Did Scotland spend $250,000 for the slogan "Welcome to Scotland"?

Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

What is the motivation for a law requiring 2 parties to consent for recording a conversation

If my opponent casts Ultimate Price on my Phantasmal Bear, can I save it by casting Snap or Curfew?

Why does the nucleus not repel itself?

Why are there uneven bright areas in this photo of black hole?

How do I free up internal storage if I don't have any apps downloaded?

Why isn't the circumferential light around the M87 black hole's event horizon symmetric?

Geography at the pixel level

How to translate "being like"?

Can withdrawing asylum be illegal?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

How do you keep chess fun when your opponent constantly beats you?

Why couldn't they take pictures of a closer black hole?

Is it okay to consider publishing in my first year of PhD?

Mathematics of imaging the black hole

What is preventing me from simply constructing a hash that's lower than the current target?

Are spiders unable to hurt humans, especially very small spiders?

The phrase "to the numbers born"?

What is the most efficient way to store a numeric range?



Why is this code so slow?



The 2019 Stack Overflow Developer Survey Results Are InWhy is FindRoot initial value far from the specified one?Newton-Raphson Method and the Van der Waal Equation Coding questionWhat are the hidden specifications for FindRootHow can I resolve the insufficient memory to complete the computation problem for solving function with iterated variables?Why does this function inside FindRoot fail to evaluate?Very slow mathematica finite differencesManipulate+FindRoot+Plot3D very slow/crashAttacking a “Mathematica can't solve” problemErrors using FindRoot on slow numerical functionAvoiding a for loop to create a list










1












$begingroup$


This code for the first five iterations the speed is okay , but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



 Clear[A, r, x, s, e]
s := 0.3405
e := 1.6539*10^-21
u[0] := 0.
u[1] := 0.1

A[r_] := A[r] =
Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
s [LessSlantEqual] r [LessSlantEqual] 2.5 s, r - s -
24*e*s^-1, r < s]
For[i = 2, i < 101,
i++, u[i_] :=
x /. FindRoot[
u[i - 1] +
1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
0.9 A[x] == x , x, 1.]; Print[u[i]]]









share|improve this question









$endgroup$
















    1












    $begingroup$


    This code for the first five iterations the speed is okay , but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



     Clear[A, r, x, s, e]
    s := 0.3405
    e := 1.6539*10^-21
    u[0] := 0.
    u[1] := 0.1

    A[r_] := A[r] =
    Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
    r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
    s [LessSlantEqual] r [LessSlantEqual] 2.5 s, r - s -
    24*e*s^-1, r < s]
    For[i = 2, i < 101,
    i++, u[i_] :=
    x /. FindRoot[
    u[i - 1] +
    1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
    0.9 A[x] == x , x, 1.]; Print[u[i]]]









    share|improve this question









    $endgroup$














      1












      1








      1





      $begingroup$


      This code for the first five iterations the speed is okay , but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



       Clear[A, r, x, s, e]
      s := 0.3405
      e := 1.6539*10^-21
      u[0] := 0.
      u[1] := 0.1

      A[r_] := A[r] =
      Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
      r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
      s [LessSlantEqual] r [LessSlantEqual] 2.5 s, r - s -
      24*e*s^-1, r < s]
      For[i = 2, i < 101,
      i++, u[i_] :=
      x /. FindRoot[
      u[i - 1] +
      1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
      0.9 A[x] == x , x, 1.]; Print[u[i]]]









      share|improve this question









      $endgroup$




      This code for the first five iterations the speed is okay , but after that the speed is very slow, I cannot understand what is wrong with this? Would you please help me fix it?



       Clear[A, r, x, s, e]
      s := 0.3405
      e := 1.6539*10^-21
      u[0] := 0.
      u[1] := 0.1

      A[r_] := A[r] =
      Piecewise[r - 2.5 s - 48*e *s^12*r^-13 + 24*e*s^6*r^-7,
      r > 2.5 s, -48*e*s^12*r^-13 + 24*e*s^6*r^-7,
      s [LessSlantEqual] r [LessSlantEqual] 2.5 s, r - s -
      24*e*s^-1, r < s]
      For[i = 2, i < 101,
      i++, u[i_] :=
      x /. FindRoot[
      u[i - 1] +
      1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) -
      0.9 A[x] == x , x, 1.]; Print[u[i]]]






      equation-solving iteration






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      morapimorapi

      153




      153




















          1 Answer
          1






          active

          oldest

          votes


















          3












          $begingroup$

          I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



          s = 0.3405;
          e = 1.6539*10^-21;
          u[0] = 0.;
          u[1] = 0.1;

          A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
          -48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
          r - s - 24*e*s^-1, r < s];

          u[i_] := u[i] = x /. FindRoot[
          u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

          Array[u, 100]



          0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
          0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
          1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
          0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
          0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
          0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
          0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
          0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
          0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
          0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
          0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
          0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
          0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
          0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
          0.554408, 0.56675




          (takes about 5 seconds)



          Alternatively, use



          Table[u[i], i, 1, 100]


          (same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






          share|improve this answer











          $endgroup$













            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',
            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%2f195054%2fwhy-is-this-code-so-slow%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3












            $begingroup$

            I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



            s = 0.3405;
            e = 1.6539*10^-21;
            u[0] = 0.;
            u[1] = 0.1;

            A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
            -48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
            r - s - 24*e*s^-1, r < s];

            u[i_] := u[i] = x /. FindRoot[
            u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

            Array[u, 100]



            0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
            0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
            1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
            0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
            0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
            0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
            0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
            0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
            0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
            0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
            0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
            0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
            0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
            0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
            0.554408, 0.56675




            (takes about 5 seconds)



            Alternatively, use



            Table[u[i], i, 1, 100]


            (same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






            share|improve this answer











            $endgroup$

















              3












              $begingroup$

              I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



              s = 0.3405;
              e = 1.6539*10^-21;
              u[0] = 0.;
              u[1] = 0.1;

              A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
              -48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
              r - s - 24*e*s^-1, r < s];

              u[i_] := u[i] = x /. FindRoot[
              u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

              Array[u, 100]



              0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
              0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
              1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
              0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
              0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
              0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
              0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
              0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
              0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
              0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
              0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
              0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
              0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
              0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
              0.554408, 0.56675




              (takes about 5 seconds)



              Alternatively, use



              Table[u[i], i, 1, 100]


              (same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






              share|improve this answer











              $endgroup$















                3












                3








                3





                $begingroup$

                I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



                s = 0.3405;
                e = 1.6539*10^-21;
                u[0] = 0.;
                u[1] = 0.1;

                A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
                -48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
                r - s - 24*e*s^-1, r < s];

                u[i_] := u[i] = x /. FindRoot[
                u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

                Array[u, 100]



                0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
                0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
                1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
                0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
                0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
                0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
                0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
                0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
                0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
                0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
                0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
                0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
                0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
                0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
                0.554408, 0.56675




                (takes about 5 seconds)



                Alternatively, use



                Table[u[i], i, 1, 100]


                (same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.






                share|improve this answer











                $endgroup$



                I recommend you learn the distinction between immediate (=) and delayed (:=) assignments. They make the difference between slow and fast code here. Start with this tutorial or this book chapter, then look at memoization.



                s = 0.3405;
                e = 1.6539*10^-21;
                u[0] = 0.;
                u[1] = 0.1;

                A[r_] = Piecewise[r - 2.5 s - 48*e*s^12*r^-13 + 24*e*s^6*r^-7, r > 2.5 s,
                -48*e*s^12*r^-13 + 24*e*s^6*r^-7, s <= r <= 2.5 s,
                r - s - 24*e*s^-1, r < s];

                u[i_] := u[i] = x /. FindRoot[
                u[i - 1] + 1/(i^2 (u[i - 1] - u[i - 2])^2) (u[i - 1] - u[i - 2]) - 0.9 A[x] == x, x, 1.]

                Array[u, 100]



                0.1, 1.77164, 1.37065, 1.04259, 0.887781, 0.708344, 0.59461,
                0.457228, 0.367364, 0.296071, 0.256104, 0.20463, 0.208487, 1.20917,
                1.04197, 0.939331, 0.879865, 0.827963, 0.774591, 0.72775, 0.67934,
                0.63666, 0.592369, 0.553172, 0.512352, 0.476112, 0.438261, 0.404563,
                0.369277, 0.339073, 0.321616, 0.301118, 0.296195, 0.224688, 0.273538,
                0.31357, 0.33593, 0.366902, 0.38813, 0.417572, 0.437777, 0.465834,
                0.48511, 0.511907, 0.530336, 0.55598, 0.573633, 0.598219, 0.615159,
                0.638772, 0.655054, 0.677768, 0.693441, 0.715321, 0.73043, 0.751535,
                0.766118, 0.786503, 0.800596, 0.820306, 0.833941, 0.852182, 0.85901,
                0.874152, 0.871531, 0.78396, 0.781416, 0.696402, 0.693931, 0.611329,
                0.608927, 0.528603, 0.526267, 0.448099, 0.445825, 0.369701, 0.367485,
                0.315658, 0.325798, 0.341207, 0.351098, 0.366134, 0.375788, 0.390468,
                0.399897, 0.414237, 0.42345, 0.437466, 0.446473, 0.46018, 0.46899,
                0.4824, 0.491022, 0.504149, 0.51259, 0.525444, 0.533712, 0.546306,
                0.554408, 0.56675




                (takes about 5 seconds)



                Alternatively, use



                Table[u[i], i, 1, 100]


                (same result). Your combination of For and Print shows the results but doesn't let you keep using them for more calculations.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 1 hour ago

























                answered 1 hour ago









                RomanRoman

                5,10011130




                5,10011130



























                    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%2f195054%2fwhy-is-this-code-so-slow%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

                    How to make RAID controller rescan devices The 2019 Stack Overflow Developer Survey Results Are InLSI MegaRAID SAS 9261-8i: Disk isn't recognized after replacementHow to monitor the hard disk status behind Dell PERC H710 Raid Controller with CentOS 6?LSI MegaRAID - Recreate missing RAID 1 arrayext. 2-bay USB-Drive with RAID: btrfs RAID vs built-in RAIDInvalid SAS topologyDoes enabling JBOD mode on LSI based controllers affect existing logical disks/arrays?Why is there a shift between the WWN reported from the controller and the Linux system?Optimal RAID 6+0 Setup for 40+ 4TB DisksAccidental SAS cable removal

                    Куамањотепек (Чилапа де Алварез) Садржај Становништво Види још Референце Спољашње везе Мени за навигацију17°19′47″N 99°1′51″W / 17.32972° СГШ; 99.03083° ЗГД / 17.32972; -99.0308317°19′47″N 99°1′51″W / 17.32972° СГШ; 99.03083° ЗГД / 17.32972; -99.030838877656„Instituto Nacional de Estadística y Geografía”„The GeoNames geographical database”Мексичка насељапроширитиуу

                    Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time? The 2019 Stack Overflow Developer Survey Results Are InHow is the altitude of a satellite defined, given that the Earth is not spherical?Why do satellites appear to move faster when overhead and slower closer to the horizon?For the mathematical relationship between J2 (km^5/s^2) and dimensionless J2 - which one is derived from the other?Why is Nodal precession affected by the rotational period of the planet?Why is it so difficult to predict the exact reentry location and time of a very low earth orbit object?Why are low earth orbit satellites not visible from the same place all the time?Perifocal coordinates and the orbit equationHow feasible is the Moonspike mission?What was the typical perigee after a shuttle de-orbit burn?I am having trouble calculating my classic orbital elements and am at a loss on where to lookAm I supposed to modify the gravitational constant with scale and why do fps & time scale changes cause my orbit to break?How Local time of a sun synchronous orbit is related to Right ascension of ascending node?What is wrong with my orbit sim equations? How can I fix them?How to obtain the initial positions and velocities of an inclined orbit?