Laplacian — Control Systems/Symbolic
Control_Systems/Symbolic/Laplacian · 1 input / 1 output port(s) at insert · exports to Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text
Description#
The block's own DESCRIPTION_HTML, rendered verbatim — the same text the config dialog's info panel and the library navigator show. Fix a wrong sentence in the block's .cpp (R-D9), never here.
Laplacian
Control Systems / Symbolic
The Laplacian of a scalar field, evaluated at the input:
y = ∇²f = Σk ∂²f/∂xk², a
scalar. This is MATLAB's laplacian(f, v), and it is the trace of this
family's Hessian.
The second derivatives are taken symbolically, once, when the configuration loads, and summed there: the generated core evaluates one expression rather than a matrix.
Ports
- x – the variables, a vector of n entries (a column [n,1] or a row [1,n]) where n is the number of names in Variables: entry k is the k-th name. A Mux in front builds it from scalar signals.
- y – the Laplacian, [1,1].
Parameters
- Expression – the expression, in MATLAB syntax over the names in
Variables: numbers,
pi,+ - * / ^, parentheses and the functionssin cos tan sec csc cot asin acos atan acot sinh cosh tanh asinh acosh atanh exp log log2 log10 sqrt. A matrix is written[f1; f2], with semicolons between rows and commas between the entries of a row.abs,signandheavisideare refused here, unlike on Symbolic Expression: see Notes. - Variables – the names of the input's entries, in order, separated by
spaces or commas:
x y z. Each is a MATLAB identifier, none may repeat, and none may be a function name orpi,e,i,j,Inf,NaNoreps. At most 12. - Sampling Time (s) – zero or less inherits the solver's rate; a positive value runs the block at that period.
Code export
All ten targets: Python, MATLAB, Java, Rust, C,
C++, VHDL, Verilog, SystemVerilog and PLC Structured
Text. The calculus is done once, at configuration load; what each target carries is
the RESULT, printed as one inline expression per entry with its constants folded to 17
significant digits, so a generated core differentiates nothing and has no parameter to
tune. Where a target lacks a function it gets the identity – Java has no inverse
hyperbolic functions and PLC Structured Text no hyperbolic functions at all, so those are
written through log, exp and sqrt. The three
HDL targets are simulation-only real arithmetic, quantized to
Q16.16 only at the ports: a derivative of a transcendental expression is not a fixed-point
datapath.
Simulink bridge
None (Support::None). laplacian is a Symbolic Math Toolbox
function, and that toolbox ships no Simulink library at all, so there is no library path a
diagram could name; the bridge reports this block rather than dropping it, and it
therefore has no parity testbench. Code export verification covers it across all
ten languages. No configuration crosses, including "Sampling Time (s)".
Notes
- The expression must be SCALAR. A vector field's Laplacian is taken component by component, which is three separate blocks rather than one, and the block says so rather than choosing.
abs,signandheavisideare refused in the expression. The symbolic engine answersdiff(abs(x))only under an assumption that x is real – console state a block may not depend on – and the derivative ofsignorheavisideis an impulse no sample can carry. Symbolic Expression accepts all three, because it differentiates nothing.- Algebraic, with no state: the output depends only on the current input.
- The calculus is the console's own symbolic engine's (the engine behind
diffandjacobianon the command line), over exact rational arithmetic; constants are folded to doubles only after it. - Size limits are on the generated code: 144 entries, 4000 operations per entry. An expression whose derivatives grow past that is refused with that reason rather than truncated.
- No state space: the map is nonlinear in general, so model reduction correctly declines the block.
Code facts#
| Fact | Value |
|---|---|
| registered type | Control_Systems/Symbolic/Laplacian |
| family | Control_Systems/Symbolic |
| solver environment class | ICoreBlock_0_Control_Systems_1_Symbolic_2_Laplacian |
| source | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Symbolic/Laplacian/ICoreBlock_0_Control_Systems_1_Symbolic_2_Laplacian.cpp |
| header | src/ICoreBlocks/ICoreBlockLibrary/Blocks/Control_Systems/Symbolic/Laplacian/ICoreBlock_0_Control_Systems_1_Symbolic_2_Laplacian.h |
| default size on canvas | 120 × 70 px |
| ports at insert | 1 in, 1 out |
| code generators implemented | Python, MATLAB, Java, Rust, C, C++, VHDL, Verilog, SystemVerilog, PLC Structured Text |
Ports#
| # | Direction | Signal type | Description label |
|---|---|---|---|
| 1 | in | ICoreDouble | x |
| 2 | out | ICoreDouble | y |
Ports the constructor creates. A block whose port list changes with its configuration adds or removes ports at load time; the count above is the one a freshly inserted block has.
Configuration variables#
| Config variable | Default | Simulink parameter |
|---|---|---|
Expression | x^2*y + sin(y)*exp(z) + log(x^2 + 1)*z | — |
Variables | x y z | — |
Every block also carries Sampling Time (s) from ICoreBlockSolverEnvironment: zero or less inherits the solver's rate, a positive value runs the block at that period.
Simulink bridge#
| support | Support::None |
| Simulink path | — |
| port-count rule | PortsParam::None |
SampleTime parameter | yes |
Caveat (shown to the user): laplacian is a Symbolic Math Toolbox function, and that toolbox ships no Simulink library at all, so there is no library path a diagram could name; the block is reported rather than dropped when a model crosses
Catalog contract: src/ICoreBlocks/ICoreCoder/ICoreCommandSystem/SimulinkBridge/ICoreSimulinkBlockCatalog.h
Description vs code#
The lists agree. check_block_descriptions.py finds no disagreement between the description's Ports, Parameters, Code export and Simulink bridge lists and the code's.
The verdict above is
tools/docs/check_block_descriptions.py(P7.1), which compares LISTS. It cannot read a sentence: "stateless" on a block with a state, an initial-value semantic the recursion does not implement, a "not synthesizable" caveat the HDL banner contradicts. That is the agent audit (P7.3) on BLOCK_DESCRIPTION_AUDIT.md, and this tool's green is not a substitute for one.
File banner (developer view)#
The top comment of the block's .cpp — the maths, the realization and the export strategy, addressed to whoever changes it. It must not contradict the description above (P7.5).
Laplacian -- laplacian on an expression compiled at config load y = lap f = sum_k d2 f / dx_k^2
The trace of the Hessian, and the operator every diffusion equation is written with.
The reading, the sizing contract, compute_h and all ten generators are ICoreSymbolicBlockBase's; the calculus is the console's symbolic engine's, reached through ICoreSymbolicProgram. This file is what is genuinely this block's: its operation, its ports, its configs, its description, its icon and its Simulink entry.
VERIFIED OUTSIDE ICORE, because code-export verification compares the block with itself: the block's own C++ evaluation of its rig configuration was compared with MATLAB R2026a's laplacian on the same expression at the same points. Max |difference| 2.22e-16, which is rounding on the last bit rather than a tolerance.
Sample results#
Plotted: vector — Sine Wave, [3,1]: amplitudes 1/2/3 at 2 rad/s (tried only because every scalar stimulus was refused)
Category dynamic · sample time 0.1 · 60 steps · commit 83b4036dc8d5efdf28a47c36be1e27203065c75b · produced by docsSample --out <folder> --blocks Symbolic_Expression Symbolic_Derivative Gradient Jacobian Hessian Divergence_And_Curl Laplacian Taylor_Approximation Linear_Program LTI_System Wind_Turbulence_Model --steps 60 · data docs/generated/samples/Control_Systems__Symbolic__Laplacian.json · the SVG is generated from those numbers by tools/docs/plot_svg.py, so it is a run and not a drawing (R-D10).