Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Using max when there is symbolic variable
Replies: 3   Last Post: Jul 1, 2013 10:40 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
asif khan

Posts: 16
Registered: 6/24/13
Re: Using max when there is symbolic variable
Posted: Jun 30, 2013 3:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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?



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.