Message Boards Message Boards

0
|
2318 Views
|
7 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Show output function interpolation

Posted 1 year ago

Hello,

I have these inputs as K

{0.00001, 0.00001, 0.}  1.0000000000000002e-10
{0.00001, 0.00001, 0.05}    2.607287266909108e-10
{0.00001, 0.00001, 0.1} 6.268239370533253e-10
{0.00001, 0.00001, 0.15}    1.404449897248381e-9
{0.00001, 0.00001, 0.2} 2.959062635977029e-9
{0.00001, 0.00001, 0.25}    5.907078426958897e-9
{0.00001, 0.00001, 0.3} 1.1245129573903091e-8

The first column is a, the second column is b, the third column is c, the fourth column is x x is a function of a b and c.

Now I have the following function in Mathematica:

Clear[K, iJDP]
K = ToExpression[Import[NotebookDirectory[] <> "JDP.txt", "TSV"]];
iJDP = Interpolation[Map[{#[[1]], #[[2]]} &, K], 
   InterpolationOrder -> {1, 1, 1}, Method -> "Spline"];

I would like to see the output in a,b,c I tried:

test1 = iJDP[a,b,c]
print[test1]

also with roun bracket print(test1)

I tried:

??iJDP

I tried:

Short[test,3]
Print[test]

Nothing seems to work.

I have this kind of result

{BSplineFunction[3,{{0.00001,1.},{0.00001,1.},{0.,1.}},{1,1,1},{False,False,False},{{{{1.*10^-10,2.60729*10^-10

But no the real output.

POSTED BY: Daniela Tortora
7 Replies

Sorry, please ignore the second part of my last reply.

POSTED BY: Gianluca Gorni

Ok, the trouble lies in the data: the values of a and b are all the same. You ask for an interpolation in three variables, but the data lie in a 1-dimensional line. Try interpolating only in c:

iJDP = Interpolation[Map[{Last[#[[1]]], #[[2]]} &, K], 
  Method -> "Spline"]

If you need to analyze the interpolation you can do this:

BSplineCurveFunction[pts_?MatrixQ] := 
  Module[{knots, deg}, 
   knots = Rationalize@BSplineFunction[pts][[6, 1]]; 
   deg = BSplineFunction[pts][[3, 1]];
   Apply[Function, 
    List@Sum[
      pts[[i + 1]] BSplineBasis[{deg, knots}, i, #], {i, 0, 
       Length[pts] - 1}]]];
BSplineCurveFunction[Map[{Last[#[[1]]], #[[2]]} &, K]][x]
% // PiecewiseExpand
POSTED BY: Gianluca Gorni

Many thanks for your replies. This is the file txt. @Gianluca Gorni, is that the result of the output? how do you print it? Many thanks

Attachments:
POSTED BY: Daniela Tortora

This is what I get:

{{{-10 + 0.000010000000000000003` e, -10 + 
    0.000010000000000000003` e, -10.`}}, {{-10 + 
    0.000026072872669091084` e, -10 + 
    0.000026072872669091084` e, -10 + 
    0.1303643633454554` e}}, {{-10 + 0.00006268239370533254` e, -10 + 
    0.00006268239370533254` e, -10 + 0.6268239370533254` e}}, {{-9 + 
    0.000014044498972483811` e, -9 + 0.000014044498972483811` e, -9 + 
    0.21066748458725715` e}}, {{-9 + 0.000029590626359770294` e, -9 + 
    0.000029590626359770294` e, -9 + 0.5918125271954059` e}}, {{-9 + 
    0.00005907078426958898` e, -9 + 0.00005907078426958898` e, -9 + 
    1.4767696067397242` e}}, {{-8 + 0.000011245129573903094` e, -8 + 
    0.000011245129573903094` e, -8 + 0.33735388721709275` e}}}
POSTED BY: Gianluca Gorni

Can you give us a sample JDP.txt file as attachment?

POSTED BY: Gianluca Gorni

I think that https://mathematica.stackexchange.com/questions/59944/extracting-the-function-from-interpolatingfunction-object answers your question, and it works with higher interpolation order.

POSTED BY: charles monneron

What do you get from this:

ToExpression[Import[NotebookDirectory[] <> "JDP.txt", "TSV"]]

I get nothing useful. Maybe your JDP.txt is different from mine.

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract