Whenever I use functions like FindRoot or NDSolve, it sends x through the function and deals with the result. That would be fine if I was sending a simple math function through, but I have something more like a short program. Is there any way to make it solve it by putting specific values through the function and looking at the results?
|
|
||||
| show 4 more comments |
|
I will give you a simple but realistic example. Imagine you are given two $d$-dimensional vectors $X$ and $B$. Now you are asked to find a matrix say $A$ such that $AX=B.$ How can we use Mathematica to solve this problem? Prepare the two vectors
Now is time to define a function that takes a numerical $d\times d$-dimensional array $A$ as input and computes the norm $|A X-B|.$
At this point one would try to minimize the above function in order to get the matrix $A$ such that $AX=B$ holds approximately. We use the
Similar things can be done for functions like BR |
|||||
|



x_ /; ArrayQ[x, _, MatchQ[#, 0 | 1] &]then? – J. M.♦ Nov 9 '12 at 8:33