Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: discretized Laplacian or linear inverse problem with extremely simple

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110143] Re: discretized Laplacian or linear inverse problem with extremely simple
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Fri, 4 Jun 2010 08:01:00 -0400 (EDT)

On Jun 3, 2010, at 5:39 AM, Igor wrote:

> Hello!
>
> There are:
> A n*n matrix
> x n*1 matrix====column
> b n*1 matrix====column
> and the well known equation
> A.x====b
>
> I know columns x and b
> I want Mathematica to derive matrix A
>
> Of course, generally, this is a complicated problem, but
> in my case all values of matrix A are small (less than 20
> in absolute value) integers, because I am interested in a
> very special case.(I am looking for the matrix of discretized
> Laplacian in D=={1,2,3,4} dimensions)
>
> As an example of my problem
> for (D==2) n==2 we have:
> x== {
> {f[1, 1]},
> {f[2, 1]},
> {f[1, 2]},
> {f[2, 2]}
> }
> b==
> {
> {-4 f[1, 1] + f[1, 2] + f[2, 1]},
> {f[1, 1] - 4 f[2, 1] + f[2, 2]},
> {f[1, 1] - 4 f[1, 2] + f[2, 2]},
> {f[1, 2] + f[2, 1] - 4 f[2, 2]}
> }
> and the solution (the matrix A) is
> -4  1  1  0
> 1 -4  0  1
> 1  0 -4  1
> 0  1  1 -4
>
> So, I would like Mathematica to do similar
> derivation of matrix A for me.
>
> I have the following questions:
>
> 1. Is there any method in Mathematica to find A from
> A.x====b if I know that this problem is well defined,
> I know x, b and that A elements have only integer values?

I don't know of anything specifically focussed on your problem, but in the example you've given you can determine A using Coefficient:

Table[Coefficient[b[[r]],x[[c,1]]],{r,Length[b]},{c,Length[x]}]

This of course will only work if the elements of x are symbols.

>
> 2. An obvious (or obviously mad :-) ) solution of the problem
> would be to perform an exhaustive search. I mean to
> ran n*n loops for all elements of matrix A from -20 to 20
> till A.x====b. But, I don't know how to perform this in
> Mathematica (as the number of loops is n*n and thus
> depend on n, that I want to vary).

You could try using Minimize

Module[{a},Minimize[Prepend[Flatten[Table[Abs[a[r,c]]<=,{r,Length[b]},{c,Length[x]}]],Array[a[##]&,{Length[b],Length[x]}].x],Flatten[Table[a[r,c],{r,Length[b]},{c,Length[x]}]],Integers]

> Thank you very much for your attention!
> All suggestions are welcome!

I couldn't test my suggested expressions because my Mathematica kernel is busy, but I think you should get the gist of what I was trying to do.

Best Regards,
	Ssezi


  • Prev by Date: Re: discretized Laplacian or linear inverse problem with extremely
  • Next by Date: Re: How to navigate the documentation?
  • Previous by thread: Re: discretized Laplacian or linear inverse problem with extremely
  • Next by thread: Re: DateListPlot (Margins? or something?)