## 230 Reputation

10 years, 145 days
Beijing, China

## Want to convert system of equations mat...

Maple 2015

Dear Users! Hope everything fine here. For any vales of M and N I generated the system of equation.

for j from 2 while j <= N do
for i while i <= M do

omega[2]*(2-b[1])*u[i, j]+(2*b[1]*omega[2]-b[2]*omega[2]-omega[2]+1)*u[i, j-1]-omega[2]*(sum((b[l+2]-2*b[l+1]+b[l])*u[i, j-l-1], l = 1 .. j-2))
end do end do

But I want to convert it into matrix for example if N = 3 and M = 4, I need the following form

I am waiting for your response.

## Want to define piecewise function using ...

Maple 2015

Hi friends! Hope everything is fine here

I want to generate a piecewise function using some already computed functions. Like I compute B[0], B[1], B[2] and B[3] using some formula which are given as,

B[0] := (1/6)*x^3/h^3;
B[1] := (1/6)*(4*h^3-12*h^2*x+12*h*x^2-3*x^3)/h^3;
B[2] := -(1/6)*(44*h^3-60*h^2*x+24*h*x^2-3*x^3)/h^3;
B[3] := (1/6)*(64*h^3-48*h^2*x+12*h*x^2-x^3)/h^3;

Now, I want to define the corresponding piecewise function as

piecewise(x <= 0, 0, 0 < x and x <= h, B[0], `and`(h < x, x <= 2*h), B[1], `and`(2*h < x, x <= 3*h), B[2], `and`(3*h < x, x <= 4*h), (B[3], 0)

similarly for already computed functions B[0], B[1], B[2], B[3] and B[4] which are given as

B[0] := (1/24)*x^4/h^4;
B[1] := -(1/24)*(5*h^4-20*h^3*x+30*h^2*x^2-20*h*x^3+4*x^4)/h^4;
B[2] := (1/24)*(155*h^4-300*h^3*x+210*h^2*x^2-60*h*x^3+6*x^4)/h^4;
B[3] := -(1/24)*(655*h^4-780*h^3*x+330*h^2*x^2-60*h*x^3+4*x^4)/h^4;
B[4] := (1/24)*(625*h^4-500*h^3*x+150*h^2*x^2-20*h*x^3+x^4)/h^4;

I want to define the corresponding piecewise function as

piecewise(x <= 0, 0, 0 < x and x <= h, B[0], `and`(h < x, x <= 2*h), B[1], `and`(2*h < x, x <= 3*h), B[2], `and`(3*h < x, x <= 4*h), B[3], `and`(4*h < x, x <= 5*h), B[4], 0)

Can someone please let me know a general procedure (using seq command, loop etc.) to define piecewise function if B[0], B[1], B[2],...,B[M] are known? I shall be very thankful for your answer.

## Simplify an expression in special way...

Maple 2015

Dear Users!

Hope everything going find with you. I want to generate sequence of Spline[i,p], p=1…M as given bellow

restart; M := 3;
for p while p <= M do
(x-x[i])*B[i, p-1]/(x[i+p]-x[i])+(x[i+p+1]-x)*B[i+1, p-1]/(x[i+p+1]-x[i+1]);
B[i, p] := collect(%, [`\$`(B[i+s, 0], s = 0 .. M)]);
B[i+1, p] := eval(%, i = i+1)
end do;
for p while p <= M do
Spline[i, p] := B[i, p]
end do

The expression for Spline[i,1] and Spline[i,2] are fine but the expressions of Spline [i,p] p>2 is not in simplified form I got the its simplification like given bellow for Spline[i,3]

Spline[i, 3]:=(x-x[i])^3*B[i, 0]/((x[i+3]-x[i])*(x[i+2]-x[i])*(x[i+1]-x[i]))+(((x-x[i])*(x-x[i]))*(x[i+2]-x)/((x[i+3]-x[i])*(x[i+2]-x[i])*(x[i+2]-x[i+1]))+(x-x[i])*(x[i+3]-x)*(x-x[i+1])/((x[i+3]-x[i])*(x[i+3]-x[i+1])*(x[i+2]-x[i+1]))+(x[i+4]-x)*(x-x[i+1])^2/((x[i+4]-x[i+1])*(x[i+3]-x[i+1])*(x[i+2]-x[i+1])))*B[i+1, 0]+((x-x[i])*(x[i+3]-x)^2/((x[i+3]-x[i])*(x[i+3]-x[i+1])*(x[i+3]-x[i+2]))+(x[i+4]-x)*(x-x[i+1])*(x[i+3]-x)/((x[i+4]-x[i+1])*(x[i+3]-x[i+1])*(x[i+3]-x[i+2]))+((x[i+4]-x)*(x[i+4]-x))*(x-x[i+2])/((x[i+4]-x[i+1])*(x[i+4]-x[i+2])*(x[i+3]-x[i+2])))*B[i+2, 0]+(x[i+4]-x)^3*B[i+3, 0]/((x[i+4]-x[i+1])*(x[i+4]-x[i+2])*(x[i+4]-x[i+3]));

I am waiting for positive respone. Please take care and thanks in advance

## Addition of two piecewise functions...

Maple 2015

Dear Users!

For a given piecewise function S(x)

I want to generate the following functions phi[1], phi[2],... for n = 9

## Assign specific name of elements in a Ve...

Maple 2015

Hello Users!

I want to assign some specific names of elements in a vector A:

A:=Vector[row](19, {(1) = 14.9057064333276, (2) = 14.4384716751962, (3) = 14.0155569170648, (4) = 13.6381346589334, (5) = 13.3075724008020, (6) = 13.0254476426706, (7) = 12.7935628845392, (8) = 12.6139606264079, (9) = 12.4889383682765, (10) = 12.4210636101451, (11) = 12.4131888520137, (12) = 12.4684665938823, (13) = 12.5903643357509, (14) = 12.7826795776196, (15) = 13.0495548194882, (16) = 13.3954925613568, (17) = 13.8253703032254, (18) = 14.3444555450940, (19) = 14.9584207869626});

like

y[1,1]:=14.9057064333276;

y[1,2]:=14.4384716751962;

y[1,3]:=14.0155569170648;

...

y[1,19]:=14.9584207869626;

Later, I have to use y[1,1], y[1,2],...,y[1,19] for further calculations. I used op command but it does not work. Please help me how I can assign the name.