## Help With Cubic Splines...

so i  got this code:

But it cannot Find a value for M (wich would be the maximum distance between) it literaly stays working for severeal minutes and necer gives an answer, also i cant find a function to do this for every value for n (n-1 steps from a to b), also would mean that xy would need to get more points, any idea of how can i solve this for any n? or at least fix the problem with M, and i do the steps from a to b Manually.

heeeelp me please this is driving me nuts

thanks a lot :)

## cubic b spline to solve ode...

I need to solve an ode of the type ay''+by'+cy=f(x) using cubic b spline.

can any one help me with the code or algorithm. Thanks

## 2D Grid Interpolation...

Hi,

I'm solving a 2D grid with some finite-diference methods. The result is a surface, i.e f(x,y) = z. Where X and Y and points on a grid.

I then need to integrate over this grid, i.e

int(f(x,y),[x=0..10, y=0..10])

I have tried interpolating the grid. I've used CurveFitting:-ArrayInterpolation() to interpolate points in this 2D space and then integrate over them.

I'm using a 30x30 grid, but this interpolation scheme takes far too long. The function generated from the ArrayInterpolation creates an interpolation every time a point is evaluated, which I assume is why the integral is very computationally expensive.

I would like to create a piecewise analytic function from the 2-D grid, perhaps using CurveFitting:-Spline(), however from my understanding this only works for 1D objects?

Is there any better solution for integrating a 2D numeric grid?

## Interpolating points with a cubic Hermite spline...

Hello,

I would like to understand this code which has been discussed in the forum a moment ago.

http://www.mapleprimes.com/posts/120138-Exact-Cubic-Hermite-Spline

Here the Maple code :

alec_modified_hermit.mw

Does somebody know the theoric developpements to this code ?

May you help me to add comments so as to facilitate the link with the theory ? One line in front of each procedure should be enough for me to understand. For the moment, I didn't manage to match it with the theory.

When I would understand this code, I would like in a second step compare the result with Catmull-Rom splines.

Thanks a lot for your help.

@acer : I think this subject may interest you

## Catmull-Rom spline curves...

Hello,

I try to use a Catmull-Rom spline which has to match on several points.

I use a code extracted from the book "Geometry and curves with maple".

Here you can find an extract which is visible from google book :

I have slightly modified the initial procedure crom_2d. I didn't find the error in my procedure. May you help me to find the blocking point of my procedure ?

Here I attached my code:

CalculSplineMatmull-Rom.mw

## Derivative of Spline at the nodes...

Hi!

This question is related to http://www.mapleprimes.com/questions/204419-Derivatives-Of-Splines-Are-Not-Defined and http://www.mapleprimes.com/questions/42114-Problem-With-Spline-Integrating , however I have not been able to apply the solutions given there to my problem.

I have a set of points given by

and certain function value points given by

where e1 is the function I am approximating.

Using

I come up with my piecewise function.

When I do diff(e4,x), however, the points at the nodes show "float(undefined) x=0.2..."(the node).

As it turns out, the value of the derivative on the left of the node is not equal to that of the right side by a factor of 10^(-7), in other words, numerically unimportant but high enough for maple to realise it is not the same number. How could I tell Maple that I am happy choosing, for example, the value given by the function on right side of the node?

I welcome any suggestions.

## How to get a specific polynomial from a piecewise ...

Dear,

I have this code generating a piecewise function:

> with(CurveFitting);

> points := [[0, 1], [1, 2.5], [3, 2.3], [4.2, 5], [5, 3.5], [5.8, 4.2], [7, 7], [8, 10]];

> splcurve := Spline(points, v);

In this particular case I have seven distinct polynomials. Someone knows how could I get one specific polynomial, for example, the one exactly before v < 4.2?

In other terms:

I'd like to define a new function, say 'f', that is exactly the polynomial just before v < 4.2 (e.g, something like f:=(splcurve, v < 4.2)). Do exists this possibility? (I have been looking for it elsewhere but without success!!)

## Plotting a Spline...

Hello, Mapleprimes' users.

