Wednesday, July 1, 2009

Calculate Sequence and Sum

For a(1)=sqrt(2) and a(n+1)=sqrt(2+sqrt(n)), calculate the sequence and sum for n=10.

clc; clear all; close all;

format long;

a=[];


S=[];


a(1)=sqrt(2);


for k=2:11


a(k)=sqrt(2+a(k-1))


end


a=a';


for m=1:k


S(m)=sum(a(1:m));


end



No comments:

Post a Comment

Any comments?

my-alpine and docker-compose.yml

 ``` version: '1' services:     man:       build: .       image: my-alpine:latest   ```  Dockerfile: ``` FROM alpine:latest ENV PYTH...