From: Andy on
Well, the error message is clear. Your expression is a symbolic expression, and it doesn't make sense to ask if one symbol is less than another. You need to convert your symbols to doubles before comparing them.
From: Kittithad Wangveerathananon on
"Andy " <myfakeemailaddress(a)gmail.com> wrote in message <i3rrja$sr7$1(a)fred.mathworks.com>...
> Well, the error message is clear. Your expression is a symbolic expression, and it doesn't make sense to ask if one symbol is less than another. You need to convert your symbols to doubles before comparing them.

Wow, I never know about the function double before. Where does its name come from? I'm confues that it is all numbers, though still with operators included, but no symbols in the expression. Why it is regarded as a symbolic?

Anyway, it works when applying double(), thanks for the tip.
Your help is highly appreciated.
From: Steven_Lord on


"Kittithad Wangveerathananon" <kittithad(a)startfromyou.com> wrote in message
news:i3rsms$a7p$1(a)fred.mathworks.com...
> "Andy " <myfakeemailaddress(a)gmail.com> wrote in message
> <i3rrja$sr7$1(a)fred.mathworks.com>...
>> Well, the error message is clear. Your expression is a symbolic
>> expression, and it doesn't make sense to ask if one symbol is less than
>> another. You need to convert your symbols to doubles before comparing
>> them.
>
> Wow, I never know about the function double before. Where does its name
> come from? I'm confues that it is all numbers, though still with operators
> included, but no symbols in the expression. Why it is regarded as a
> symbolic?

Because that's what SOLVE returns. You can have a sym object that contains
no symbolic variables at all, and that's perfectly valid.

two = sym(2);

This is useful for many reasons, one of which is computing large values
without losing precision due to an intermediate result being stored in
double.

twoTo1500 = two^1500
twoTo1500Double = sym(2^1500)

The former performs the calculation symbolically, while the latter performs
the calculation numerically (which overflows to Inf) and converts that Inf
result into a symbolic object.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

First  |  Prev  | 
Pages: 1 2
Prev: Sine Curve Fit to Data
Next: Chemical Markup Language