I wonder if there is a straightforward way to plot the following two equations in R
x and y are variables and the rest are known parameters.
when X is a vector of dimension n then
I wonder if there is a straightforward way to plot the following two equations in R
x and y are variables and the rest are known parameters.
when X is a vector of dimension n then
This is a math problem rather than programming. A bit of calculation would help the programming task a lot easier.
First, assume
c_1
andc_2
equal zero for simplicity. We can easily recover the original scale by shifting axes. Then, the matrix calculation can be written as follows.Now let
z = ax + by
andw = cx + dy
. Then, the first equation with absolute value metric would be written as:From this equation, assuming that gamma is positive, you can visualize
z
andw
as below.So, you can find a set of (
z, w
) combinations that satisfy the requirement and convert back to(x, y)
.The second equation with the maximum metric can be written as follows:
This implies that
(z, w)
can be visualized as below.Again, you can generate such
(z, w)
pairs and convert back to(x, y)
.Here is an R code for the first equation. You can try the second on your own.