Ask your own question, for FREE!
Physics 8 Online
OpenStudy (anonymous):

cubic spline program

OpenStudy (anonymous):

program: quadspline:=proc(x::Vector,y::Vector,t::name) local n,k,S,j,eq,tt,s; n:=LinearAlgebra:-Dimensions(x)-1; for k from 1 to n do s[k]:=a[k]*(t-x[k])^2+b[k]*(t-x[k])+c[k]; end do; j:=0; for k from 1 to n do j:=j+1; eq[j]:=subs(t=x[k],s[k])=y[k]; j:=j+1; eq[j]:=subs(t=x[k+1],s[k])=y[k+1]; end do; for k from 1 to n-1 do j:=j+1; eq[j]:=subs(t=x[k+1],diff(s[k],t))=subs(t=x[k+1],diff(s[k+1],t)); end do; j=j+1; eq[j]:=subs(t=x[1],diff(s[1],t,t))=2; tt:=solve({seq(eq[j],j=1..4*n)},{seq(a[j],j=1..n),seq(b[j],j=1..n),seq(c[j],j=1..n)}); assign(tt); S:=piecewise(seq(op([t>=x[k] and t<=x[k+1],s[k]]),k=1..n)); return S; end proc

OpenStudy (anonymous):

its the last problem on there

OpenStudy (anonymous):

i keep getting that error message

OpenStudy (anonymous):

did you open the pdf?

OpenStudy (anonymous):

what pdf?

OpenStudy (anonymous):

OpenStudy (anonymous):

scroll all the way to the bottom to see the error message

OpenStudy (anonymous):

({seq(eq[j],j=1..4*n)},{seq(a[j],j=1..n),seq(b[j],j=1..n),seq(c[j],j=1..n)}) strange parentheses here

OpenStudy (anonymous):

yep I think it's that line...

OpenStudy (anonymous):

i dont think so, thats is exactly how the prof. has it on his version of the program. What i want to know is what that error is

OpenStudy (anonymous):

can't plot a, b,c etc

OpenStudy (anonymous):

it's not passing the values it solved for but the names of the constants instead.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!