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

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111446] Re: discretized Laplacian or linear inverse problem with extremely
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 2 Aug 2010 07:02:12 -0400 (EDT)
  • References: <hu7tmv$jl3$1@smc.vnet.net>

Am Thu, 3 Jun 2010 09:47:11 +0000 (UTC)
schrieb Igor <i.e.kozlov at gmail.com>:

> 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?

because A.x is row_i(A)*x you just need to extract the coefficients
from b (using your nesting of vectors):

In[3]:= Flatten[Outer[Coefficient,b,x,2],{2,3,4}]
Out[3]= {{-4,1,1,0},{1,-4,0,1},{1,0,-4,1},{0,1,1,-4}}

simple, isn't it?

Peter




  • Prev by Date: Re: assuming certain properties about variables
  • Next by Date: Re: Mathematica- Use a previous equation into the function Function
  • Previous by thread: Re: A distribution problem using Mathematica
  • Next by thread: Re: All pairs shortest paths