Tag Info

New answers tagged

3

1) The Clear function starts with an uppercase C; in general all built-in functions in Mathematica start with an uppercase letter. 2) Generally speaking it's good practice not to start your own variable names with uppercase letters to avoid confusion. In particular, it's a good idea never to have single-letter uppercase symbols. These can generate sneaky ...


2

Please take a sheet of paper and draw a circle at the position {f1[t], f2[t]}. Do it now! I guess you are asking how on earth you should know the exact coordinates on the paper without knowing what f1 and f2 is, right? Mathematica is basically asking the same question about your functions Xx, Yy, and Zz because it just cannot transform a graphical object ...


0

Only a partial solution.NDSolve can't solve with this initial conditions y(1) = 0.5 sol = NDSolve[{(1 + x)*(0.5*y[x]^(-0.5)*(x - y[x])^0.5 - 0.5*y[x]^0.5*(x - y[x])^(-0.5)) == -y[x]*(x - y[x])/y'[x], y[0.99] == 0.5}, y, {x, 0, 2}, AccuracyGoal -> 30, PrecisionGoal -> 30, WorkingPrecision -> 55] // Quiet; ODEequations[x_] := y[x] /. sol; g1 = ...


3

You must initialize values of z for the function to be evaluated. Moreover, never use upper-case letters as variables as they are likely to conflict with internal variables and functions. \[Alpha] = 3; z[0] = 0; z[1] = 1; z[n_] := \[Alpha] z[n - 1]/(1 + z[n - 2]); ListPlot[Table[{i, z[i]}, {i, 1, 30}], Joined -> True, PlotRange -> All]


1

Another way: Module[{dist = 0}, Fold[ (dist += GeoDistance[##]; #2) &, locs[[tour]]]; dist] (* Quantity[6898.75, "Miles"] *) If locs is the other path to compare with: Module[{dist = 0}, Fold[ (dist += GeoDistance[##]; #2) &, locs]; dist] (* Quantity[30490.5, "Miles"] *)


5

I don't know any direct way to do what you wantand I agree that it would be an improvement if in a future release GeoDistance will supports a GeoPath as argument. But even now it's not so difficult to compute the distance along a path with with a not-so-"brute" way and this definition: geoPathDistance[locations:{__GeoPosition}] := Total[GeoDistance @@@ ...


0

Two small issues in your code. You have incorrect syntax in your Nest statement that assigns a value to S. sqrt is not defined. I think you want Sqrt and will have to change your brackets as well. Use SetDelayed (:=) for assignment of w to have it re-evaluated each time in the Nest statement. Hope this helps.


1

In the spirit of the code review tag: This piece of code a = Table[1, {n, 1, k}]; nn = Length[a]; is better written as nn = 6; a = ConstantArray[1, nn]; because it makes the assignment of nn explicit. In your newer version of the code you could use k throughout, there is no reason to define nn. You're not often going to see experienced Mathematica ...


1

An alternative way to construct the matrix b: m = 6; aa = LowerTriangularize[ConstantArray[1, {m + 1, m}], -1]; bb = Join @@ Permutations /@ aa; bb == b (* True *)



Top 50 recent answers are included