Tag Info

Hot answers tagged

19

Mathematica wouldn't be much helpful if one applied only formulae calculated by hand. Here we demonstrate how to calculate the desired geometric objects with the system having a definition of the curve r[t] : r[t_] := {t, t^2, t^3} now we call uT the unit tangent vector to r[t]. Since we'd like it only for real parameters we add an assumption to Simplify ...


13

In Mathematica: Integrate[Integrate[x^2 + y^2, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}], {y, -1, 1}] Or, shorter: Integrate[x^2 + y^2, {y, -1, 1}, {x, -Sqrt[1 - y^2], Sqrt[1 - y^2]}] The main trick is to calculate the bound on $x$ based on the current value of $y$, which is what you need to make the integration bounds explicit. Indeed, $x_{max}=\sqrt{1-y^2}$. ...


12

I assume (sorry if I'm being wrong) that this is some kind of homework. So I've written an answer as guidance. You'll have to work out some details. If your problem is three dimensional, you can write for example: dist[x0_,x1_] := (x0-x1).(x0-x1); power[x0_,x1_]:= c/dist[x0,x1]; findAnt[{{pow1_,pos1_},{pow2_,pos2_},{pow3_,pos3_}}]:= ...


12

You have some errors in your syntax: you name your lists x_sample and y_sample, but in Mathematica, an underscore is not allowed in names (as it is reserved to patterns). your last sum runs from 0, but in Mathematica, the first element in a List has index 1 your last sum should run until the number of data points, not 4 furthermore, I would advise you to ...


8

Observe that even when the tangent vector $r'(t)$ is not normalized, it is still a linear combination of $T(t)$ and $N(t)$. Thus--operating under the usual assumptions that $r'$ and $r''$ exist and are linearly independent--all we have to do is make an orthonormal frame out of $r'(t)$ and $r''(t)$ (which is very much in the spirit of the entire proceeding). ...


7

This is mainly an answer to your last question, but I think it will help with your other ones. I assume you know that the $T$ function is vector valued, and that is what you want. To substitute in a specific value of $t$, you probably want replacement rules, specifically the ReplaceAll (/.) construct. For example, if you had defined your expression $T(t)$ ...


6

If you want to translate Matlab code into Mathematica, my advice is - don't! As programming languages, the two are very different and an idiom that works well in one is unlikely to work well in the other. A fundamental theorem theorem in discrete dynamics states that if there's an attractive orbit, then it must attract at least one critical point. Thus, ...


5

The quick answer is: AntennaPower[measure_List, antenna_List] := Module[{x1,x2,xa,ya,sd2}, {x1, x2, sd1} = measure; {xa, ya} = antenna; N[ sd1*(4*Pi*((xa - x1)^2 + (ya - y1)^2)/1000)] ] The point here is that the first argument to Module can only be a sequence of symbols (or of assignments x=x0,y=y0,...) but no expressions are allowed. Just an ...


4

You can not assign to a list in local variable specification as You did {x1,x2,sd1}=measure. You can assign specific parts of dummy variables: AntennaPower[measure_, antenna_] := Module[{x1=measure[[1]], x2=measure[[2]], sd1=measure[[3]], xa=antenna[[1]], ya=antenna[[2]]}, N[sd1*(4*Pi*((xa - x1)^2 + (ya - y1)^2)/1000)] ] or use equivalent sebhofer's ...


4

freddieknets already told you what you're supposed to be doing. Here's how I'd have done your approach to least squares: n = 4; f[x_] = Map[C, Range[0, n]].x^Range[0, n]; Solve[Thread[ D[Total[(ysample - f /@ xsample)^2], {Map[C, Range[0, n]]}] == 0], Map[C, Range[0, n]]] // First // Chop {C[0] -> 0, C[1] -> 10., C[2] -> 0, C[3] -> 0, ...


3

Select is wrong in this case, you can't use it to get the n-th element of a list without using additional helper functions. You'll get the most out of this exercise by looking at Part, which is a very flexible function for extracting elements out of a list based on their position, for example x = {1,1,2,3,5,8,13,21,34,55} (* Explicit syntax. Extracts the ...


2

Also, remember you can check your results with: ysample = {0, 1, 2, 3, 4, 5, 6, 7, 8} xsample = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}(*Some sample data*) model = a x^3 + b x^2 + c x + d; fit = FindFit[data = Transpose@{xsample, ysample}, model, {a, b, c, d}, x] modelf = Function[{x}, Evaluate[model /. fit]] Plot[modelf[x], {x, 0, 1}, Epilog -> ...


2

I'm not too good at graphs, but this seems straightforward. myAdjacencyMatrix = {{0, 3, 1, 3, 3, 8, 0, 0, 3, 4, 2}, {1, 0, 2, 0, 0, 16, 5, 3, 0, 6, 1}, {2, 3, 0, 0, 1, 1, 4, 1, 1, 0, 0}, {5, 3, 3, 0, 5, 0, 2, 2, 2, 2, 1}, {1, 0, 0, 6, 0, 1, 2, 6, 10, 2, 4}, {0, 11, 3, 0, 1, 0, 8, 3, 1, 3, 3}, {2, 4, 1, 7, 6, 7, 0, 6, 0, 8, 2}, {1, 2, 1, 3, 8, 4, 4, ...


1

Is this what you're trying to do: Edit It's possible, as I was overly focused on the slightly rambling free-form input stylized as Mathematica code, that I neglected to read the actual point of the question - namely, I guess that you're expecting an explanation from WolframAlpha as to why the identity is true. I think that the short answer is that ...


1

Asking for help completing homework assignments is a sketchy subject. I'll help with hints, however a full solutions seems to be against the purpose of this site. As others have mentioned there is a built-in method for this Tally as for your own method, you are correct in that it won't work since it's only matching adjacent objects, you can fix this by ...


1

One of the nice things about Mathematica is that it supports many different styles of programming. I think your code has the aspect of more "traditional" code that one might write in a different programming language. Perhaps your code is correct in spirit, but it seems to me overly complicated and as written obviously is not okay because it throws a ...



Only top voted, non community-wiki answers of a minimum length are eligible