We’re rewarding the question askers & reputations are being recalculated! Read more.

# Tag Info

1

pairs = Flatten[Outer[List, Range, Range], 1]; subset = Select[pairs, Total[#] > 9 &]; contains6 = Length[Select[subset, MemberQ[#, 6] &]]; contains6/Length[subset] 5/6

6

Here is an implementation in about as pure a recursive style as you can hope for. It is fully tail-recursive, so it has the same efficiency as an iterative implementation. sqrt[_, r1_, r0_] /; r1 == r0 := r1 sqrt[u_, r1_, r0_] := sqrt[u, (r1 + u/r1)/2., r1] sqrt[u_] /; u >= 0 := sqrt[u, u/2., 0.] Then nums = {2, E, Pi, Prime}; rts = sqrt /@ nums ...

9

Clear["Global*"] f[a_?(# > 0 &)] := Module[{x, m = 1}, x = 1.; x[n_] := x[n] = (x[n - 1] + a/x[n - 1])/2; While[x[m]^2 != a, m++]; x[m]] f[#] - Sqrt[#] & /@ {2, E, Pi, Prime} (* {-2.22045*10^-16, 0., 0., 4.26326*10^-14} *) A more straightforward method of recursion is to use FixedPoint Clear["Global*"] f[a_?(# > 0 &)] ...

4

Since this is a simple homework problem, I don't think it would fair to just hand you the whole answer, but here are some hints. To compute an exact expression for the mean curvature, use ArcCurvature andIntegrate. When you have the exact expression, let us call it avgCrv, then you can get an approximate numerical value with N[avgCrv] 0.561 You can ...

Top 50 recent answers are included