Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
860d1e03
Commit
860d1e03
authored
2 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Update doc to take into account the new syntax for R^d and R^dxd
parent
c9459491
No related branches found
No related tags found
1 merge request
!145
git subrepo clone git@gitlab.com:OlMon/org-themes.git packages/org-themes
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/userdoc.org
+30
-29
30 additions, 29 deletions
doc/userdoc.org
with
30 additions
and
29 deletions
doc/userdoc.org
+
30
−
29
View file @
860d1e03
...
...
@@ -74,10 +74,10 @@ mesh nodes according to a user-defined vector field $T: \mathbb{R}^2
let pi:R, pi = acos(-1);
let theta:R^2 -> R, x -> 0.5*pi*(x[0]*x[0]-1)*(x[1]*x[1]-1);
let M:R^2 -> R^2x2, x ->
(
cos(theta(x)), -sin(theta(x)),
sin(theta(x)), cos(theta(x))
)
;
let M:R^2 -> R^2x2, x ->
[[
cos(theta(x)), -sin(theta(x))
]
,
[
sin(theta(x)), cos(theta(x))
]]
;
let T: R^2 -> R^2, x -> x + M(x)*x;
let m:mesh, m = cartesian2dMesh(
(
-1,-1
)
,
(
1,1
)
, (20,20));
let m:mesh, m = cartesian2dMesh(
[
-1,-1
]
,
[
1,1
]
, (20,20));
m = transform(m, T);
...
...
@@ -856,10 +856,10 @@ are sorted by type of left hand side variable.
| ~R^2~ |
| ~0~ (special value) |
| list of 2 scalar (~B~, ~N~, ~Z~ or ~R~) expressions |
An example of initialization using a
list
or the special value ~0~ is
An example of initialization using a
n $\mathbb{R}^2$ value
or the special value ~0~ is
#+NAME: affectation-to-R2-from-list
#+BEGIN_SRC pugs :exports both :results output
let u:R^2, u =
(
-3, 2.5
)
;
let u:R^2, u =
[
-3, 2.5
]
;
let z:R^2, z = 0;
cout << "u = " << u << "\n";
cout << "z = " << z << "\n";
...
...
@@ -881,10 +881,10 @@ are sorted by type of left hand side variable.
| ~R^3~ |
| ~0~ (special value) |
| list of 3 scalar (~B~, ~N~, ~Z~ or ~R~) expressions |
An example of initialization
using a list
is
An example of initialization is
#+NAME: affectation-to-R3-from-list
#+BEGIN_SRC pugs :exports both :results output
let u:R^3, u =
(
-3, 2.5, 1E-2
)
;
let u:R^3, u =
[
-3, 2.5, 1E-2
]
;
let z:R^3, z = 0;
cout << "u = " << u << "\n";
cout << "z = " << z << "\n";
...
...
@@ -907,11 +907,12 @@ are sorted by type of left hand side variable.
| ~R^2x2~ |
| ~0~ (special value) |
| list of 4 scalar (~B~, ~N~, ~Z~ or ~R~) expressions |
An example of initialization using a list or the special value ~0~ is
An example of initialization using an $\mathbb{R}^{2\times2}$ value or
the special value ~0~ is
#+NAME: affectation-to-R2x2-from-list
#+BEGIN_SRC pugs :exports both :results output
let u:R^2x2, u =
(
-3, 2.5,
4, 1.2
)
;
let u:R^2x2, u =
[[
-3, 2.5
]
,
[
4, 1.2
]]
;
let z:R^2x2, z = 0;
cout << "u = " << u << "\n";
cout << "z = " << z << "\n";
...
...
@@ -925,12 +926,12 @@ are sorted by type of left hand side variable.
| ~R^3x3~ |
| ~0~ (special value) |
| list of 9 scalar (~B~, ~N~, ~Z~ or ~R~) expressions |
An example of initialization
using a list
is
An example of initialization is
#+NAME: affectation-to-R3x3-from-list
#+BEGIN_SRC pugs :exports both :results output
let u:R^3x3, u =
(
-3, 2.5, 1E-2,
2, 1.7, -2,
1.2, 4, 2.3
)
;
let u:R^3x3, u =
[[
-3, 2.5, 1E-2
]
,
[
2, 1.7, -2
]
,
[
1.2, 4, 2.3
]]
;
let z:R^3x3, z = 0;
cout << "u = " << u << "\n";
cout << "z = " << z << "\n";
...
...
@@ -1256,8 +1257,8 @@ constructions.
operators. Their syntax is the following.
#+NAME: Rd-Rdxd-access-operator
#+BEGIN_SRC pugs :exports both :results output
let x:R^2, x =
(
1,2
)
;
let A:R^3x3, A =
(
1,2,3
,
4,5,6
,
7,8,9
)
;
let x:R^2, x =
[
1,2
]
;
let A:R^3x3, A =
[[
1,2,3
],[
4,5,6
],[
7,8,9
]]
;
cout << "x[0] = " << x[0] << "\nx[1] = " << x[1] << "\n";
cout << "A[0,0] = " << A[0,0] << "\nA[2,1] = " << A[2,1] << "\n";
...
...
@@ -1614,9 +1615,9 @@ illustrate this, let us consider the following example.
#+BEGIN_SRC pugs :exports both
import mesh;
let m1:mesh, m1 = cartesian2dMesh(0,
(
1,1
)
, (10,10));
let m1:mesh, m1 = cartesian2dMesh(0,
[
1,1
]
, (10,10));
let m2:mesh, m2 = m1;
let m3:mesh, m3 = cartesian2dMesh(0,
(
1,1
)
, (10,10));
let m3:mesh, m3 = cartesian2dMesh(0,
[
1,1
]
, (10,10));
m3 = m1;
#+END_SRC
...
...
@@ -1653,8 +1654,8 @@ Let us provide an example to fix ideas.
#+NAME: compound-declaration
#+BEGIN_SRC pugs :exports both :results output
let (A,x,n): R^2x2*R^3*N;
A =
(
1,2
,
3,4
)
;
x =
(
2,4,6
)
;
A =
[[
1,2
],[
3,4
]]
;
x =
[
2,4,6
]
;
n = 2;
cout << "A = " << A << "\nx = " << x << "\nn = " << n << "\n";
...
...
@@ -1676,7 +1677,7 @@ different variables.
One can also use the following definition instruction
#+NAME: compound-definition
#+BEGIN_SRC pugs :exports both :results output
let (A,x,n): R^2x2*R^3*N, (A,x,n) = (
(
1,2
,
3,4
)
,
(
2,4,6
)
, 2);
let (A,x,n): R^2x2*R^3*N, (A,x,n) = (
[[
1,2
],[
3,4
]]
,
[
2,4,6
]
, 2);
cout << "A = " << A << "\nx = " << x << "\nn = " << n << "\n";
#+END_SRC
...
...
@@ -1721,7 +1722,7 @@ example.
let x: R^3;
let n: N;
(A,x,n) = (
(
1,2
,
3,4
)
,
(
2,4,6
)
, 2);
(A,x,n) = (
[[
1,2
],[
3,4
]]
,
[
2,4,6
]
, 2);
cout << "A = " << A << "\nx = " << x << "\nn = " << n << "\n";
#+END_SRC
...
...
@@ -1772,7 +1773,7 @@ Executing this code, one gets
The definition syntax is also possible.
#+NAME: tuple-definition
#+BEGIN_SRC pugs :exports both :results output
let x:(R^2), x = (
(
1,2
),(
3.4,2
)
, 0,
(
2,3
)
);
let x:(R^2), x = (
[
1,2
],[
3.4,2
]
, 0,
[
2,3
]
);
cout << x << "\n";
#+END_SRC
This code gives
...
...
@@ -2130,17 +2131,17 @@ Using compound types as input and output, one can write
let f : R^2x2*R*string -> R*string*R^3x3,
(A,x,s) -> (x*A[0,0]*A[1,1]-A[1,0],
A+","+x+","+s,
(
A[0,0], A[0,1], 0,
A[1,0], A[1,1], 0,
0, 0, x
)
);
[[
A[0,0], A[0,1], 0
]
,
[
A[1,0], A[1,1], 0
]
,
[
0, 0, x
]]
);
let x : R, x=0;
let s : string, s= "";
let A : R^3x3, A = 0;
(x,s,A) = f(
(
1,2
,
3,4
)
, 2.3, "foo");
(x,s,A) = f(
[[
1,2
],[
3,4
]]
, 2.3, "foo");
cout << "x = " << x
<< "\ns = " << s
<< "\nA = " << A << "\n";
let (y,t,A2):R*string*R^3x3, (y,t,A2) = f(
(
3,1
,
4,2
)
, -5.2, "bar");
let (y,t,A2):R*string*R^3x3, (y,t,A2) = f(
[[
3,1
],[
4,2
]]
, -5.2, "bar");
cout << "y = " << y
<< "\nt = " << t
<< "\nA2 = " << A2 << "\n";
...
...
@@ -2201,7 +2202,7 @@ function expressions.
let minus: R -> R, x -> -(x<0)*x;
let pm : R -> R*R, x -> (plus(x), minus(x));
let toR2: R*R -> R^2, (x,y) ->
(
x,y
)
;
let toR2: R*R -> R^2, (x,y) ->
[
x,y
]
;
cout << "pm(2) = " << toR2(pm(2)) << " pm(-3) = " << toR2(pm(-3)) << "\n";
#+END_SRC
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment