Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

runs in octave(testet)>sagemath cloud(errors)

Hi, this is my assignment in numerical mathematics, this runs in octave unfortunatly not in sagemath, can someone see what the problem is? Here is the link to the sage math cloud https://cloud.sagemath.com/projects/666fc8f9-8619-46f9-b41d-c85afdef2169/files/2015-10-29-090250.sagews 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=invLPb invU=inv(U) z=invUy Az b

runs in octave(testet)>sagemath cloud(errors)

Hi, this is my assignment in numerical mathematics, this runs in octave unfortunatly Octave but unfortunately not in sagemath, SageMath, can someone see what the problem is? Here is is?

See the link to the sage math cloud https://cloud.sagemath.com/projects/666fc8f9-8619-46f9-b41d-c85afdef2169/files/2015-10-29-090250.sagews SageMathCloud worksheet https://cloud.sagemath.com/projects/666fc8f9-8619-46f9-b41d-c85afdef2169/files/2015-10-29-090250.sagews

Here is the code

a)

# a)
  

function y=f(x)
y=3/(2+x) endfunction

endfunction

function a=p(x)
y1=x^2 y2=x y3=1 a=[y1,y2,y3] endfunction

endfunction # b)

b)

# Stützstellen vector x

x

x=[-1 0 1] f(x(1)) f(x(2)) f(x(3))

f(x(3))

# Anzahl der Stützstellen bestimmer

bestimmer d=length(x) A=zeros(d,d)

d=length(x) A=zeros(d,d)

for i=1:3 A(i,:)=p(x(i)) endfor

endfor b=zeros(3,1)

b=zeros(3,1)

for i=1:3 b(i)=f(x(i)) endfor

endfor

b [L,U,P] = lu(A) invL=inv(L) y=invLPy=invL*P*b invU=inv(U) z=invU*y A*z b invU=inv(U) z=invUy Az b

runs in octave(testet)>sagemath cloud(errors)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/666fc8f9-8619-46f9-b41d-c85afdef2169/files/2015-10-29-090250.sagews

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
click to hide/show revision 4
retagged

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/666fc8f9-8619-46f9-b41d-c85afdef2169/files/2015-10-29-090250.sagews

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