Please help! I'm attempting to utilize the FindRoot functionality on a function with three arguments that is defined in a module that uses NDSolve. FindRoot is not working! The module is because if input values, it solves it and provides an answer... Any help is GREATLY appreciated! Happy Thanksgiving! Please see code below:
In[30]:= ClearAll SetAttributes[{vhat, khat, w, c, xin, [Delta], v, j}, Constant] khat = .162 xin = .028 vhat = .017
Out[30]= ClearAll
Out[32]= 0.162
Out[33]= 0.028
Out[34]= 0.017
In[35]:= Clear[yOUT, yIN, ytest, nIN, nOUT, WronsFUN, [Lambda], w] WronsFUN[[Lambda], w, xoo_] := Module[{val}, Clear[nIN, nOUT]; nIN = NDSolve[{[Lambda] == -Iwx^(3/2) - vhatx/y[x]y'[x] - 7/2khatx^2/y[x]y'[x] - khatx^3/y[x]y''[x], vhatxin^(-1/2)y[xin] + khatxin^(3/2)*y'[xin] == y[xin], y[xin] == 1}, y[x], {x, xin, 1}]; yIN[x_] = First[y[x] /. nIN]; nOUT = NDSolve[{[Lambda] == -Iwx^(3/2) - vhatx/y[x]y'[x] - 7/2khatx^2/y[x]y'[x] - khatx^3/y[x]y''[x], vhaty[1] + khat*y'[1] == -y[1], y[1] == 1}, y[x], {x, xin, 1}]; yOUT[x_] = First[y[x] /. nOUT]; val = yIN[xoo]yOUT'[xoo] - yOUT[xoo]yIN'[xoo]; val]
In[37]:= FindRoot[WronsFUN[j, 21.67, .038], {j, .1 - .1*I}]
During evaluation of In[37]:= NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 0.028`. >>
During evaluation of In[37]:= ReplaceAll::reps: {NDSolve[{j==(0. -21.67 I) x^(3/2)-(0.017 x (y^[Prime])[x])/y[<<1>>]-(0.567 x^2 (y^[Prime])[x])/y[<<1>>]-(0.162 x^3 (y^[Prime][Prime])[x])/y[<<1>>],0.101594 y[0.028]+0.000759018 (y^[Prime])[0.028]==y[0.028],y[0.028]==1},y[x],{x,0.028,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>
During evaluation of In[37]:= NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 1.`. >>
During evaluation of In[37]:= ReplaceAll::reps: {NDSolve[{j==(0. -21.67 I) x^(3/2)-(0.017 x (y^[Prime])[x])/y[<<1>>]-(0.567 x^2 (y^[Prime])[x])/y[<<1>>]-(0.162 x^3 (y^[Prime][Prime])[x])/y[<<1>>],0.017 y[1]+0.162 (y^[Prime])[1]==-y[1],y[1]==1},y[x],{x,0.028,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>
Out[37]= {j -> 0.1 - 0.1 I}
In[38]:= WronsFUN[7.07812 - 1.98627*I, 21.67, .038]
Out[38]= 1.6058 - 0.555075 I