Jeff

75 Reputation

8 Badges

14 years, 36 days

MaplePrimes Activity


These are replies submitted by Jeff

Now how can I write a loop to create S, the piecewise function, if I have 40 pieces created (for a school porject) just the way you showed in the j loop?

My numerical analysis project includes creating an algorithm for a cubic spline (I cannot use any bulit in cubic spline functions). I created it as you suggested it, and created the piecewise part using cut and paste and manually update the indexes. In other words, I typed this (the function names have changed):

for i from 0 to N-1 do

v[i] := expand(a[i]+b[i]*(T-t[i])+c[i]*(T-t[i])^2+d[i]*(T-t[i])^3)

end do

V := piecewise(

t[0]<=T<=t[1],v[0],

t[1]<=T<=t[2],v[1],

...

t[39] <= T and T <= t[40], v[39]):

I wonder if their isn't an easier way.

 

Thanks. :D

If I read ?printlevel right, I can either display everything, or nothing, inside the do loop. For now, that's OK. As long as it does what I expect it so I can make it do what I want (as with any programming language, I guess).

Can I display a k_1 (k with a 1 subscript) string, k_2, etc? I tried a few combinations of %12s/a and quotes, right-apostrophe and left-apostrophe, but could not get it to work.

Thanks.

If I read ?printlevel right, I can either display everything, or nothing, inside the do loop. For now, that's OK. As long as it does what I expect it so I can make it do what I want (as with any programming language, I guess).

Can I display a k_1 (k with a 1 subscript) string, k_2, etc? I tried a few combinations of %12s/a and quotes, right-apostrophe and left-apostrophe, but could not get it to work.

Thanks.

Sorry, I've been away from this thread too long (schoolwork!).

Doug, you are correct. Assume was not quite what I sought. It seems like Maple is a missing this ability. Too bad, it would probably be very useful. Maybe they'll have it by the time I graduate (projected some time during the 2020s :D).

Sorry, I've been away from this thread too long (schoolwork!).

Doug, you are correct. Assume was not quite what I sought. It seems like Maple is a missing this ability. Too bad, it would probably be very useful. Maybe they'll have it by the time I graduate (projected some time during the 2020s :D).

Cool feature! Thanks, ev1.

Cool feature! Thanks, ev1.

Thanks (again), Alec.

Thanks (again), Alec.

Thanks (whew)... that'll do (for now).

How can I make it line up better when there are negative numbers w/in the array?

 

Here's the array, with the real values, after processing. See how it doesn't line up so well (not super important)

 0.77 0.00 0.00 0.00 0.00

0.62 -0.48 0.00 0.00 0.00

0.46 -0.55 -0.11 0.00 0.00

0.28 -0.58 -0.05 0.07 0.00

0.11 -0.57 0.01 0.07 0.00

 

Thanks.

Thanks (whew)... that'll do (for now).

How can I make it line up better when there are negative numbers w/in the array?

 

Here's the array, with the real values, after processing. See how it doesn't line up so well (not super important)

 0.77 0.00 0.00 0.00 0.00

0.62 -0.48 0.00 0.00 0.00

0.46 -0.55 -0.11 0.00 0.00

0.28 -0.58 -0.05 0.07 0.00

0.11 -0.57 0.01 0.07 0.00

 

Thanks.

Oh, yeah. After doing that, I need to create an array, F, with the first column having specific values, but the other 4 full of zeros. Like this (I copied and pasted this from the Matrix builder):

 

F := Matrix(5, 5, {(1, 1) = 2, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 3, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 7, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (4, 1) = 9, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = .64, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0})

 

Again, thanks.

1 2 Page 2 of 2