# Question:Create a graph from solutions of each iteration step in algorithm

## Question:Create a graph from solutions of each iteration step in algorithm

Maple
Maple Professionals: I created an algorithm in maple, which calculates and prints out 2 values after each iteration, i.e. SFR and I (see code below). I wish to create a graph, which displays and connects the output of the iterations. That is, the y-axis should represent the variable SFR and the x-axis should represent the variable I. SFR ranges from 0 to 1 and I can range from 0 to infinity. I would be more than grateful, if someone could help me to create this graph within the code below. Thanks so much in advance, Nic > restart: with(stats): Digits := 14: > N := 4: > L := 0.002: > beta:=0.85: > beta:=0.85: > cost := Vector([2000,100,700,1000]): > lambda := Vector([0.2,0.6,0.3,0.7]): > Lambda := add(lambda[i], i=1..N): > DFR := s -> ( add(lambda[i]*add((L*lambda[i])^k*exp(-L*lambda[i])/k!, k = 0 .. s[i]-1), i = 1 .. N)/ Lambda ): > IN := Matrix(N,N,shape=identity): > S := Vector[row](N): > maxDFR := DFR(S): > while maxDFR <> prevDFR := maxDFR; > maxdelta := 0; > for k to N do > Sk := S + IN[k,1..N]; > DFRk := DFR(Sk); > delta := (DFRk - prevDFR)/cost[k]; > if delta > maxdelta then > maxdelta := delta; > maxDFR := DFRk; > Snxt := Sk; > end if; > end do; > if maxdelta = 0 then > print("cannot increase"); > break; > end if; > S := Snxt; Inv:=S.cost; printf("S = %g\n", S); printf("SFR = %.14g\n", maxDFR); printf("I = %g\n\n", Inv); > end do:
﻿