[R] Query on while loop
Bert Gunter
bgunter@4567 @end|ng |rom gm@||@com
Sat Jul 21 00:42:09 CEST 2018
I don't know how to say this charitably, but your post indicates that you
**really need to go through an R tutorial or two.** Rather than give you
answers to these very basic matters, a couple of hints:
1. A and P are vectors with 3 elements, not matrices .
2. I presume things like c11 and c32 are meant to be subscripts but that is
not how subscripts are written in R. R also can do such calculations on
whole objects rather than elementwise;
3. X1 is undefined (INF) as it is = 1/0 . So I have no idea what you
expect here.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Fri, Jul 20, 2018 at 2:57 PM, Atanasio Alberto Tembe Tembe <
manotembe using gmail.com> wrote:
> Hello,
>
> I have two matrices: a<-matrix(c(100,350,100,240,150,210,60,120,200 ),3,3)
> and c<-matrix(c(2,9,13,10,4,11,14,12,3),3,3).
>
> I have also defined the following variables:
> K=0
> A[i,j]=colSums(a)
> P[i,j]=rowSums(a)
> F[i,j]=c[i,j]^(-2 )
>
> Using these data I want to perform the calculation which must end when
> a convergence between X and Y values is reached.
>
> X1=1/(K*A1*c11+K*A2*c12+K*A3*c13)
>
> Y1=1/(X1*P1*c11+X1*P1*c12+X1*P1*c13)
>
> X2=1/(Y1*A1*c21+Y1*A2*c22+Y1*A3*c23)
>
> Y2=1/(X2*P2*c21+X2*P2*c22+X2*P2*c23)
>
> X3=1/(Y1*A1*c31+Y1*A2*c32+Y1*A3*c33)
>
> Y3=1/(X2*P3*c31+X2*P3*c32+X2*P3*c33)
>
>
>
> I have been struggling over this for some time. Your support is highly
> appreciated.
>
> Thanks
>
>
> --
> Atanasio Alberto Tembe (Mr)
> Doctoral student
> Graduate School of Urban Innovation
> Transportation and Urban Engineering Laboratory
> Yokohama National University
> Tel: +81-(0)80-4605-1305 <+81%2080-8080-2482>
> Mail: tembe-atanasio-dz using ynu.jp <pattamaporn-wongwiriya-cs using ynu.jp>
> manotembe using gmail.com <pattamaporn.w using gmail.com>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list