FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Forum index » Science and Technology » Math » num-analysis
interpolation and derivative approximation
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
Author Message
Marc Dansereau
science forum beginner


Joined: 27 May 2005
Posts: 11

PostPosted: Fri May 27, 2005 12:19 am    Post subject: interpolation and derivative approximation Reply with quote

I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).

For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.

Thank you very much for your time.

Marc
Back to top
Peter Spellucci
science forum Guru


Joined: 29 Apr 2005
Posts: 702

PostPosted: Fri May 27, 2005 2:35 pm    Post subject: Re: interpolation and derivative approximation Reply with quote

In article <zrvle.23513$Ot6.1325950@news20.bellglobal.com>,
Marc Dansereau <bouloumag@hotmail.com> writes:
Quote:
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).

For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.

Thank you very much for your time.

Marc

the derivatives of the piecewise linear continuous interpolant give you
approximations to the partial derivatives of the true solution of
order O(max element diameter) provided your discretization is quasiuniform.
you can obtain superconvergence on the nodes by proper linear combinations of the
gradients at the neighboring elements. look up the literature for this
hth
peter
Back to top
Fred Krogh
science forum beginner


Joined: 02 May 2005
Posts: 24

PostPosted: Fri May 27, 2005 6:53 pm    Post subject: Re: interpolation and derivative approximation Reply with quote

Marc Dansereau wrote:
Quote:
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified on
points in a cubic 3D grid. I use trilinear interpolation to get the value
of the fields at the particle position. My code is based on the explanation
found in the book "Graphics Gems IV" (this code is availlable on
http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).

For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it dunring
the interpolation, but I don't know how to do.

Thank you very much for your time.

Marc
The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and

compute partial derivatives.
Fred
Back to top
Marc Dansereau
science forum beginner


Joined: 27 May 2005
Posts: 11

PostPosted: Fri May 27, 2005 9:06 pm    Post subject: Re: interpolation and derivative approximation Reply with quote

Fred Krogh wrote:

Quote:
Marc Dansereau wrote:
I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified
on points in a cubic 3D grid. I use trilinear interpolation to get the
value of the fields at the particle position. My code is based on the
explanation found in the book "Graphics Gems IV" (this code is availlable
on http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).

For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best
way to compute this derivative. I think it is possible to compute it
dunring the interpolation, but I don't know how to do.

Thank you very much for your time.

Marc
The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and
compute partial derivatives.
Fred

This code should be a good candidate for the "International Obfuscated C
Code Contest" (http://www.ioccc.org/main.html) ... ;-)

Seriously, do you have something more readable to suggest or a web site that
explain how I can implement my own algorithm. I don't want to just pick up
a code somewhere, I also want to be able to understand what it does.


Marc
Back to top
Fred Krogh
science forum beginner


Joined: 02 May 2005
Posts: 24

PostPosted: Mon May 30, 2005 7:25 pm    Post subject: Re: interpolation and derivative approximation Reply with quote

Marc Dansereau wrote:
Quote:
Fred Krogh wrote:


Marc Dansereau wrote:

I am new in this forum. I am working on a particle system where
physical quantities like velocity or diffusion coefficient are specified
on points in a cubic 3D grid. I use trilinear interpolation to get the
value of the fields at the particle position. My code is based on the
explanation found in the book "Graphics Gems IV" (this code is availlable
on http://www.soe.ucsc.edu/~pang/160/f99/Gems/GemsIV/trilerp.c).

For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best
way to compute this derivative. I think it is possible to compute it
dunring the interpolation, but I don't know how to do.

Thank you very much for your time.

Marc

The code at http://mathalacarte.com/cb/mom.fcg/ya59 will interpolate and
compute partial derivatives.
Fred


This code should be a good candidate for the "International Obfuscated C
Code Contest" (http://www.ioccc.org/main.html) ... ;-)

Seriously, do you have something more readable to suggest or a web site that
explain how I can implement my own algorithm. I don't want to just pick up
a code somewhere, I also want to be able to understand what it does.


Marc
As is explained on the site, the code you saw was the "mangled" version.

You need to pay for clean source. The mangled version gets identical
results to the clean one.
The documentation for the code (which fortunately is not mangled)
describes the method. If your orignal post had indicated you wanted to
code your own version, I would not have responded in the first place.
Regards,
Fred
Back to top
Han de Bruijn
science forum Guru


Joined: 18 May 2005
Posts: 1285

PostPosted: Tue May 31, 2005 6:18 am    Post subject: Re: interpolation and derivative approximation Reply with quote

Marc Dansereau wrote:

Quote:
For some fields like diffusion coefficients, I also want to compute the
partial derivative relative to the variable X, Y or Z. What is the best way
to compute this derivative. I think it is possible to compute it during
the interpolation, but I don't know how to do.

I would advise to use a comb of bell-shapes (Gaussian distributions):

f(x,y,z) = sum_(i,j,k) f(i,j,k) exp(-1/2.[(x-x_i)^2 + (y-y_j)^2 +
(z-z_k)^2]/sigma^2) . norm
where norm = [1/(sigma.sqrt(2.pi))]^3

Here sigma is _twice_ the grid spacing; Shannon's theorem now guarantees
that f(x,y,z) is sufficiently accurate. Be smart and don't calculate any
contributions outside the intervals +/- 2.pi.sigma around a gridpoint.

http://huizen.dto.tudelft.nl/deBruijn/programs/delphi.htm#ND

Herewith it's easy to infer any partial derivatives, up to any order.

Han de Bruijn
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
The time now is Fri Jul 30, 2010 5:32 am | All times are GMT
Forum index » Science and Technology » Math » num-analysis
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts 2D Lagrangian interpolation deltaquattro@gmail.com num-analysis 0 Fri Jul 21, 2006 1:57 pm
No new posts Continued fraction of e and approxima... eugene Math 1 Tue Jul 18, 2006 7:02 am
No new posts The problem of derivative on scalar s... shna num-analysis 4 Tue Jul 11, 2006 12:09 pm
No new posts Definition of Derivative and its rela... greenishguy@gmail.com Math 5 Tue Jul 11, 2006 11:02 am
No new posts Problems with interpolation of near z... deltaquattro num-analysis 0 Mon Jun 19, 2006 1:29 pm

Copyright © 2004-2005 DeniX Solutions SRL
Other DeniX Solutions sites: Electronics forum |  Medicine forum |  Unix/Linux blog |  Unix/Linux documentation |  Unix/Linux forums


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0964s ][ Queries: 14 (0.0639s) ][ GZIP on - Debug on ]