Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gsll
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antonio Juan
gsll
Commits
d87c9b66
Commit
d87c9b66
authored
15 years ago
by
TTCA Vukovic
Committed by
Liam Healy
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added example of `evaluate-integral'
parent
b4af2289
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
interpolation/spline-example.lisp
+21
-0
21 additions, 0 deletions
interpolation/spline-example.lisp
with
21 additions
and
0 deletions
interpolation/spline-example.lisp
+
21
−
0
View file @
d87c9b66
...
...
@@ -25,3 +25,24 @@
collect
(
list
xi
(
evaluate
spline
xi
:acceleration
acc
)))))
(
save-test
interpolation
(
spline-example
0.1d0
))
(
defun
evaluate-integral-example
(
&optional
(
intervals
4
))
"Evaluate integral of sin(x) in interval 0-pi. sin(x) is tabulated
over a 0-2pi interval and interpolated with
+periodic-cubic-spline-interpolation+"
(
let*
((
nodes
(
1+
intervals
))
(
max-node
(
1-
nodes
))
(
xarr
(
loop
with
step
=
(
/
(
*
2.0
pi
)
intervals
)
for
i
from
0
upto
max-node
collect
(
*
i
step
)))
(
xmarr
(
make-marray
'double-float
:initial-contents
xarr
))
;; cannot use (loop for x on (cl-array xmarr)...) -- c function gives error
(
ymarr
(
make-marray
'double-float
:initial-contents
(
loop
for
x
in
xarr
collect
(
sin
x
))))
(
acc
(
make-acceleration
))
(
spline
(
make-spline
+periodic-cubic-spline-interpolation+
xmarr
ymarr
)))
(
evaluate-integral
spline
0d0
(
coerce
pi
'double-float
)
:acceleration
acc
)))
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