Tag Info

New answers tagged

1

And another completely different approach is to use LinearSolve Clear[c1, c2, x, y] eqs = {c1*x + c2*y == 1, -c1*x + 2*c2*y == -2}; vars = {c1, c2}; {b, mat} = CoefficientArrays[eqs, vars]; LinearSolve[mat, -b]


1

Another option: vars = {c1, c2}; eqs = MapThread[{#1*x + #2*y == 1, -#1*x + 2*#2*y == -2} &, Map[List, vars]]; Solve[First@eqs, vars]


1

cv = Array[ c , 2 ] Solve[ { cv[[1]] x + cv[[2]] y == 1 , -cv[[1]] x + 2 cv[[2]] y == -2} , cv] {{c[1] -> 4/(3 x), c[2] -> -(1/(3 y))}} cv /. First@% {4/(3 x), -(1/(3 y))}


2

Here is how you can do it using NestList and some code vectorization mat1[[1 ;; 2]] = Module[{ct = 1}, NestList[({{const1, const2}, {const3, const4}}.#) mat2[[1 ;; 2, ++ct]] &, mat1[[1 ;; 2, 1]], n - 1] //Transpose]; Assuming that the variables const1 to const4 have numerical values close enough to 1, e.g. const1 = 1.0; const2 = 0.9; const3 = ...


7

Manipulate[Show[Graphics3D[{ {Red, PointSize[0.02], Point[{{0, 0, 0}}]}, {Opacity[0.2], Sphere[{0, a/(1 + a^2), -1 - 1/(1 + a^2)}, 1/Sqrt[1 + a^2]]}, Arrow[{{0, 0, 0}, {x[t, a], y[t, a], z[t, a]}}]}], ParametricPlot3D[{x[u, a], y[u, a], z[u, a]}, {u, 0, 10}], Axes -> True, PlotRange -> Table[{-3, 2}, {3}]], {t, 0, 10}, {a, 1, ...


4

You can use ParametricPlot3D for this kind of plot. Use Graphics3D if you want to visualize the sphere too. Show[ ParametricPlot3D[{x[t, 1], y[t, 1], z[t, 1]}, {t, 0, 10}, PlotStyle -> {Red, Thick}, PlotRangePadding -> 0.31], Graphics3D[{Opacity[0.5], Sphere[{0.0, 0.5, -1.5}, 1/Sqrt[2]]}] ]


1

graph1 = RandomGraph[{4, 5}]; RandomInteger[{2, 5}, {VertexCount@#, EdgeCount@#}] &@graph1 (* {{4, 3, 2, 3, 4}, {5, 3, 2, 4, 4}, {5, 3, 4, 4, 4}, {5, 5, 3, 4, 4}} *) You are missing a & in the last line of your code. With that fixed, ec = EdgeCount[graph1]; vertices = VertexList[graph1]; result = RandomInteger[{2, 5}, {ec}] & /@ vertices (* ...


5

VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}] Now you can either use ViewPoint VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, ViewPoint -> {0, 0, 200}] or define a very small z-range VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, -0.001, 0.001}] Grid[{ VectorPlot3D[{x, y, z}, {x, -1, 1}, {y, -1, 1}, {z, ...


4

Mathematica doesn't realise you want x to be a vector, so you have to tell it what you want more precisely: Module[{a, b, x, y}, a = {8, -2}; b = {3, 3}; Flatten@({x, y} /. Solve[{x, y} + a == b, {x, y}])] This gives as output: {-5, 5}


9

It's already built-in. It's called Cross. Cross[{1, 2}] Output is {-2, 1}


0

foo[v_]:= ({a, b} /. Solve[{a, b} . v = 0, {a, b}])[[1]]


0

As was mentioned in the comments above as of yet Mathematica is not able to estimate VAR processes. So I've tried and implemented VAR estimation function. Actually I've directly translated Cesa-Bianchi's MATLAB code [1]. My code is available here: http://www.alexisakov.com/p/economica.html. Here is a simple example: <<Economica` S = ...



Top 50 recent answers are included