About simplify symbolic expression

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

About simplify symbolic expression

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
Reply | Threaded
Open this post in threaded view
|

Re: About simplify symbolic expression

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




_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: About simplify symbolic expression

martin_helm
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).


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: About simplify symbolic expression

Carnë Draug-2
In reply to this post by Rui Pereira
On 19 October 2011 12:04, Rui Pereira <[hidden email]> wrote:

> 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

Hi,

There is the symbolic package (part of the octave-forge packages, I'm
CC'ing this to its mailing-list), see
http://octave.sourceforge.net/symbolic/index.html which may do some of
the stuff you want. It doesn't have simplify() though, only expand(),
and it may be missing some others. If you are interested,
contributions for any package are always welcomed.

You should be able to install the package with 'pkg install -forge
symbolic' (if you're using a version older than 3.4, you'll need to
download the package manually from the octave-forge site).

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

RE: About simplify symbolic expression

Rui Pereira
In reply to this post by martin_helm
RE: About simplify symbolic expression

Hello,

Thanks a lot for your help:)

cheers,
rui


-----Mensagem original-----
De: martin_helm [via Octave] [[hidden email]]
Enviada: qua 19-10-2011 17:27
Para: Rui Miguel Soares Pereira
Assunto: Re: About simplify symbolic expression



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).


_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://octave.1599824.n4.nabble.com/About-simplify-symbolic-expression-tp3918238p3919227.html

To unsubscribe from About simplify symbolic expression, visit

Reply | Threaded
Open this post in threaded view
|

RE: About simplify symbolic expression

Rui Pereira
In reply to this post by Carnë Draug-2
RE: About simplify symbolic expression

Hi,

Thanks a lot for your help mate.

cheers
rui


-----Mensagem original-----
De: Carnë Draug-2 [via Octave] [[hidden email]]
Enviada: qua 19-10-2011 17:25
Para: Rui Miguel Soares Pereira
Assunto: Re: About simplify symbolic expression



On 19 October 2011 12:04, Rui Pereira <[hidden email]> wrote:
> 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

Hi,

There is the symbolic package (part of the octave-forge packages, I'm
CC'ing this to its mailing-list), see
http://octave.sourceforge.net/symbolic/index.html which may do some of
the stuff you want. It doesn't have simplify() though, only expand(),
and it may be missing some others. If you are interested,
contributions for any package are always welcomed.

You should be able to install the package with 'pkg install -forge
symbolic' (if you're using a version older than 3.4, you'll need to
download the package manually from the octave-forge site).

Carnë
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave


_______________________________________________
If you reply to this email, your message will be added to the discussion below:
http://octave.1599824.n4.nabble.com/About-simplify-symbolic-expression-tp3918238p3919224.html

To unsubscribe from About simplify symbolic expression, visit