I am using spline to fit a function to a given data (instead of polynomial). I created two examples with data of y=cos(x).

The first example has a domain X=0..10 and its result is satisfactory.

Ths second example has a larger domain, X=0..15, but I couldn't plot the spline function. The function fits well, but its line ends at X=~10.

Then I ckecked this spline assigning several values of X, and all the results are correct. The problem is on the plot step.

My mw file is:

> restart;
> with(plots);
> with(CurveFitting);
> plotsetup(default);

First Exemple Data (Y=cos(X)):
> X := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
> Y := [1, .54, -.41, -.99, -.65, .28, .96, .75, -.14, -.91, -.83];
> Piece1 := spline(X, Y, x, 2);
> fig1 := plot(Piece1, view = [0 .. 15, -1 .. 1]);
> fig2 := pointplot(X, Y);
> display(fig1, fig2);
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Second Example Data (Y=cos(X))::
> X := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
> Y := [1, .54, -.41, -.99, -.65, .28, .96, .75, -.14, -.91, -.83, 0., .84, .91, .13, -.76];
> Piece2 := spline(X, Y, x, 2);
> fig3 := plot(Piece2, view = [0 .. 15, -1 .. 1]);
> fig4 := pointplot(X, Y);
> display(fig3, fig4);
> test := unapply(Piece2, x);
> test(15);

test(15)=-0.76    #correct value!

My actual problem involves data from X=0 to X=300, and I have the same issue in this case.

Thanks.

## Fitting a spacecurve...

Hey

I'm trying to fit a spacecurve onto some points I have.

I know, I can use Spline to do this in 2D, but it doesn't work in 3D.

What command(s) can I use to fit a spacecurve onto my points?

## cubic spline and b-spline...

well i know this blog is for maple problems and question but badly need your help guys. i want to know difference between cubic spline and cubic b-spline in simple words..

## Plotting gridded data on a globe...

I'm sure there are other Maple users who have done these things, but I'm in the early stages of learning Maple 15 after moving (up) from Mathcad.

1. How do I plot a simple wireframe map of the world?

2. If I have a dataset of gridded data where the data is in the form [latitude, longitude, number] how do I map that data to a grid on the globe and give it a height according to the magnitude of the [number]?

3. Is there a way to smooth the heights of each...

## Trying to find corresponding x value for 50% area ...

Hi folks,

I'm trying to find the x value of my data set that corresponds to 50% of area under the curve. I've used curvefitting and splines to generate a piecewise function, and am able to find the area under the curve between my two approximated zeros (as this is the only relevant region). I would greatly appreciate any help, as I've been pulling my hair out for a couple hours now!

Cheers!

## extract data with interpolation...

hi

I have two sets of data namely x[i] and y[i], at first i want to pass a spline from all points (points are in 2d x-y diagram) and then extract some point from that. how can i write the suitable code  in maple?

thanks

## Diagramm: Fit a function one some measured points ...

HI,

I measured some points. This points are plotted in a graph. Now I want to make a fit on this points.

I now that the fit-function has to be like this:

F = A + B1 x e^(-t/C1) + B2 x e^(-t/C2)

Problem: how can I create a fitting function like that?

The best thing I found is the "spline"-fit, but it doesn't work properly. It has to be one lonely function, not a summary of several functions (like spline).

## "Exact" cubic Hermite spline

Maple

Following Christopher2222 request, I wrote the following procedures for "exact" cubic Hermite spline interpolation,

```p:=proc(x0,p0,m0,x1,p1,m1,x)
local t,d;
d:=x1-x0;
t:=(x-x0)/d;
p0+(d*m0+(3*(p1-p0)-d*(2*m0+m1)+(2*(p0-p1)+d*(m0+m1))*t)*t)*t
end:

pb:=proc(x0,p0,x1,p1,m1,x)
local t,d;
d:=x1-x0;
t:=(x-x0)/d;
p0+(2*(p1-p0)-d*m1+(p0-p1+d*m1)*t)*t
end:

pe:=proc(x0,p0,m0,x1,p1,x...```
 Page 1 of 1
﻿