## 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.

## Derivatives of Splines are not defined on some poi...

Hello everyone,

I have a question regarding my Spline interpolations. I am not an expert on the theory there, but the maple help tells me that the first derivative of an 3rd degree spline interpolation should exist at the knots. But a derivation returns "undefined" at some of the knots instead. Here is my example:

x(t):=Spline([[0, 0], [1, 1], [2, 2], [3, 2.2], [4, 1.8]],t,degree=3);

returns

x(t):=piecewise(t < 1, .953571428571429*t+0.464285714285714e-1*t^3, t < 2, -0.9286e-1+1.09285714285714*t+.139285714285714*(t-1)^2-.232142857142857*(t-1)^3, t < 3, .65000+.675000000000000*t-.557142857142857*(t-2)^2+0.821428571428571e-1*(t-2)^3, 2.77857-.192857142857143*t-.310714285714286*(t-3)^2+.103571428571429*(t-3)^3);

diff(x(t),t);

returns

piecewise(t < 1., .953571+.139286*t^2, t = 1., Float(undefined), t < 2., .814286+.278571*t-.696429*(t-1.)^2, t = 2., Float(undefined), t <= 3., 2.90357-1.11429*t+.246429*(t-2.)^2, 3. < t, 1.67143-.621429*t+.310714*(t-3.)^2);

Not defined at t=1 and t=2. Is it possible to get an interpolation of which the first derivative exists at every point? Thank you very much!

## 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 spline...

Hello,

I have to show cubicspline(...) and some kind of known function on the same axis, but it seems I can only show cubicspline(..) using Draw, but it cannot plot the function, so I can do only one at a time. Does anyone know how to do it?

## 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..

## how to define poly figures that enclose given area...

Question.doc

Can you make geometric figures that hold a particular area within a given perimeter of 12 matches

My attempt was to start at origin 0,0 and move up 1 unit (a,b) and then 1 unit up or to the right (c,d) etc ... until you enclose the required area (defined by linear spline) s.t. perimeter =12. but it doesn't really work

## plotting graph in 2d...

`Hi friends. Am trying to plot a graph that shows the difference between cubic spline, crank `
`nicolson and exact soution in 2d through this command but am not able to get it. `
`Whereas table is mentioned below at t=0.05`
`x	cubic	 crank	  exact0.05	0.0879	0.0855	0.07560.15	0.2514	0.2446	0.21940.25	0.3807	0.3708	0.34170.35	0.4625	0.4512	0.43050.45	0.4928	0.4815	0.47730.55	0.4747	0.4646	0.47330.65	0.4151	0.4609	0.4305`