Func[x_] = x

x

Func2[x_] = 1/x

1/x

Func[5]

5

Table[Func[i], {i, 10}, {j, 10}]

{{1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 2, 2, 2, 2, 2, 2, 2, 2, 2}, {3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ... 8, 8, 8, 8, 8, 8, 8, 8}, {9, 9, 9, 9, 9, 9, 9, 9, 9, 9}, {10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}

TomMat1[N_] = Table[(1/N) * Exp[-(5 * (i - j)/N)^2], {i, N}, {j, N}]

Table :: iterb : Iterator  {i, N} does not have appropriate bounds. More…

Table[^(-((5 (i - j))/N)^2)/N, {i, N}, {j, N}]

This is part 1 (a)

General :: spell : Possible spelling error: new symbol name \"part\" is similar to existing symbols  {Apart, Part} .  More…

a is part This

TomMat1[20]

{{1/20, 1/(20 ^(1/16)), 1/(20 ^(1/4)), 1/(20 ^(9/16)), 1/(20 ) ... )), 1/(20 ), 1/(20 ^(9/16)), 1/(20 ^(1/4)), 1/(20 ^(1/16)), 1/20}}

TomMat1[20]   //MatrixForm

(                            1                  1                    1                 ... #63309;         20          20          20          20          20

TomDelta[i_] = KroneckerDelta[10 - i]

KroneckerDelta[10 - i]

 Array[TomDelta, 20]

{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

TomDelta[11]

0

TomMat1[20] . Array[TomDelta, 20] //MatrixForm

(        1         )           ----------------                      81/16     ... 309;                   1           ---------------                      25/4           20 

So the vector/matrix multiplication returns the desired line of the matrix as expected

General :: spell1 : Possible spelling error: new symbol name \"line\" is similar to existing symbol \"Line\".  More…

as desired expected line multiplication of returns So the^3 vector

Here is part B

B Here is part

Eigenvalues[TomMat1[5]] //MatrixForm

(                                                                                      ... 09;   #1 - 25   #1  - 25    #1  - 75    #1  + 125    #1  &, 1]

 that is a bit messy . Let us look at numerical form .

Syntax :: tsntxi : \"form . \" is incomplete; more input is needed. More…

Ughthatisabitmessy . Letuslookatnumerical form .

N[Eigenvalues[TomMat1[5]]] //MatrixForm

( 0.3317377638726387`  )            0.27174243201597165`            0.19511687292536906`            0.12459441769924659`            0.07680851348677405`

N[Eigenvalues[TomMat1[10]]] //MatrixForm

( 0.33012759333047936`    )            0.26666943355347905`            0.18690 ...        0.0035129207299441985`            0.0009287361064987247`            0.00017757741953451395`

It apears as if the eigen values are getting smaller . As discussed in class computation of this for very large matrices is ... time consuming and I ' ll avoid it if thats ok .

RowBox[{Here,  , is,  , part,  , 1., C}]

So I am not able to quickly solve a system of size 20x20 but 5x5 should suffice for pratice purposes .   here is what a inverse of a 5x5 type A matrix woudl look like :

Inverse[TomMat1[5]] //MatrixForm

(                                                                                      ... 25      3125      3125     3125     3125     3125 

So now we obtain X as follows :

TomDelta3[i_] = KroneckerDelta[3 - i]

KroneckerDelta[3 - i]

This function gives us a good "b" vector for our 5x5 A matrix

Array[TomDelta3, 5]

{0, 0, 1, 0, 0}

N[TomMat1[5] . Inverse[Evaluate[TomMat1[5]]]] //MatrixForm

( 1.0000000000000007`         2.220446049250313`*^-16     0.`                          ... 7787807814457`*^-17    0.`                         2.220446049250313`*^-16     1.0000000000000007`

I ' m using numerical approximation above because teh solution is only an approximation and so the symbolic form of an approximation is hard to understand

N[Inverse[TomMat1[5]] . Array[TomDelta3, 5]] //MatrixForm

( 0.9391648292451436` )            -2.905598572128823`            7.103417150227679`            -2.905598572128823`            0.9391648292451436`

The above gives us our approximation of x in Ax = b

N[TomMat1[5] . (Inverse[TomMat1[5]] . Array[TomDelta3, 5]) - Array[TomDelta3, 5]] //MatrixForm

( 0.`                      )            1.8041124150158794`*^-16            3.885780586188048`*^-16            1.8041124150158794`*^-16            0.`

The error is very slight as 10^-16 is extremely small .

N[TomMat1[10] . (Inverse[TomMat1[10]] . Array[TomDelta3, 10]) - Array[TomDelta3, 10]] //MatrixForm

( -8.92787710427001`*^-9   )            -9.774467457646097`*^-9            -1. ...   -2.878834948205622`*^-10            -5.054126006598381`*^-10            -6.731397661496885`*^-10

So with a larger matrix the error has increased .

Here is part 1e

N[(TomMat1[5] - IdentityMatrix[5]) . (Inverse[TomMat1[5]] . Array[TomDelta3, 5]) - Array[TomDelta3, 5]] //MatrixForm

( -0.9391648292451436` )            2.9055985721288224`            -7.103417150227679`            2.9055985721288224`            -0.9391648292451436`

N[(TomMat1[10] - IdentityMatrix[10]) . (Inverse[TomMat1[10]] . Array[TomDelta3, 10]) - Array[TomDelta3, 10]] //MatrixForm

( -172.55532843602148` )            477.8036707308623`            -751.3964648 ... 245`            311.76946986436906`            -158.32895130315356`            49.437929330443154`

I guess it made the increasing error get more extreme

OK so onto problem2 . hmm make a dipole function thingy eh ? Ok

Dipole[x1_, x2_, y1_, y2_, n1_, n2_] = 1/(2 * Pi) * {x1 - y1, x2 - y2} . {n1, n2} * 1/(Norm[({x1 - y1, x2 - y2})] * Norm[{x1 - y1, x2 - y2}] * Norm[{n1, n2}])

(n1 (x1 - y1) + n2 (x2 - y2))/(2 π (Abs[n1]^2 + Abs[n2]^2)^(1/2) (Abs[x1 - y1]^2 + Abs[x2 - y2]^2))

Dipole[6, 2, 1, 8, 1, 0]

5/(122 π)

Dipole[5, 7, 1, 8, 1, 0]

2/(17 π)

Ok SO it is set up If I am understanding the function I need to put in right .

Part 2b

Dipole[{6, 5}, {2, 7}, 1, 8, 1, 0] 

{5/(122 π), 2/(17 π)}

So it will return a list when given a list

Part 2c

DipTab[N_] = Table[{i, j}, {i, N}, {j, N}]

Table :: iterb : Iterator  {i, N} does not have appropriate bounds. More…

Table[{i, j}, {i, N}, {j, N}]

Array[Func, 5]

{1, 2, 3, 4, 5}

Dipole[Array[Func, 50], Array[Func2, 50], 1, 8, 1, 0] //MatrixForm

(                )            0                2           ----------          ... -----           5684785 π                1250           -------------           125749 π

ListPlot[Dipole[Array[Func, 50], Array[Func2, 50], 1, 8, 1, 0]]

[Graphics:HTMLFiles/index_93.gif]

⁃Graphics⁃

Part 3a Sum of a lot of parts . I bet it already does that but lets check :

Dipole[5, 7, 1, 8, 1, 0]

61/(2 81770^(1/2) π)

Dipole[5, 7, 2, 1, 2, 3]

4/(15 13^(1/2) π)

Dipole[5, 7, {1, 2}, {8, 1}, {1, 2}, {0, 3}]

{2/(17 π), 4/(15 13^(1/2) π)}

Total[Dipole[5, 7, {1, 2}, {8, 1}, {1, 2}, {0, 3}]]

2/(17 π) + 4/(15 13^(1/2) π)

Ok . Looks like it .

Part 3b Ok . To do this i ' m going to set up some machinery stuff

XCircleMiniPart[i_, N_] = Cos[2 * Pi * i/N]

Cos[(2 i π)/N]

XCirclePart[N_] = Array[XCircleMiniPart, {N, 1}, {1, N}]

Array :: ilsmp : Single or non-empty list of positive machine-size integers expected at position 2 of Array[XCircleMiniPart, {N, 1}, {1, N}] .  More…

Array[XCircleMiniPart, {N, 1}, {1, N}]

XCirclePart[2]

{{-1}, {1}}

YCircleMiniPart[i_, N_] = Sin[2 * Pi * i/N]

General :: spell1 : Possible spelling error: new symbol name \"YCircleMiniPart\" is similar to existing symbol \"XCircleMiniPart\".  More…

Sin[(2 i π)/N]

YCirclePart[N_] = Array[YCircleMiniPart, {N, 1}, {1, N}]

General :: spell1 : Possible spelling error: new symbol name \"YCirclePart\" is similar to existing symbol \"XCirclePart\".  More…

Array :: ilsmp : Single or non-empty list of positive machine-size integers expected at position 2 of Array[YCircleMiniPart, {N, 1}, {1, N}] .  More…

Array[YCircleMiniPart, {N, 1}, {1, N}]

YCirclePart[2]

{{0}, {0}}

Ok lets see if I can ' t present what I ' m  doign clearly here :

{XCirclePart[2], YCirclePart[2]} //MatrixForm

( ( -1 )   ( 1 )  )            ( 0 )    ( 0 )

And on a Larger scale

a And Larger on scale

{XCirclePart[10], YCirclePart[10]} //MatrixForm

( ( 1               )            ( 1                )  ...  2                                       2      2                            ( 0 )

So let ' s test it out on our dipole function :

N[Total[Dipole[5, 3, XCirclePart[10], YCirclePart[10], 1, 0]]]

RowBox[{{, 0.234051, }}]

Below is a graph of the dipole function . I used a norm outside of the total to convert from array to # due to issue of plot only accepting numbers .

Plot3D[Norm[Total[Dipole[x, y, XCirclePart[10], YCirclePart[10], XCirclePart[10], YCirclePart[10]]]], {x, -5, 5}, {y, -5, 5}]

[Graphics:HTMLFiles/index_134.gif]

⁃SurfaceGraphics⁃

To examine how it is scales with N I decided to take a look at it for N = 150  after looking at it at N = 10

Plot3D[Norm[Total[Dipole[x, y, XCirclePart[150], YCirclePart[150], XCirclePart[150], YCirclePart[150]]]], {x, -5, 5}, {y, -5, 5}]

[Graphics:HTMLFiles/index_138.gif]

⁃SurfaceGraphics⁃

Norm[Total[Dipole[.3, .3, XCirclePart[150], YCirclePart[150], XCirclePart[150], YCirclePart[150]]]]

23.8732

Norm[Total[Dipole[.3, .3, XCirclePart[10], YCirclePart[10], XCirclePart[10], YCirclePart[10]]]]

1.59155

RowBox[{Norm, [, RowBox[{Total, [, RowBox[{Dipole, [, RowBox[{1.5, ,, .3, ,, XCirclePart[150], ,, YCirclePart[150], ,, XCirclePart[150], ,, YCirclePart[150]}], ]}], ]}], ]}]

1.91513*10^-15

RowBox[{Norm, [, RowBox[{Total, [, RowBox[{Dipole, [, RowBox[{1.5, ,, .3, ,, XCirclePart[10], ,, YCirclePart[10], ,, XCirclePart[10], ,, YCirclePart[10]}], ]}], ]}], ]}]

0.00911946

It seems to me that The value inside increases as N increases . While the value outside decreases as N increases .

Sum[Dipole[Cos[2 * pi/N

Sum[

 Dipole[-5, -3, 1, 1, 1, 0]

-3/(52 π)

.

Part 3c Ok first I am gonna set it up with the weighing functionm

ProbAprox[p1_, p2_, thet_]    = Norm[Total[Dipole[p1, p2, XCirclePart[10], YCirclePart[10], Cos[thet], Sin[thet]]]]

Abs[((-1 + p1) Cos[thet] + p2 Sin[thet])/(2 π (Abs[-1 + p1]^2 + Abs[p2]^2) (Abs[Cos[thet] ... + p1]^2 + Abs[1/2 (1/2 (5 + 5^(1/2)))^(1/2) + p2]^2) (Abs[Cos[thet]]^2 + Abs[Sin[thet]]^2)^(1/2))]

IntAprox[q1_, q2_] = Sum[ProbAprox[q1, q2, 2 * Pi * i/10] * 2 * Pi/10, {i, 1, 10}]

1/5 π Abs[(1 - q1)/(2 π (Abs[-1 + q1]^2 + Abs[q2]^2)) + (-1 - q1)/(2 π (Abs[1 + ... 1/2)))^(1/2) π (Abs[1/4 (-1 + 5^(1/2)) + q1]^2 + Abs[1/2 (1/2 (5 + 5^(1/2)))^(1/2) + q2]^2))]

N[IntAprox[1, 0]]

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

                                             0 ComplexInfinity ∞ :: indet : Indeterminat ... ---------------- encountered. More…                                                   π

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

                                             0 ComplexInfinity ∞ :: indet : Indeterminat ... ---------------- encountered. More…                                                   π

                                     1 Power :: infy : Infinite expression  - encountered. More…                                      0

General :: stop : Further output of Power :: infy will be suppressed during this calculation. More…

                                                            0 ComplexInfinity ∞ :: indet ... + -- (1 + Sqrt[5]) ] π                                                   8                 16

General :: stop : Further output of ∞ :: indet will be suppressed during this calculation. More…

Indeterminate

N[IntAprox[3, 2]]

1.79359

N[IntAprox[.3, .4]]

0.0124299

SO it apears with my system I get numbers greater than 1 outside and numbers less than 1 insid ... ting about the desired results . Plot3D[N[IntAprox[x, y]], {x, -5, 5}, {y, -5, 5}]

General :: spell1 : Possible spelling error: new symbol name \"with\" is similar to existing symbol \"With\".  More…

General :: spell1 : Possible spelling error: new symbol name \"get\" is similar to existing symbol \"Get\".  More…

General :: spell1 : Possible spelling error: new symbol name \"greater\" is similar to existing symbol \"Greater\".  More…

General :: stop : Further output of General :: spell1 will be suppressed during this calculation. More…

 and apears circle get greater inside it less my numbers^2 of outside SO system than^2 the with

[Graphics:HTMLFiles/index_180.gif]

⁃SurfaceGraphics⁃

Plot3D[Norm[Total[Dipole[x, y, XCirclePart[150], YCirclePart[150], XCirclePart[150], YCirclePart[150]]]], {x, -5, 5}, {y, -5, 5}]

Ok here is part D

1 + .03 * Cos[2Pi/3 * i/N]

XCirclePart[N_] = Array[XCircleMiniPart, {N, 1}, {1, N}] XCircleMiniPart[i_, N_] = Cos[2 * Pi * i/N]

RadialXmini[i_, N_] = 2 * Pi/3 * i/N

(2 i π)/(3 N)

RadialXpart[N_] = Array[RadialXmini, {N, 1}, {1, N}]

Array :: ilsmp : Single or non-empty list of positive machine-size integers expected at position 2 of Array[RadialXmini, {N, 1}, {1, N}] .  More…

Array[RadialXmini, {N, 1}, {1, N}]

RadialXpart[5]

{{(2 pi)/15}, {(4 pi)/15}, {(2 pi)/5}, {(8 pi)/15}, {(2 pi)/3}}

RadialYmini[i_, N_] = 1 + .03 * Cos[2 * Pi/3 * i/N]

RowBox[{1, +, RowBox[{0.03,  , Cos[(2 i π)/(3 N)]}]}]

RadialYpart[N_] = Array[RadialYmini, {N, 1}, {1, N}]

Array :: ilsmp : Single or non-empty list of positive machine-size integers expected at position 2 of Array[RadialYmini, {N, 1}, {1, N}] .  More…

Array[RadialYmini, {N, 1}, {1, N}]

RadialYpart[5]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{1, +, RowBox[{0.03,  , Cos[(2 pi)/15]}]}], }}], ,, RowBo ... os[(8 pi)/15]}]}], }}], ,, RowBox[{{, RowBox[{1, +, RowBox[{0.03,  , Cos[(2 pi)/3]}]}], }}]}], }}]

To approximate the ArcLengths I ' ll use NIntegrate with accuracy goal of 1/N^3 with n = 10 :

DsAprox[i_, N_] = NIntegrate[1 + (2 * Pi/(3 * N) * .03 * Sin[2 * Pi/3 * x/N])^2, {x, 2 * Pi/3 * (i - 1)/N, 2 * Pi/3 * (i)/N}, AccuracyGoal1/10^3]

                         2.0943951023931953` (-1.` + i) NIntegrate :: nlim : x = ------------- ... -------- is not a valid limit of integration. More…                                        N

                         2.0943951023931953` (-1.` + i) NIntegrate :: nlim : x = ------------- ... -------- is not a valid limit of integration. More…                                        N

RowBox[{NIntegrate, [, RowBox[{RowBox[{1, +, RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{2,  ...  2}]}], ,, {x, (2 π (i - 1))/(3 N), (2 π i)/(3 N)}, ,, AccuracyGoal1/10^3}], ]}]

DsAprox[3, 10]

0.20944

DsAprox2[j_] = DsAprox[j, 10]

NIntegrate :: nlim : x = 0.20943951023931953` (-1.` + j) is not a valid limit of integration. More…

NIntegrate :: nlim : x = 0.20943951023931953` (-1.` + j) is not a valid limit of integration. More…

RowBox[{NIntegrate, [, RowBox[{RowBox[{1, +, RowBox[{RowBox[{(, RowBox[{RowBox[{(, RowBox[{2,  ... }], )}], /, (3 10)}], )}], ^, 2}]}], ,, {x, (2 π (j - 1))/(3 10), (2 π j)/(3 10)}}], ]}]

DsAprox2[3]

0.20944

So for N = 10 we  can approximate with

RadialAprox[p1_, p2_, thet_]    = Norm[Total[Dipole[p1, p2, RadialXpart[10], RadialYpart[10], thet, 1 + .03 * Cos[2 * Pi/3 * i/10]]]]

RowBox[{Abs, [, RowBox[{RowBox[{RowBox[{(, RowBox[{(p1 - π/15) thet, +, RowBox[{RowBox[{( ... Box[{1, +, RowBox[{0.03,  , Cos[(i π)/15]}]}], ]}], ^, 2}]}], )}], ^, (1/2)}]}], )}]}]}], ]}]

RadialInt[q1_, q2_] = Sum[RadialAprox[q1, q2, 2 * Pi * i/10] * DsAprox2[i], {i, 1, 10}]

RowBox[{RowBox[{0.209441,  , RowBox[{Abs, [, RowBox[{RowBox[{RowBox[{(, RowBox[{0.0250247,  ,  ... 2, +, RowBox[{RowBox[{Abs, [, RowBox[{RowBox[{-, 0.985}], +, q2}], ]}], ^, 2}]}], )}]}]}], ]}]}]}]

N[RadialInt[2, 3]]

0.954389

Plot3D[N[RadialInt[x, y]], {x, -5, 5}, {y, -5, 5}]

[Graphics:HTMLFiles/index_223.gif]

⁃SurfaceGraphics⁃

So Once again I get kind of the right shape but my values apear to be positive when they need to be negative .


Created by Mathematica  (January 19, 2006)