## 433 Reputation

12 years, 226 days

## Thank u...

Thank u everyone who posted a reply i a,m very grateful 4 ur assistance

## I simplified the code a bit bt still no ...

restart:
n:=3:
s:=Matrix([[5,2,-1],[3,7,3],[-1,-4,6]]);
b:=[2,-1,1];

X:=[0,0,0];
Itr:=0:
while Itr > 0.01 do
su:=0:
for i from 1 to n do
for j from 1 to n do
if i <> j then
su:=su + s[i,j]*X[j];
fi:
od;

X[i]:=(b[i]-su)/s(i,i);

od;
Itr:=Itr + 1;
end do;

Without Itr (Iteration) this is what the program produces:

restart:
n:=3:
s:=Matrix([[5,2,-1],[3,7,3],[-1,-4,6]]);
b:=[2,-1,1];

X:=[0,0,0];

su:=0:
for i from 1 to n do
for j from 1 to n do
if i <> j then
su:=su + s[i,j]*X[j];
fi:
od;

X[i]:=(b[i]-su)/s(i,i);

od;

X1:=2/5

X2=-11/35

X3:= -37/210

The X1 value is correct  but the X2 & X3 values are not. I need help in succesfully getting the method to work for all values. When i remove the 'Itr' from my code and set i=j I get the following:

restart:
n:=3:
s:=Matrix([[5,2,-1],[3,7,3],[-1,-4,6]]):
b:=[2,-1,1]:
N:=5:
X:=[0,0,0];

su:=0:
for i from 1 to n do
for j from 1 to n do
if i = j then
su:=su + (s[i,j]*X[j]);
fi:
od;

X[i]:=(b[i]-su)/s(i,i);
od;

end do;

X:=     [0, 0, 0]

X1:=2/5

X2:=-1/7

X3:=1/6

These answers are correct but i cant get the program to do a loop. They are the first iteration values. {please Sm1 help}

## Thank U...

Thanx for ur help Joe and pagan much appriciated.

## oh yh x,y,z represents...

oh yh x,y,z represents numbers 2,3,7.

i hav tried doing but it dont work am really stuck

for a from 1 to 100 do
if a:= a / 2 or a/3
then     print(null)
else     print(a)
end if;
od;

## why dosn't it work...

How do i open the file as letters (not ascii numbers)?

restart:
outputfile:="C:\\Users\\x\\Desktop\\test3.txt":
with(FileTools[Text]):

"[104, 101, 108, 108, 111]"

convert(%,bytes);

[91, 49, 48, 52, 44, 32, 49, 48, 49, 44, 32, 49, 48, 56, 44, 32, 49, 48, 56,44, 32, 49, 49, 49, 93]

but

convert([104,101,108,108,111],bytes);

"hello"

## question( In need of help badly)...

These are the  question i was asked

Q.1. Write a procedalure that takes a list of characters as input and returns a corresponding list of ASCII values as output

Q.2.i)Write a prcedure that takes as its 3 inputs 2 positive integers a and b and a list of numbers. Each element of the returned list should consist of the corresponding element of the input list, raised to the power of b and taken modulo a.

Q2. ii) Check that if your procedure is used to encrypt a list of numbers with parameters a=33 and b= 3 and then encrypt the result with parameters a=33 and b=3, the final list matches the original list.

Thank you

## Without procedures...

Hi all the discussions above have procedures.

Is it possible to code in Newton's Method without using procedures?

 1 2 Page 2 of 2
﻿