help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About simplify symbolic expression


From: Martin Helm
Subject: Re: About simplify symbolic expression
Date: Wed, 19 Oct 2011 18:21:45 +0200

Am Mittwoch, den 19.10.2011, 18:16 +0200 schrieb Martin Helm: 
> Am Mittwoch, den 19.10.2011, 04:04 -0700 schrieb Rui Pereira: 
> > Hello,
> > 
> > I have a question about OCTAVE.
> > I normally use Matlab and you can use symbolic toobox which allows you to
> > simplify
> > symbolic variables.
> > Is there in OCTAVE anything similar?
> > For instance in Matlab if I write:
> > 
> > "syms x1 x2
> > f=sin(x1)*sin(x1)+cos(x1)*cos(x1)+x2*x2*x1
> > simplify(f)
> > "
> > I obtain,
> > 
> > "f =
> >  
> > x1*x2^2 + cos(x1)^2 + sin(x1)^2
> >  
> > 
> > ans =
> >  
> > x1*x2^2 + 1
> >  "
> > 
> > How can I do the same in GNU OCTAVE?
> > 
> > Thanks a lot,
> > Rui Pereira
> With the package symbolic I can use the following 
> 
> x1 =sym('x1');
> x2 =sym('x2');
> f=sin(x1)*sin(x1)+cos(x1)*cos(x1)+x2*x2*x1;
> expand(f)
> ans =
> 
> sin(x1)^2+x2^2*x1+cos(x1)^2
> 
> It is installed with 
> pkg install -forge symbolic
> 
> 
> 

Sorry I copied exactly the wrong line (the one which does NOT work), the
expression needs to be written

f=Sin(x1)*Sin(x1)+Cos(x1)*Cos(x1)+x2*x2*x1

(the symbolic functions have a capital letter at the beginning but
results are shown without capitals).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]