문제

I'm very new to Mathematica, so sorry if this has an obvious answer, but:

I'm trying to use NSolve to find the point of intersection between two functions, one of which was made using Interpolation, but it won't give me a solution.

Here is the input:

data = Table[x, {x, 1, 25, 1}];
data2 = Table[x^.5, {x, 1, 25, 1}];
a1 = Interpolation[Transpose[{data, data2}]];
NSolve[a1[z] == 5 - z^.5, z]

And the output:

NSolve[InterpolatingFunction[][z] == 5 - z^0.5, z, Reals]

Thanks for the help!

도움이 되었습니까?

해결책

In[1]:= data = Table[x, {x, 1, 25, 1}];
data2 = Table[x^.5, {x, 1, 25, 1}];
a1 = Interpolation[Transpose[{data, data2}]];
r = z /. FindRoot[a1[z] - (5 - z^.5), {z, 1}];
{r, a1[r], 5 - r^.5}

Out[5]= {6.24994, 2.50001, 2.50001}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top