# Tag Info

## Hot answers tagged linear-algebra

8

a = RandomReal[{0, 1}, {2, 8}]; b = RandomReal[{0, 1}, {2, 8, 2}]; a.# & /@ b {{{2.58906, 3.35618}, {2.5578, 3.12812}}, {{1.3762, 2.87723}, {1.56668, 3.04675}}}

5

You can also use (a.b\[Transpose])\[Transpose] or, equivalently, Transpose[a.Transpose[b]] to get the same result. a = RandomReal[{0, 1}, {2, 8}]; b = RandomReal[{0, 1}, {2, 8, 2}]; c = a.# & /@ b; (* from Sjoerd's answer *) (a.b\[Transpose])\[Transpose] == c (* True *)

4

This is a recurring issue. Replace fun[s_]:= by fun[s_?NumericQ]:= to eliminate your error messages. FindMaximum then will give the answer, {9.09757, {s -> 0.0799914}}, which appears to be correct, despite the fact that FindMaximum gives the warning message that FindMaximum::lstol: The line search decreased the step size to within the tolerance ...

3

Let f[x_] := Sin[3 x^2] + x; and criterion k = 1, all in the range [-2,2]. One can use Solve[], NSolve[] or FindRoot[] to get crossing points, but it helps to search for solutions using a number of starting points. myCrossings = Sort@DeleteDuplicates[(x /. FindRoot[f[x] == 1, {{x, Range[-2, 2, .4]}}])] Then, include the lower and upper limit of your x ...

3

Another way: a = RandomReal[{0, 1}, {2, 8}]; b = RandomReal[{0, 1}, {2, 8, 2}]; m = First@Outer[Dot, {a}, b, 1]; Compare with Sjoerd's: s = a.# & /@ b; (* Sjoerd's *) s == m (* True *)

3

There are two new Version 10 functions, FunctionDomain and NumberLinePlot, that you might find useful. Using the example in David's answer: f[x_] := Sin[3 x^2] + x fd = FunctionDomain[{f[x],-2<x<2 && f[x]>1.}, x,Reals] (* 0.443523 < x < 1.02785 || 1.39912 < x < 1.86883 || 1.94362 < x < 2. *) NumberLinePlot[fd, {x, 0, ...

3

The easiest way most likely depends on the nature of the function. The function referred to in a comment by the OP seems to be like one in another post that it is concave down. The solution in such a case is quite simple and would consist at most of one interval. However, if the interval is to be $[-2,2]$, then it is not exactly that function. An ...

3

One approach is to build a Piecewise function. For example, the piecewise function g[x] returns 1 whenever f[x] is in the region larger than c and 0 otherwise. Placed in a Manipulate, it shows the region over which f[x] is larger than the value of c. f[x_] := Sin[3 x^2] + x; g[x_, c_] := Piecewise[{{1, c < f[x]}, {0, True}}] Manipulate[Plot[g[x, c], {x, ...

2

RegionFunction can also be used. With f[x] defined as in the answer by David Stork, f[x_] := Sin[3 x^2] + x; Plot[f[x], {x, -2, 2}, RegionFunction -> Function[{x, y}, 1 < f[x] < Infinity]]

2

I don't know what exactly you did using HermiteDecomposition. Here is what I had in mind. It will give four null generators. lat = {{25791903380828538698272313801407329391601758274521765857268873\ 0, 1, 0, 0, 0, 0}, {9686797332026357297411504450603025834144446485494364826751540\ 8, 0, 1, 0, 0, 0}, ...

2

Solve[{23, 1, 2, 3, 4}.{a, b, c, d, e} == 0, {a, b, c, d, e}] {{e -> -((23 a)/4) - b/4 - c/2 - (3 d)/4}} As Yashar points out, there are many different vectors orthogonal to {23, 1, 2, 3, 4}. Solve gives a set of free variables (in this case a, b, c, d) which can assume any values. Setting e to the specified relationship gives a vector that is ...

2

It seems to be a performance problem (bug?) in version 9.0.1. Version 7.0.1 is also slow, but perhaps is not capable of this calculation. However, version 8.0.4 can produce the correct result quickly, so there seems to be no good reason why 9.0.1 should take so long. I didn't try 9.0.0. The interesting thing, is that 9.0.1 has no problem with the purely ...

1

The problem is with numerical error in the procedure used by Integrate. Sufficiently high arbitrary precision, or exact input, is needed to ensure an accurate result from Integrate. On the other hand, MachinePrecision is sufficient for NIntegrate. There is nothing particularly numerically challenging about the integrand, so the NIntegrate result is not ...

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