+6 07 553 86 86 arazin@utm.my

MLS Approximation Explorer

Interactive tool · Meshfree methods

MLS Approximation Explorer

About this tool

Change the dilation parameter α, the basis and the weight function, and watch how the Moving Least Squares approximation, its shape functions and its error respond. The sweep at the bottom finds the α that minimises the error for your current settings.

Alatan interaktif · Meshfree methods

MLS Approximation Explorer

Tentang alatan ini

Ubah dilation parameter α, basis dan weight function, dan lihat bagaimana Moving Least Squares approximation, shape functions dan ralatnya bertindak balas. Sweep di bahagian bawah mencari α yang meminimumkan ralat bagi tetapan semasa anda.

Loading the interactive tool…Memuatkan alatan interaktif…

How MLS works

Moving Least Squares fits a small weighted polynomial around every point x. Each node I has a weight function wI(x) that is zero outside its support domain of radius dI = αh, where h is the nodal spacing and α is the dilation parameter. The approximation and its shape functions are

uh(x) = ΣI φI(x) uI     φI(x) = pT(x) A−1(x) wI(x) p(xI)
A(x) = ΣI wI(x) p(xI) pT(xI)     (m × m moment matrix)
  • α too small. Some points see fewer than m nodes, A(x) becomes singular and the approximation breaks down. Near the boundary the support is one-sided, so on a regular grid the quadratic basis needs α > 2 there, but only α > 1.5 in the interior.
  • α too large. Every point averages over many nodes, the fit over-smooths, locality is lost and cond A(x) grows.
  • In between lies an α* that minimises the error. It depends on the basis, the weight function, the node layout and the function itself, so the sweep is recomputed for your current settings.
  • MLS does not interpolate. In general uh(xI) ≠ uI. This is why the Element-Free Galerkin method needs special treatment of essential boundary conditions, such as Lagrange multipliers, penalty, or coupling with finite elements.

Implementation: shifted and scaled basis p(s) = [1, s, s²] with s = (xI − x)/h, which keeps A(x) well conditioned. Errors are relative L2 norms over 401 sample points on [0, 1]; du/dx is obtained by second-order finite differences of uh.

Things to try
  1. Choose f = 1 + 2x − 3x² with the quadratic basis. The error drops to machine precision for every α that keeps A(x) non-singular. This is the reproducing, or consistency, property.
  2. Keep that function and switch to the linear basis. The error now depends on α. Where is α*?
  3. With the quadratic basis, slide α down from 2.5 towards 1.5. Where does the singular region appear first?
  4. Pick the tanh function and switch the sweep between u and du/dx. Is α* the same for both?
  5. Switch to irregular nodes and press “New layout” a few times. How do α* and the singular region move?
  6. Double the number of nodes and read the error. How fast does it fall with h for each basis?
Bagaimana MLS berfungsi

Moving Least Squares memadankan polinomial berpemberat yang kecil di sekitar setiap titik x. Setiap nod I mempunyai weight function wI(x) yang sifar di luar support domain berjejari dI = αh, dengan h ialah jarak antara nod dan α ialah dilation parameter. Approximation dan shape functions-nya ialah

uh(x) = ΣI φI(x) uI     φI(x) = pT(x) A−1(x) wI(x) p(xI)
A(x) = ΣI wI(x) p(xI) pT(xI)     (moment matrix m × m)
  • α terlalu kecil. Sesetengah titik melihat kurang daripada m nod, A(x) menjadi singular dan approximation gagal. Berhampiran sempadan support hanya sebelah, jadi pada grid seragam basis kuadratik memerlukan α > 2 di situ, tetapi hanya α > 1.5 di bahagian dalam.
  • α terlalu besar. Setiap titik mempuratakan banyak nod, padanan menjadi terlalu licin, sifat setempat hilang dan cond A(x) meningkat.
  • Di antaranya terdapat α* yang meminimumkan ralat. Ia bergantung pada basis, weight function, susunan nod dan fungsi itu sendiri, jadi sweep dikira semula untuk tetapan semasa anda.
  • MLS tidak menginterpolasi. Secara umum uh(xI) ≠ uI. Inilah sebabnya Element-Free Galerkin method memerlukan rawatan khas bagi essential boundary conditions, seperti Lagrange multipliers, penalty, atau gandingan dengan finite elements.

Pelaksanaan: basis teranjak dan berskala p(s) = [1, s, s²] dengan s = (xI − x)/h, yang mengekalkan A(x) berkeadaan baik. Ralat ialah norma relatif L2 atas 401 titik sampel pada [0, 1]; du/dx diperoleh melalui finite differences peringkat kedua bagi uh.

Cubaan untuk anda
  1. Pilih f = 1 + 2x − 3x² dengan basis kuadratik. Ralat jatuh ke ketepatan mesin bagi setiap α yang mengekalkan A(x) tidak singular. Inilah sifat reproducing, atau consistency.
  2. Kekalkan fungsi itu dan tukar ke basis linear. Ralat kini bergantung pada α. Di manakah α*?
  3. Dengan basis kuadratik, gerakkan α turun dari 2.5 ke arah 1.5. Di manakah kawasan singular mula-mula muncul?
  4. Pilih fungsi tanh dan tukar sweep antara u dan du/dx. Adakah α* sama bagi kedua-duanya?
  5. Tukar ke nod tak seragam dan tekan “Susunan baharu” beberapa kali. Bagaimana α* dan kawasan singular berubah?
  6. Gandakan bilangan nod dan baca ralatnya. Seberapa pantas ia jatuh dengan h bagi setiap basis?