Thread Subject: log with syms variables?

Subject: log with syms variables?

From: David Doria

Date: 21 Feb, 2008 14:39:02

Message: 1 of 3

if i do this

syms a b;
simplify(log(a*b))

i get log(a*b)

if i do this:

syms a b positive;
simplify(log(a*b))

i get log(a) + log(b)

The later is what I would like. Is it necessary to declare
the symbolic variables as 'positive'? Or am I doing
something else wrong?

Thanks,

Dave

Subject: log with syms variables?

From: David Doria

Date: 22 Feb, 2008 20:01:02

Message: 2 of 3

Can someone at least confirm this is the way it works?

Thanks,

Dave

"David Doria" <daviddoria@gmail.com> wrote in message
<fpk2e6$4db$1@fred.mathworks.com>...
> if i do this
>
> syms a b;
> simplify(log(a*b))
>
> i get log(a*b)
>
> if i do this:
>
> syms a b positive;
> simplify(log(a*b))
>
> i get log(a) + log(b)
>
> The later is what I would like. Is it necessary to declare
> the symbolic variables as 'positive'? Or am I doing
> something else wrong?
>
> Thanks,
>
> Dave

Subject: log with syms variables?

From: Arthur G

Date: 23 Feb, 2008 00:42:44

Message: 3 of 3

On 2008-02-22 15:01:02 -0500, "David Doria" <daviddoria@gmail.com> said:
> Can someone at least confirm this is the way it works?

You pretty much answered your own question. If your example isn't
enough "proof" that you need to declare variables as positive to
simplify as you desire, consider the following:

log( (-1)*(-1) ) = log(1) = 0

but

log(-1) = i*pi

so

log(-1) + log(-1) = 2i*pi


>
> Thanks,
>
> Dave
>
> "David Doria" <daviddoria@gmail.com> wrote in message
> <fpk2e6$4db$1@fred.mathworks.com>...
>> if i do this
>>
>> syms a b;
>> simplify(log(a*b))
>>
>> i get log(a*b)
>>
>> if i do this:
>>
>> syms a b positive;
>> simplify(log(a*b))
>>
>> i get log(a) + log(b)
>>
>> The later is what I would like. Is it necessary to declare
>> the symbolic variables as 'positive'? Or am I doing
>> something else wrong?
>>
>> Thanks,
>>
>> Dave

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com