runs in Octave (tested) but not SageMathCloud (errors)
Hi, this is my assignment in numerical mathematics, this runs in Octave but unfortunately not in SageMath, can someone see what the problem is?
See the SageMathCloud worksheet https://cloud.sagemath.com/projects/6...
Here is the code
# a)
function y=f(x)
y=3/(2+x)
endfunction
function a=p(x)
y1=x^2
y2=x
y3=1
a=[y1,y2,y3]
endfunction
# b)
# Stützstellen vector x
x=[-1 0 1]
f(x(1))
f(x(2))
f(x(3))
# Anzahl der Stützstellen bestimmer
d=length(x)
A=zeros(d,d)
for i=1:3
A(i,:)=p(x(i))
endfor
b=zeros(3,1)
for i=1:3
b(i)=f(x(i))
endfor
b
[L,U,P] = lu(A)
invL=inv(L)
y=invL*P*b
invU=inv(U)
z=invU*y
A*z
b
The syntax of Octave and Sage languages are different. You should not expect that a file working for one of them would work with the other. Or perhaps I misunderstood your question...
Hi, from what I have understood, this IS the big point about sagecloud. If stated in the beginnig, that this is octave worksheet, every thing should work. Heres is an example: https://cloud.sagemath.com/projects/6... This is in octave but unfortunatelly there are no functions included