Vector-valued ParametricNDSolve, solving for a combinationVector ParametricNDSolve and FindRoot interactionIs it possible to give the closed-form of the stiffness matrix of triangular prism element?Frequency domain Maxwell equations with PML boundary conditionsJacobian of ParametricNDSolve and FindRoot for the Three Body ProblemGiven a vector field construct a corresponding stream functionNumerically solving two coupled nonlinear PDEs

Digital signature that is only verifiable by one specific person

When is the phrase "j'ai bon" used?

How did the European Union reach the figure of 3% as a maximum allowed deficit?

King or Queen-Which piece is which?

What is the context for Napoleon's quote "[the Austrians] did not know the value of five minutes"?

Checking if argument is a floating point without breaking on control sequences in argument

Boundaries and Buddhism

How can I prevent a user from copying files on another hard drive?

How to make a villain when your PCs are villains?

How to address players struggling with simple controls?

Build a scale without computer

Are there any individual aliens that have gained superpowers in the Marvel universe?

How can I maintain game balance while allowing my player to craft genuinely useful items?

Got a new frameset, don't know why I need this split ring collar?

In windows systems, is renaming files functionally similar to deleting them?

How can the US president give an order to a civilian?

Is it a bad idea to have a pen name with only an initial for a surname?

How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?

how to find which software is doing ssh connection?

Is this broken pipe the reason my freezer is not working? Can it be fixed?

How did space travel spread throughout the Star Wars galaxy?

Using roof rails to set up hammock

What is "dot" sign in •NO?

How do I correctly reduce geometry on part of a mesh?



Vector-valued ParametricNDSolve, solving for a combination


Vector ParametricNDSolve and FindRoot interactionIs it possible to give the closed-form of the stiffness matrix of triangular prism element?Frequency domain Maxwell equations with PML boundary conditionsJacobian of ParametricNDSolve and FindRoot for the Three Body ProblemGiven a vector field construct a corresponding stream functionNumerically solving two coupled nonlinear PDEs













4












$begingroup$


I am integrating two vector differential equations using ParametricNDSolve, one for $mathbfY$ and one for $mathbfZ$, and then I'm interested in a combination of the two of them. ParametricNDSolve allows for specifying the output to just be a function of the two, for instance $mathbfY cdot mathbfZ$, but the combination I want is (for the case of sixth order vector equations):
$$psi = y_1 z_6 -y_2 z_5 + y_3 z_4 + y_4 z_3 - y_5 z_2 +y_6 z_1$$



Is there a way to get ParametricNDSolve to give me this combination directly?



Example code:



A = 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, q, 0, -Sin[x], 0;
Q[x_, q_] = 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -Sin[x],0, 0, 1, 0,
0, 0, 0, 0, 1, 0, -q, 0, 0, -Sin[x], 0, 1, 0, -q, 0, 0, 0, 0;
n = Length[Q[x, q]];
cA = With[code = N@A, Compile[x, _Real, q, _Real, code]];
F[x_?NumericQ, q_?NumericQ, Y_?VectorQ] :=
(Q[x, q] - DiagonalMatrix[ConstantArray[1, n]]).Y;
xa = -4; xb = 4; xm = 0;
k = -((-xb + xm)/(xa - xm)); c = -((-xa xm + xb xm)/(xa - xm));
Y0 = 0, 0, 0, 0, -1, 0;
Z0 = 0, 1, 0, 0, 0, 0;

YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
Z'[x] == 1/k F[k x + c , q, Z[x]], Z[xa] == Z0, Y, Z, x, xa, xm, q];


I'm interested in finding where $psi=0$, which I can do with this construction, but is there a more direct way to get it out of the ParametricNDSolveValue?



psi[q_?NumericQ] := (Y[1] Z[6] - Y[2] Z[5] + Y[3] Z[4] + Y[4] Z[3] - 
Y[5] Z[2] + Y[6] Z[1]) /. Y[a_] :> YZsol[q][[1]][xm][[a]],
Z[a_] :> YZsol[q][[2]][xm][[a]];

FindRoot[psi[q], q, 3]


Edit:



