[Date Index]
[Thread Index]
[Author Index]
Re: weird interpolation issues
*To*: mathgroup at smc.vnet.net
*Subject*: [mg96642] Re: weird interpolation issues
*From*: Bill Rowe <readnews at sbcglobal.net>
*Date*: Wed, 18 Feb 2009 04:23:05 -0500 (EST)
On 2/17/09 at 6:24 AM, okty.gy.ned at gmail.com (Ned Lieb) wrote:
>I'm new to Mathematica and unfortunately am having some issues. I'm
>trying to construct a program to create an approximate symbolic
>function from a very large list of data points (6900 points, each
>with five associated variables). Mathematica is fritzing in two
>areas: first (this is probably trivial to fix), parallelization
>doesn't initialize; second, the lists of variables I'm extracting
>from my data table aren't being recognized as data points
>Mathematica can interpolate between. I've copied the plaintext of my
>source-code with comments explaining what each function is meant to
>do below.
>This is the Function I use to import my table. This seems to work
>correctly: I get a list of numbers which matches my data
>q[]=Import["C:\wfout2_k1_b1_s1_in.dat","FieldSeperators"->"
>","LineSeperators"->"/[NewLine]" ,"RepeatedSeperators"->"True"]
I very strongly suspect this is not doing what you think. I can
think of no reason to create a function with no arguments and
then define it to have a value equal to the data being read in.
That is what you are doing with q[]. I am almost certain you
would be better off using a simple variable, q, i.e.
q = Import["C ...
>This is a function I use to switch rows and columns, so that I have
>five lists of values coresponsing to my variables instead of a list
>of ~60000 points each carrying five values
>w[q]:=Transpose[q];
You want to use w = Transpose[q] here. Note you could do this in
one step by doing
w = Transpose@Import["C: ...
dispensing with any need for q.
>This defines the last two variables as the real and complex values
>of the function I'm trying to create by interpolation
>wf[r_,c_]:=r+I*c;
When using SetDelayed (:=) there is no need to terminate the
definition with a ;. The whole point of SetDelayed is to delay
evaluation. Consequently, there is no output returned when you
don't terminate the definition with a ;. Of course, using a ; to
terminate the definition causes no harm. It doesn't do anything
in this case.
>This is supposed to interpolate my imported values into a function
>DistributeDefinitions[w,wf,\[Psi],q];
I would define all of the functions before making a call to
DistributeDefinitions. The order you've done things may work. It
isn't clear to me whether it will or not from the documentation.
>\[Psi][x_,y_,z_,r_,c_]:=Interpolation[{x,y,z},Abs[wf[r,c]],{x,{w[[1]
>]}},{y,{ w[[2]]}},{z,{w[[3]]}},{r,{w[[4]]}},{c,{w[[5]]}}];
It isn't clear to me what this function is supposed to do. I
very much suspect you do not have it defined in a sensible
manner. Looking below, I see you are using x,y and z to be
scalars given values to be supplied by ContourPlot. That means
the first argument to Interpolation is a list of 3 elements, the
next is whatever is returned by wf, followed by arguments of the
form {number, {{number, number .... }}}. This doesn't look like
anything Interpolation is designed to accept. Look at the
documentation for Interpolation.
>This is supposed to make a graph of the function I made
>above with the function's values being shown by contour density
>ContourPlot3D[\[Psi],{x,0,20},{y,0,20},{z,0,20}]
This will be returned unevaluated by Mathematica. At the very
least this needs to be re-written as:
ContourPlot3D[\[Psi][x,y,z,r,c],{x,0,20},{y,0,20},{z,0,20}]
That is you need to call \[Psi] with the arguments you defined
it to require. Note, the way I've rewritten things it still
won't work since neither r nor c are defined.
Prev by Date:
**Re: FourierTrigSeries[] and user-defined function**
Next by Date:
**Re: Benchmark performance Under AIX**
Previous by thread:
**weird interpolation issues**
Next by thread:
**PlotStyle will not distribute over Table**
| |