|
On Saturday, June 29, 2013 5:01:09 PM UTC+5:30, Maya wrote:
> Hi,
>
>
>
> I am trying to solve this problem:
>
> p_i=max(0,(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i) if c_i>d_i
>
> and p_i=0 otherwise. p_i, c_i,d_i are diagonal elements of matrices P, C, D and A. I need to find x and after that to calculate p_i, but I do not know how to implement max because at first x is a symbolic variable.
>
>
>
> I would appreciate if anyone could help me.
>
> Maya
syms c_i d_i a_i x
>> expand(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i)
ans =
(c_i*d_i*((4*c_i^2*d_i)/(a_i*x) - (4*c_i*d_i^2)/(a_i*x) - 4*c_i*d_i + 1)^(1/2))/2 - 1
solve(-1+sqrt(1-4*c_i*d_i+4*(c_i-d_i)*c_i*d_i/(x*a_i))/2*c_i*d_i)
ans =
(c_i*d_i*(4*c_i - 4*d_i))/(a_i*(4*c_i*d_i + 4/(c_i^2*d_i^2) - 1))
this the value of x if p_i=0
i dont understand your problem exactly....
you want to find max(0,somenumber). is it?
here somenumber is a variable.... is it?
|