Carl's answer does exactly what I need, but I see a strange timing effect, where after I use FindRoot it takes 6 times longer to do the same calculation:



Clear[YZsol2]; YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0, Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q]; 
AbsoluteTiming[YZsol2 /@ Range[20]]
(* 0.259752, Null *)

Clear[YZsol3]; YZsol3 =
ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q];
FindRoot[YZsol3[q], q, 3];
AbsoluteTiming[YZsol3 /@ Range[20]]
(* 1.69719, Null *)









share|improve this question











$endgroup$
















    4












    $begingroup$


    I am integrating two vector differential equations using ParametricNDSolve, one for $mathbfY$ and one for $mathbfZ$, and then I'm interested in a combination of the two of them. ParametricNDSolve allows for specifying the output to just be a function of the two, for instance $mathbfY cdot mathbfZ$, but the combination I want is (for the case of sixth order vector equations):
    $$psi = y_1 z_6 -y_2 z_5 + y_3 z_4 + y_4 z_3 - y_5 z_2 +y_6 z_1$$



    Is there a way to get ParametricNDSolve to give me this combination directly?



    Example code:



    A = 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, q, 0, -Sin[x], 0;
    Q[x_, q_] = 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -Sin[x],0, 0, 1, 0,
    0, 0, 0, 0, 1, 0, -q, 0, 0, -Sin[x], 0, 1, 0, -q, 0, 0, 0, 0;
    n = Length[Q[x, q]];
    cA = With[code = N@A, Compile[x, _Real, q, _Real, code]];
    F[x_?NumericQ, q_?NumericQ, Y_?VectorQ] :=
    (Q[x, q] - DiagonalMatrix[ConstantArray[1, n]]).Y;
    xa = -4; xb = 4; xm = 0;
    k = -((-xb + xm)/(xa - xm)); c = -((-xa xm + xb xm)/(xa - xm));
    Y0 = 0, 0, 0, 0, -1, 0;
    Z0 = 0, 1, 0, 0, 0, 0;

    YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
    Z'[x] == 1/k F[k x + c , q, Z[x]], Z[xa] == Z0, Y, Z, x, xa, xm, q];


    I'm interested in finding where $psi=0$, which I can do with this construction, but is there a more direct way to get it out of the ParametricNDSolveValue?



    psi[q_?NumericQ] := (Y[1] Z[6] - Y[2] Z[5] + Y[3] Z[4] + Y[4] Z[3] - 
    Y[5] Z[2] + Y[6] Z[1]) /. Y[a_] :> YZsol[q][[1]][xm][[a]],
    Z[a_] :> YZsol[q][[2]][xm][[a]];

    FindRoot[psi[q], q, 3]


    Edit:



    Carl's answer does exactly what I need, but I see a strange timing effect, where after I use FindRoot it takes 6 times longer to do the same calculation:



    Clear[YZsol2]; YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0, Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q]; 
    AbsoluteTiming[YZsol2 /@ Range[20]]
    (* 0.259752, Null *)

    Clear[YZsol3]; YZsol3 =
    ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
    Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q];
    FindRoot[YZsol3[q], q, 3];
    AbsoluteTiming[YZsol3 /@ Range[20]]
    (* 1.69719, Null *)









    share|improve this question











    $endgroup$














      4












      4








      4





      $begingroup$


      I am integrating two vector differential equations using ParametricNDSolve, one for $mathbfY$ and one for $mathbfZ$, and then I'm interested in a combination of the two of them. ParametricNDSolve allows for specifying the output to just be a function of the two, for instance $mathbfY cdot mathbfZ$, but the combination I want is (for the case of sixth order vector equations):
      $$psi = y_1 z_6 -y_2 z_5 + y_3 z_4 + y_4 z_3 - y_5 z_2 +y_6 z_1$$



      Is there a way to get ParametricNDSolve to give me this combination directly?



      Example code:



      A = 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, q, 0, -Sin[x], 0;
      Q[x_, q_] = 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -Sin[x],0, 0, 1, 0,
      0, 0, 0, 0, 1, 0, -q, 0, 0, -Sin[x], 0, 1, 0, -q, 0, 0, 0, 0;
      n = Length[Q[x, q]];
      cA = With[code = N@A, Compile[x, _Real, q, _Real, code]];
      F[x_?NumericQ, q_?NumericQ, Y_?VectorQ] :=
      (Q[x, q] - DiagonalMatrix[ConstantArray[1, n]]).Y;
      xa = -4; xb = 4; xm = 0;
      k = -((-xb + xm)/(xa - xm)); c = -((-xa xm + xb xm)/(xa - xm));
      Y0 = 0, 0, 0, 0, -1, 0;
      Z0 = 0, 1, 0, 0, 0, 0;

      YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
      Z'[x] == 1/k F[k x + c , q, Z[x]], Z[xa] == Z0, Y, Z, x, xa, xm, q];


      I'm interested in finding where $psi=0$, which I can do with this construction, but is there a more direct way to get it out of the ParametricNDSolveValue?



      psi[q_?NumericQ] := (Y[1] Z[6] - Y[2] Z[5] + Y[3] Z[4] + Y[4] Z[3] - 
      Y[5] Z[2] + Y[6] Z[1]) /. Y[a_] :> YZsol[q][[1]][xm][[a]],
      Z[a_] :> YZsol[q][[2]][xm][[a]];

      FindRoot[psi[q], q, 3]


      Edit:



      Carl's answer does exactly what I need, but I see a strange timing effect, where after I use FindRoot it takes 6 times longer to do the same calculation:



      Clear[YZsol2]; YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0, Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q]; 
      AbsoluteTiming[YZsol2 /@ Range[20]]
      (* 0.259752, Null *)

      Clear[YZsol3]; YZsol3 =
      ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
      Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q];
      FindRoot[YZsol3[q], q, 3];
      AbsoluteTiming[YZsol3 /@ Range[20]]
      (* 1.69719, Null *)









      share|improve this question











      $endgroup$




      I am integrating two vector differential equations using ParametricNDSolve, one for $mathbfY$ and one for $mathbfZ$, and then I'm interested in a combination of the two of them. ParametricNDSolve allows for specifying the output to just be a function of the two, for instance $mathbfY cdot mathbfZ$, but the combination I want is (for the case of sixth order vector equations):
      $$psi = y_1 z_6 -y_2 z_5 + y_3 z_4 + y_4 z_3 - y_5 z_2 +y_6 z_1$$



      Is there a way to get ParametricNDSolve to give me this combination directly?



      Example code:



      A = 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, q, 0, -Sin[x], 0;
      Q[x_, q_] = 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, -Sin[x],0, 0, 1, 0,
      0, 0, 0, 0, 1, 0, -q, 0, 0, -Sin[x], 0, 1, 0, -q, 0, 0, 0, 0;
      n = Length[Q[x, q]];
      cA = With[code = N@A, Compile[x, _Real, q, _Real, code]];
      F[x_?NumericQ, q_?NumericQ, Y_?VectorQ] :=
      (Q[x, q] - DiagonalMatrix[ConstantArray[1, n]]).Y;
      xa = -4; xb = 4; xm = 0;
      k = -((-xb + xm)/(xa - xm)); c = -((-xa xm + xb xm)/(xa - xm));
      Y0 = 0, 0, 0, 0, -1, 0;
      Z0 = 0, 1, 0, 0, 0, 0;

      YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
      Z'[x] == 1/k F[k x + c , q, Z[x]], Z[xa] == Z0, Y, Z, x, xa, xm, q];


      I'm interested in finding where $psi=0$, which I can do with this construction, but is there a more direct way to get it out of the ParametricNDSolveValue?



      psi[q_?NumericQ] := (Y[1] Z[6] - Y[2] Z[5] + Y[3] Z[4] + Y[4] Z[3] - 
      Y[5] Z[2] + Y[6] Z[1]) /. Y[a_] :> YZsol[q][[1]][xm][[a]],
      Z[a_] :> YZsol[q][[2]][xm][[a]];

      FindRoot[psi[q], q, 3]


      Edit:



      Carl's answer does exactly what I need, but I see a strange timing effect, where after I use FindRoot it takes 6 times longer to do the same calculation:



      Clear[YZsol2]; YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0, Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q]; 
      AbsoluteTiming[YZsol2 /@ Range[20]]
      (* 0.259752, Null *)

      Clear[YZsol3]; YZsol3 =
      ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
      Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y[xm].form.Z[xm], x, xa, xm, q];
      FindRoot[YZsol3[q], q, 3];
      AbsoluteTiming[YZsol3 /@ Range[20]]
      (* 1.69719, Null *)






      differential-equations






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 31 at 19:42







      KraZug

















      asked May 31 at 12:22









      KraZugKraZug

      3,71421131




      3,71421131




















          2 Answers
          2






          active

          oldest

          votes


















          5












          $begingroup$

          Define a quadratic form matrix:



          form = 
          0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, -1, 0,
          0, 0, 0, 1, 0, 0,
          0, 0, 1, 0, 0, 0,
          0, -1, 0, 0, 0, 0,
          1, 0, 0, 0, 0, 0
          ;


          Then:



          YZsol2 = ParametricNDSolveValue[
          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          Y[xm] . form . Z[xm],
          x,xa,xm,
          q
          ];


          will produce the desired function. For example:



          YZsol2 /@ Range[0, 4]
          psi /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Another possibility is to include your desired output as an additional equation (constraint):



          YZsol3 = ParametricNDSolveValue[

          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          U[x] == Y[x] . form . Z[x]
          ,
          U[xm],
          x,xa,xm,
          q
          ];


          Check:



          YZsol3 /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Note that there is a bug as of June 2019 with using this inside a FindRoot, which makes it much slower unless we add Method -> "ParametricSensitivity" -> None as detailed in Vector ParametricNDSolve and FindRoot interaction).






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, of course that is a way to write it as a vector/matrix equation
            $endgroup$
            – KraZug
            May 31 at 14:31











          • $begingroup$
            Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
            $endgroup$
            – KraZug
            May 31 at 14:42










          • $begingroup$
            I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
            $endgroup$
            – KraZug
            Jun 7 at 7:35


















          2












          $begingroup$

          A hybrid of yours and @CarlWoll's approach seems to perform well after FindRoot.



          Clear[YZsol, psi2]
          form = Reverse@DiagonalMatrix@PadRight[, 6, 1, -1, 1];
          YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y, Z, x, xa,
          xm, q];
          psi2[q_?NumericQ] := (Y.form.Z) /. Y :> YZsol[q][[1]][xm],
          Z :> YZsol[q][[2]][xm];
          FindRoot[psi2[q], q, 3]
          AbsoluteTiming[psi2 /@ Range[20]]

          Clear[YZsol2];
          YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          AbsoluteTiming[YZsol2 /@ Range[20]]


          Clear[YZsol3]; YZsol3 =
          ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          FindRoot[YZsol3[q], q, 3];
          AbsoluteTiming[YZsol3 /@ Range[20]]
          (* q -> 3.55393 *)
          (* 0.279002, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 0.337883, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 2.20664, -148.785, -6240.83, -7841.05, 12815., 63393.6,
          134180., 197976., 214748.,
          139054., -71335.6, -446840., -998421., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22467*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)





          share|improve this answer









          $endgroup$












          • $begingroup$
            Er… what's the difference between YZsol2 and YZsol3?
            $endgroup$
            – xzczd
            Jun 1 at 4:53










          • $begingroup$
            @xzczd, there is no difference, just one has FindRoot applied first
            $endgroup$
            – KraZug
            Jun 1 at 6:40










          • $begingroup$
            @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
            $endgroup$
            – xzczd
            Jun 1 at 9:09










          • $begingroup$
            This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
            $endgroup$
            – KraZug
            Jun 1 at 9:11










          • $begingroup$
            @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
            $endgroup$
            – KraZug
            Jun 1 at 9:13











          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%2f199458%2fvector-valued-parametricndsolve-solving-for-a-combination%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$

          Define a quadratic form matrix:



          form = 
          0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, -1, 0,
          0, 0, 0, 1, 0, 0,
          0, 0, 1, 0, 0, 0,
          0, -1, 0, 0, 0, 0,
          1, 0, 0, 0, 0, 0
          ;


          Then:



          YZsol2 = ParametricNDSolveValue[
          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          Y[xm] . form . Z[xm],
          x,xa,xm,
          q
          ];


          will produce the desired function. For example:



          YZsol2 /@ Range[0, 4]
          psi /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Another possibility is to include your desired output as an additional equation (constraint):



          YZsol3 = ParametricNDSolveValue[

          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          U[x] == Y[x] . form . Z[x]
          ,
          U[xm],
          x,xa,xm,
          q
          ];


          Check:



          YZsol3 /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Note that there is a bug as of June 2019 with using this inside a FindRoot, which makes it much slower unless we add Method -> "ParametricSensitivity" -> None as detailed in Vector ParametricNDSolve and FindRoot interaction).






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, of course that is a way to write it as a vector/matrix equation
            $endgroup$
            – KraZug
            May 31 at 14:31











          • $begingroup$
            Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
            $endgroup$
            – KraZug
            May 31 at 14:42










          • $begingroup$
            I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
            $endgroup$
            – KraZug
            Jun 7 at 7:35















          5












          $begingroup$

          Define a quadratic form matrix:



          form = 
          0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, -1, 0,
          0, 0, 0, 1, 0, 0,
          0, 0, 1, 0, 0, 0,
          0, -1, 0, 0, 0, 0,
          1, 0, 0, 0, 0, 0
          ;


          Then:



          YZsol2 = ParametricNDSolveValue[
          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          Y[xm] . form . Z[xm],
          x,xa,xm,
          q
          ];


          will produce the desired function. For example:



          YZsol2 /@ Range[0, 4]
          psi /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Another possibility is to include your desired output as an additional equation (constraint):



          YZsol3 = ParametricNDSolveValue[

          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          U[x] == Y[x] . form . Z[x]
          ,
          U[xm],
          x,xa,xm,
          q
          ];


          Check:



          YZsol3 /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Note that there is a bug as of June 2019 with using this inside a FindRoot, which makes it much slower unless we add Method -> "ParametricSensitivity" -> None as detailed in Vector ParametricNDSolve and FindRoot interaction).






          share|improve this answer











          $endgroup$












          • $begingroup$
            Thanks, of course that is a way to write it as a vector/matrix equation
            $endgroup$
            – KraZug
            May 31 at 14:31











          • $begingroup$
            Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
            $endgroup$
            – KraZug
            May 31 at 14:42










          • $begingroup$
            I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
            $endgroup$
            – KraZug
            Jun 7 at 7:35













          5












          5








          5





          $begingroup$

          Define a quadratic form matrix:



          form = 
          0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, -1, 0,
          0, 0, 0, 1, 0, 0,
          0, 0, 1, 0, 0, 0,
          0, -1, 0, 0, 0, 0,
          1, 0, 0, 0, 0, 0
          ;


          Then:



          YZsol2 = ParametricNDSolveValue[
          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          Y[xm] . form . Z[xm],
          x,xa,xm,
          q
          ];


          will produce the desired function. For example:



          YZsol2 /@ Range[0, 4]
          psi /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Another possibility is to include your desired output as an additional equation (constraint):



          YZsol3 = ParametricNDSolveValue[

          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          U[x] == Y[x] . form . Z[x]
          ,
          U[xm],
          x,xa,xm,
          q
          ];


          Check:



          YZsol3 /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Note that there is a bug as of June 2019 with using this inside a FindRoot, which makes it much slower unless we add Method -> "ParametricSensitivity" -> None as detailed in Vector ParametricNDSolve and FindRoot interaction).






          share|improve this answer











          $endgroup$



          Define a quadratic form matrix:



          form = 
          0, 0, 0, 0, 0, 1,
          0, 0, 0, 0, -1, 0,
          0, 0, 0, 1, 0, 0,
          0, 0, 1, 0, 0, 0,
          0, -1, 0, 0, 0, 0,
          1, 0, 0, 0, 0, 0
          ;


          Then:



          YZsol2 = ParametricNDSolveValue[
          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          Y[xm] . form . Z[xm],
          x,xa,xm,
          q
          ];


          will produce the desired function. For example:



          YZsol2 /@ Range[0, 4]
          psi /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Another possibility is to include your desired output as an additional equation (constraint):



          YZsol3 = ParametricNDSolveValue[

          Y'[x] == F[x,q,Y[x]], Y[xa]==Y0,
          Z'[x] == 1/k F[k x+c,q,Z[x]], Z[xa]==Z0,
          U[x] == Y[x] . form . Z[x]
          ,
          U[xm],
          x,xa,xm,
          q
          ];


          Check:



          YZsol3 /@ Range[0, 4]



          -24.1853, -148.784, -6240.84, -7841.06, 12815.




          Note that there is a bug as of June 2019 with using this inside a FindRoot, which makes it much slower unless we add Method -> "ParametricSensitivity" -> None as detailed in Vector ParametricNDSolve and FindRoot interaction).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 7 at 7:20









          KraZug

          3,71421131




          3,71421131










          answered May 31 at 14:13









          Carl WollCarl Woll

          84.1k3107218




          84.1k3107218











          • $begingroup$
            Thanks, of course that is a way to write it as a vector/matrix equation
            $endgroup$
            – KraZug
            May 31 at 14:31











          • $begingroup$
            Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
            $endgroup$
            – KraZug
            May 31 at 14:42










          • $begingroup$
            I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
            $endgroup$
            – KraZug
            Jun 7 at 7:35
















          • $begingroup$
            Thanks, of course that is a way to write it as a vector/matrix equation
            $endgroup$
            – KraZug
            May 31 at 14:31











          • $begingroup$
            Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
            $endgroup$
            – KraZug
            May 31 at 14:42










          • $begingroup$
            I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
            $endgroup$
            – KraZug
            Jun 7 at 7:35















          $begingroup$
          Thanks, of course that is a way to write it as a vector/matrix equation
          $endgroup$
          – KraZug
          May 31 at 14:31





          $begingroup$
          Thanks, of course that is a way to write it as a vector/matrix equation
          $endgroup$
          – KraZug
          May 31 at 14:31













          $begingroup$
          Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
          $endgroup$
          – KraZug
          May 31 at 14:42




          $begingroup$
          Huh, that works really well, except they are both much slower than the original formulation. The constraint version also fails to find the root (presumably because it is using a different internal method on the NDSolve.
          $endgroup$
          – KraZug
          May 31 at 14:42












          $begingroup$
          I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
          $endgroup$
          – KraZug
          Jun 7 at 7:35




          $begingroup$
          I edited your answer to include a link to another question where I show the workaround to not be slow with FindRoot.
          $endgroup$
          – KraZug
          Jun 7 at 7:35











          2












          $begingroup$

          A hybrid of yours and @CarlWoll's approach seems to perform well after FindRoot.



          Clear[YZsol, psi2]
          form = Reverse@DiagonalMatrix@PadRight[, 6, 1, -1, 1];
          YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y, Z, x, xa,
          xm, q];
          psi2[q_?NumericQ] := (Y.form.Z) /. Y :> YZsol[q][[1]][xm],
          Z :> YZsol[q][[2]][xm];
          FindRoot[psi2[q], q, 3]
          AbsoluteTiming[psi2 /@ Range[20]]

          Clear[YZsol2];
          YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          AbsoluteTiming[YZsol2 /@ Range[20]]


          Clear[YZsol3]; YZsol3 =
          ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          FindRoot[YZsol3[q], q, 3];
          AbsoluteTiming[YZsol3 /@ Range[20]]
          (* q -> 3.55393 *)
          (* 0.279002, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 0.337883, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 2.20664, -148.785, -6240.83, -7841.05, 12815., 63393.6,
          134180., 197976., 214748.,
          139054., -71335.6, -446840., -998421., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22467*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)





          share|improve this answer









          $endgroup$












          • $begingroup$
            Er… what's the difference between YZsol2 and YZsol3?
            $endgroup$
            – xzczd
            Jun 1 at 4:53










          • $begingroup$
            @xzczd, there is no difference, just one has FindRoot applied first
            $endgroup$
            – KraZug
            Jun 1 at 6:40










          • $begingroup$
            @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
            $endgroup$
            – xzczd
            Jun 1 at 9:09










          • $begingroup$
            This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
            $endgroup$
            – KraZug
            Jun 1 at 9:11










          • $begingroup$
            @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
            $endgroup$
            – KraZug
            Jun 1 at 9:13















          2












          $begingroup$

          A hybrid of yours and @CarlWoll's approach seems to perform well after FindRoot.



          Clear[YZsol, psi2]
          form = Reverse@DiagonalMatrix@PadRight[, 6, 1, -1, 1];
          YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y, Z, x, xa,
          xm, q];
          psi2[q_?NumericQ] := (Y.form.Z) /. Y :> YZsol[q][[1]][xm],
          Z :> YZsol[q][[2]][xm];
          FindRoot[psi2[q], q, 3]
          AbsoluteTiming[psi2 /@ Range[20]]

          Clear[YZsol2];
          YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          AbsoluteTiming[YZsol2 /@ Range[20]]


          Clear[YZsol3]; YZsol3 =
          ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          FindRoot[YZsol3[q], q, 3];
          AbsoluteTiming[YZsol3 /@ Range[20]]
          (* q -> 3.55393 *)
          (* 0.279002, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 0.337883, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 2.20664, -148.785, -6240.83, -7841.05, 12815., 63393.6,
          134180., 197976., 214748.,
          139054., -71335.6, -446840., -998421., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22467*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)





          share|improve this answer









          $endgroup$












          • $begingroup$
            Er… what's the difference between YZsol2 and YZsol3?
            $endgroup$
            – xzczd
            Jun 1 at 4:53










          • $begingroup$
            @xzczd, there is no difference, just one has FindRoot applied first
            $endgroup$
            – KraZug
            Jun 1 at 6:40










          • $begingroup$
            @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
            $endgroup$
            – xzczd
            Jun 1 at 9:09










          • $begingroup$
            This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
            $endgroup$
            – KraZug
            Jun 1 at 9:11










          • $begingroup$
            @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
            $endgroup$
            – KraZug
            Jun 1 at 9:13













          2












          2








          2





          $begingroup$

          A hybrid of yours and @CarlWoll's approach seems to perform well after FindRoot.



          Clear[YZsol, psi2]
          form = Reverse@DiagonalMatrix@PadRight[, 6, 1, -1, 1];
          YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y, Z, x, xa,
          xm, q];
          psi2[q_?NumericQ] := (Y.form.Z) /. Y :> YZsol[q][[1]][xm],
          Z :> YZsol[q][[2]][xm];
          FindRoot[psi2[q], q, 3]
          AbsoluteTiming[psi2 /@ Range[20]]

          Clear[YZsol2];
          YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          AbsoluteTiming[YZsol2 /@ Range[20]]


          Clear[YZsol3]; YZsol3 =
          ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          FindRoot[YZsol3[q], q, 3];
          AbsoluteTiming[YZsol3 /@ Range[20]]
          (* q -> 3.55393 *)
          (* 0.279002, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 0.337883, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 2.20664, -148.785, -6240.83, -7841.05, 12815., 63393.6,
          134180., 197976., 214748.,
          139054., -71335.6, -446840., -998421., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22467*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)





          share|improve this answer









          $endgroup$



          A hybrid of yours and @CarlWoll's approach seems to perform well after FindRoot.



          Clear[YZsol, psi2]
          form = Reverse@DiagonalMatrix@PadRight[, 6, 1, -1, 1];
          YZsol = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0, Y, Z, x, xa,
          xm, q];
          psi2[q_?NumericQ] := (Y.form.Z) /. Y :> YZsol[q][[1]][xm],
          Z :> YZsol[q][[2]][xm];
          FindRoot[psi2[q], q, 3]
          AbsoluteTiming[psi2 /@ Range[20]]

          Clear[YZsol2];
          YZsol2 = ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          AbsoluteTiming[YZsol2 /@ Range[20]]


          Clear[YZsol3]; YZsol3 =
          ParametricNDSolveValue[Y'[x] == F[x, q, Y[x]], Y[xa] == Y0,
          Z'[x] == 1/k F[k x + c, q, Z[x]], Z[xa] == Z0,
          Y[xm].form.Z[xm], x, xa, xm, q];
          FindRoot[YZsol3[q], q, 3];
          AbsoluteTiming[YZsol3 /@ Range[20]]
          (* q -> 3.55393 *)
          (* 0.279002, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 0.337883, -148.784, -6240.84, -7841.06, 12815., 63393.7,
          134180., 197976., 214749.,
          139054., -71335.6, -446840., -998422., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22468*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)
          (* 2.20664, -148.785, -6240.83, -7841.05, 12815., 63393.6,
          134180., 197976., 214748.,
          139054., -71335.6, -446840., -998421., -1.71155*10^6, -2.5422*10^6,
          -3.41516*10^6, -4.22467*10^6, -4.83742*10^6, -5.09767*10^6,
          -4.83432*10^6, -3.86961*10^6 *)






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 31 at 22:38









          Tim LaskaTim Laska

          1,1911210




          1,1911210











          • $begingroup$
            Er… what's the difference between YZsol2 and YZsol3?
            $endgroup$
            – xzczd
            Jun 1 at 4:53










          • $begingroup$
            @xzczd, there is no difference, just one has FindRoot applied first
            $endgroup$
            – KraZug
            Jun 1 at 6:40










          • $begingroup$
            @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
            $endgroup$
            – xzczd
            Jun 1 at 9:09










          • $begingroup$
            This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
            $endgroup$
            – KraZug
            Jun 1 at 9:11










          • $begingroup$
            @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
            $endgroup$
            – KraZug
            Jun 1 at 9:13
















          • $begingroup$
            Er… what's the difference between YZsol2 and YZsol3?
            $endgroup$
            – xzczd
            Jun 1 at 4:53










          • $begingroup$
            @xzczd, there is no difference, just one has FindRoot applied first
            $endgroup$
            – KraZug
            Jun 1 at 6:40










          • $begingroup$
            @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
            $endgroup$
            – xzczd
            Jun 1 at 9:09










          • $begingroup$
            This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
            $endgroup$
            – KraZug
            Jun 1 at 9:11










          • $begingroup$
            @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
            $endgroup$
            – KraZug
            Jun 1 at 9:13















          $begingroup$
          Er… what's the difference between YZsol2 and YZsol3?
          $endgroup$
          – xzczd
          Jun 1 at 4:53




          $begingroup$
          Er… what's the difference between YZsol2 and YZsol3?
          $endgroup$
          – xzczd
          Jun 1 at 4:53












          $begingroup$
          @xzczd, there is no difference, just one has FindRoot applied first
          $endgroup$
          – KraZug
          Jun 1 at 6:40




          $begingroup$
          @xzczd, there is no difference, just one has FindRoot applied first
          $endgroup$
          – KraZug
          Jun 1 at 6:40












          $begingroup$
          @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
          $endgroup$
          – xzczd
          Jun 1 at 9:09




          $begingroup$
          @KraZug So, if FindRoot is called first, the corresponding ParametricFunction will be slower?
          $endgroup$
          – xzczd
          Jun 1 at 9:09












          $begingroup$
          This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
          $endgroup$
          – KraZug
          Jun 1 at 9:11




          $begingroup$
          This is basically the same as my approach directly. I was thinking that using ParametricNDSolve to calculate the quantity of interest would be faster and perhaps more accurate.
          $endgroup$
          – KraZug
          Jun 1 at 9:11












          $begingroup$
          @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
          $endgroup$
          – KraZug
          Jun 1 at 9:13




          $begingroup$
          @xzczd, exactly. And the FindRoot is slower too. It is marginally faster to evaluate individual points until you use FindRoot , then it slows down considerably
          $endgroup$
          – KraZug
          Jun 1 at 9:13

















          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%2f199458%2fvector-valued-parametricndsolve-solving-for-a-combination%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

          Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

          Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

          Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020