# [R] solve 2 var problem

Liaw, Andy andy_liaw at merck.com
Mon Apr 19 15:58:25 CEST 2004

```trace(K) is just sum(diag(K)).  Assuming by `.' you mean multiplication
(I'll use `*' below),

trace(x*A + y*B) = x*trace(A) + y*trace(B)

Let a = trace(A) = sum(diag(A)) and b = trace(B) = sum(diag(B)).  You are
then looking for (x, y) that satisfy

a*x + b*y < C

which ought to be trivial.  I don't think you need R for that.

Andy

> From: Ramzi TEMANNI
>
> Hi
>
> I'm getting started with R and i have difficulties finding
> how to solve this
> problem in R :
>
>
>
> Find x,y satisfying
>
> Trace(K) < C,
>
> K positive where ( K=x.A+y.B),
>
> [A,B,K square Matrix in  R(n x n), x,y in R]
>
>
>
> Thanks in advance,
>
> Ramzi
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

```