Generalizing to Many Points (Redux)To the left of x=0, the beam is straight (with no curvature) so u''=0 approaching from the left of x=0. Since u'' is to be continuous, we require u''=0 approaching from the right of x=0.
Let's rewrite genherm[x] to contain u0, s0, u1, s1 instead of a, b, c, d. We do this by substituting our initial conditions on u''''=0.
In[66]:=
gc1=genherm[x,u0,s0,u1,s1,h1]
Out[66]=
2
(-2 h1 s0 - h1 s1 - 3 u0 + 3 u1) x
u0 + s0 x + ----------------------------------- +
2
h1
3
(h1 s0 + h1 s1 + 2 u0 - 2 u1) x
--------------------------------
3
h1
In[67]:=
We require u''=0 (that is gc1''=0) approaching from the right of x=0.
In[68]:=
D[gc1,{x,2}]/.x->0
Out[68]=
2 (-2 h1 s0 - h1 s1 - 3 u0 + 3 u1)
----------------------------------
2
h1
Answer
Moving on to x=h1, we need to piece together two generalized hermite cubics. The first one is on the interval x=0 to x=h1. This is gc1 above. The second one is on the interval from x=h1 to x=h1+h2. The second one will have u1, s1, u2, s2. Because we are using unequally spaced points, we cannot just shift the generalized hermite cubic by h1 and hope to keep the initial conditions intact. We will solve the beam differential equation with endpoint conditions at h1 and h1+h2 to get our new cubic.
In[69]:=
DSolve[{u''''[x]==0,u[h1]==a,u'[h1]==b,u[h1+h2]==c,u'[h1+h2]==d},
u[x],x]
Out[69]=
2
(-3 a + 3 c - 2 b h1 - d h1) x
{{(a + b x + ------------------------------- +
2
h1
3
(2 a - 2 c + b h1 + d h1) x
----------------------------)[x] ->
3
h1
3 3 2 2
(-2 a h1 + 2 c h1 - 3 a h1 h2 + 3 c h1 h2 -
3 3 2 2 2 2
b h1 h2 - d h1 h2 - 2 b h1 h2 - d h1 h2 +
3 3 3
a h2 - b h1 h2 ) / h2 +
2 2
((6 a h1 - 6 c h1 + 6 a h1 h2 - 6 c h1 h2 +
2 2 2
3 b h1 h2 + 3 d h1 h2 + 4 b h1 h2 +
2 3 3
2 d h1 h2 + b h2 ) x) / h2 +
-(b - d) 3 (2 h1 + h2) (2 a - 2 c + b h2 + d h2)
(-------- - ---------------------------------------)
2 h2 3
2 h2
3
2 (2 a - 2 c + b h2 + d h2) x
x + ----------------------------}}
3
h2
Let's define our new function.
In[70]:=
gc2[x_,a_,b_,c_,d_]:=(-2*a*h1^3 + 2*c*h1^3 - 3*a*h1^2*h2 + 3*c*h1^2*h2 -
b*h1^3*h2 - d*h1^3*h2 - 2*b*h1^2*h2^2 - d*h1^2*h2^2 +
a*h2^3 - b*h1*h2^3)/h2^3 +
((6*a*h1^2 - 6*c*h1^2 + 6*a*h1*h2 - 6*c*h1*h2 +
3*b*h1^2*h2 + 3*d*h1^2*h2 + 4*b*h1*h2^2 +
2*d*h1*h2^2 + b*h2^3)*x)/h2^3 +
(-(b - d)/(2*h2) - (3*(2*h1 + h2)*
(2*a - 2*c + b*h2 + d*h2))/(2*h2^3))*x^2 +
((2*a - 2*c + b*h2 + d*h2)*x^3)/h2^3;
gc2[x,u1,s1,u2,s2]
Out[70]=
3 2 2 3 3
(-(h1 h2 s1) - 2 h1 h2 s1 - h1 h2 s1 - h1 h2 s2 -
2 2 3 2 3
h1 h2 s2 - 2 h1 u1 - 3 h1 h2 u1 + h2 u1 +
3 2 3
2 h1 u2 + 3 h1 h2 u2) / h2 +
2 2 3 2
((3 h1 h2 s1 + 4 h1 h2 s1 + h2 s1 + 3 h1 h2 s2 +
2 2 2
2 h1 h2 s2 + 6 h1 u1 + 6 h1 h2 u1 - 6 h1 u2 -
3
6 h1 h2 u2) x) / h2 +
-(s1 - s2)
(---------- -
2 h2
3 (2 h1 + h2) (h2 s1 + h2 s2 + 2 u1 - 2 u2) 2
-------------------------------------------) x +
3
2 h2
3
(h2 s1 + h2 s2 + 2 u1 - 2 u2) x
--------------------------------
3
h2
This is not too pleasant, but just to convince ourselves that this is indeed what we want, let's check out the initial conditions.
In[71]:=
gc2[h1,u1,s1,u2,s2];
Simplify[%]
Out[71]=
u1
In[72]:=
gc2[h1+h2,u1,s1,u2,s2];
Simplify[%]
Out[72]=
u2
In[73]:=
D[gc2[x,u1,s1,u2,s2],x]/.x->h1;
Simplify[%]
Out[73]=
s1
In[74]:=
D[gc2[x,u1,s1,u2,s2],x]/.x->h1+h2;
Simplify[%]
Out[74]=
s2
The continuity of u'' means that we require gc1'' as x approaches h1 from the left to equal gc2'' as x approaches h1 from the right.
In[75]:=
Simplify[D[gc1,{x,2}] /.x->h1]
Simplify[D[gc2[x,u1,s1,u2,s2],{x,2}] /.x->h1]
Out[75]=
2 (h1 s0 + 2 h1 s1 + 3 u0 - 3 u1)
---------------------------------
2
h1
Out[76]=
2 (-2 h2 s1 - h2 s2 - 3 u1 + 3 u2)
----------------------------------
2
h2
Answer
To determine what happens at our last point, let's suppose it is x=h1+h2. In this situation, u''=0 beyond x=h1+h2 (our last point) just like at our first point (zero curvature at ends). So gc2'' must equal 0 as x approaches h1+h2 from the left.
In[77]:=
Simplify[D[gc2[x,u1,s1,u2,s2],{x,2}]/.x->h1+h2]
Out[77]=
2 (h2 s1 + 2 h2 s2 + 3 u1 - 3 u2)
---------------------------------
2
h2
Answer
These equations also yield a matrix equation. It is not as nice as the case with equally spaced points. Let's look at it through a small example.