Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: syms and vpa problem

Subject: syms and vpa problem

From: P

Date: 07 Aug, 2007 20:00:59

Message: 1 of 9

Hi all,

I have a variable called

sym_dPhi =
-282270057375923/2361183241434822606848*cos(phis
+2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
+1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
+1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
+5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
+6355945788037667/1125899906842624)

where phis is created as syms phis.

vpa(sym_dyPhi,5) yields me
ans =

[ empty sym ]

Why ?


On a parallel line ...

>> syms B
>> syms c; B = 1 + pi + c

B =
1165754695714211/281474976710656+c

>> vpa(B,2)
ans =
 4.1+c

Works !

How come ? What am I doing wrong ? Any suggestions ?

Thanks,
ethnicatom

Subject: Re: syms and vpa problem

From: P

Date: 07 Aug, 2007 20:02:18

Message: 2 of 9

On Aug 7, 4:00 pm, P <prashanthr...@gmail.com> wrote:
> Hi all,
>
> I have a variable called
>
> sym_dPhi =
> -282270057375923/2361183241434822606848*cos(phis
> +2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
> +1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
> +1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
> +5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
> +6355945788037667/1125899906842624)
>
> where phis is created as syms phis.
>
> vpa(sym_dyPhi,5) yields me
> ans =
>
> [ empty sym ]
>
> Why ?
>
> On a parallel line ...
>
> >> syms B
> >> syms c; B = 1 + pi + c
>
> B =
> 1165754695714211/281474976710656+c
>
> >> vpa(B,2)
>
> ans =
> 4.1+c
>
> Works !
>
> How come ? What am I doing wrong ? Any suggestions ?
>
> Thanks,
> ethnicatom

please note even vpa(sym_dyPhi,25) yields me no answer !

Subject: Re: syms and vpa problem

From: ellieandrogerxyzzy@mindspring.com.invalid (Roger Stafford)

Date: 07 Aug, 2007 22:30:17

Message: 3 of 9

In article <1186516859.503046.118710@22g2000hsm.googlegroups.com>, P
<prashanthramu@gmail.com> wrote:

> Hi all,
>
> I have a variable called
>
> sym_dPhi =
> -282270057375923/2361183241434822606848*cos(phis
>
+2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
>
+1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
>
+1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
>
+5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
> +6355945788037667/1125899906842624)
>
> where phis is created as syms phis.
>
> vpa(sym_dyPhi,5) yields me
> ans =
>
> [ empty sym ]
>
> Why ?
>
>
> On a parallel line ...
>
> >> syms B
> >> syms c; B = 1 + pi + c
>
> B =
> 1165754695714211/281474976710656+c
>
> >> vpa(B,2)
> ans =
> 4.1+c
>
> Works !
>
> How come ? What am I doing wrong ? Any suggestions ?
>
> Thanks,
> ethnicatom
----------------------
  With my ancient version of matlab (4a), 'sym' variables are simply
strings. When I copy your string with its five cosine functions into a
single long string on the command line to define a symbolic variable,
matlab complains that it can't see the end of the string. When I break it
up into five separate command line strings and then concatenate them into
a single string, it works fine. The answer is:

vpa(f,5)

ans =

-.11955e-6*cos(phis+2.5183)-.30968e-6*cos(phis+5.8589)+.11736e-6*cos(phis+5.9230)-.35873e-6*cos(phis+.65138)+.94688e-7*cos(phis+5.6452)

  So, at least in my case, the trouble seems to be due to the allowable
length of the command line string, not the length of string matlab's Maple
can handle. It seems possible that your trouble may also be due to some
such limitation on the command line string length, even if your Symbolic
Toolbox itself may be very different from mine.

Roger Stafford

Subject: Re: syms and vpa problem

From: us

Date: 07 Aug, 2007 22:48:22

Message: 4 of 9

P:
<SNIP has a very simple variable precision arithmetic: it's
simply always empty...

here (r2007a) your example yields

syms phis
s=...
-282270057375923/2361183241434822606848*...
     cos(phis+2835403426559781/1125899906842624)-...
5849622991223293/18889465931478580854784*...
     cos(phis+1649123417284613/281474976710656)+...
8867307977828847/75557863725914323419136*...
     cos(phis+1667188769632673/281474976710656)...
-6776253911855553/18889465931478580854784*...
     cos(phis+5867111522062989/9007199254740992)...
+7154406299740559/75557863725914323419136*...
     cos(phis+6355945788037667/1125899906842624);
vpa(s,1)
% -.1e-6*cos(phis+3.)-.1e-6*cos(phis+6.)-.4e-6*cos(phis+.7)

us

Subject: Re: syms and vpa problem

From: P

Date: 08 Aug, 2007 01:23:41

Message: 5 of 9

On Aug 7, 6:48 pm, "us " <u...@neurol.unizh.ch> wrote:
> P:
> <SNIP has a very simple variable precision arithmetic: it's
> simply always empty...
>
> here (r2007a) your example yields
>
> syms phis
> s=...
> -282270057375923/2361183241434822606848*...
> cos(phis+2835403426559781/1125899906842624)-...
> 5849622991223293/18889465931478580854784*...
> cos(phis+1649123417284613/281474976710656)+...
> 8867307977828847/75557863725914323419136*...
> cos(phis+1667188769632673/281474976710656)...
> -6776253911855553/18889465931478580854784*...
> cos(phis+5867111522062989/9007199254740992)...
> +7154406299740559/75557863725914323419136*...
> cos(phis+6355945788037667/1125899906842624);
> vpa(s,1)
> % -.1e-6*cos(phis+3.)-.1e-6*cos(phis+6.)-.4e-6*cos(phis+.7)
>
> us

Thanks ! Really dont know whats going wrong here !

I am running ...

MATLAB Version 7.3.0.298 (R2006b)
Operating System: Linux 2.6.18-8.1.1.el5 #1 SMP Mon Feb 26 20:37:57
EST 2007 x86_64


Subject: Re: syms and vpa problem

From: Steven Lord

Date: 08 Aug, 2007 01:48:34

Message: 6 of 9


"P" <prashanthramu@gmail.com> wrote in message
news:1186516859.503046.118710@22g2000hsm.googlegroups.com...
> Hi all,
>
> I have a variable called
>
> sym_dPhi =
> -282270057375923/2361183241434822606848*cos(phis
> +2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
> +1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
> +1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
> +5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
> +6355945788037667/1125899906842624)
>
> where phis is created as syms phis.
>
> vpa(sym_dyPhi,5) yields me
> ans =
>
> [ empty sym ]
>
> Why ?

Do you have a typo in your command or in your posting? In the first output,
your variable is named sym_dPhi, while in your command it's sym_dyPhi. If
you had a variable named sym_dyPhi that was empty, VPA would return an empty
sym. Alternately, if the line in this posting has a typo and you're
actually computing vpa(sy_dPhi, 5), what is phis at the time you call VPA?

--
Steve Lord
slord@mathworks.com


Subject: Re: syms and vpa problem

From: P

Date: 08 Aug, 2007 04:43:26

Message: 7 of 9

On Aug 7, 9:48 pm, "Steven Lord" <slord@mathworks.com> wrote:
> "P" <prashanthramu@gmail.com> wrote in message
>
> news:1186516859.503046.118710@22g2000hsm.googlegroups.com...
>
>
>
> > Hi all,
>
> > I have a variable called
>
> > sym_dPhi =
> > -282270057375923/2361183241434822606848*cos(phis
> > +2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
> > +1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
> > +1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
> > +5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
> > +6355945788037667/1125899906842624)
>
> > where phis is created as syms phis.
>
> > vpa(sym_dyPhi,5) yields me
> > ans =
>
> > [ empty sym ]
>
> > Why ?
>
> Do you have a typo in your command or in your posting? In the first output,
> your variable is named sym_dPhi, while in your command it's sym_dyPhi. If
> you had a variable named sym_dyPhi that was empty, VPA would return an empty
> sym. Alternately, if the line in this posting has a typo and you're
> actually computing vpa(sy_dPhi, 5), what is phis at the time you call VPA?
>
> --
> Steve Lord
> slord@mathworks.com

Hi Steve,

Thanks for replying !

Sorry about my initial post. I guarantee no typos in my script.

when I call "phis", its still a sym ... meaning I have not substituted
at value. I do that in the next step using subs(sym_dyPhi,some_value).

What next ?

Thanks,
P

Subject: Re: syms and vpa problem

From: Steven Lord

Date: 08 Aug, 2007 14:25:07

Message: 8 of 9


"P" <prashanthramu@gmail.com> wrote in message
news:1186548206.565623.216510@k79g2000hse.googlegroups.com...
> On Aug 7, 9:48 pm, "Steven Lord" <slord@mathworks.com> wrote:
>> "P" <prashanthramu@gmail.com> wrote in message
>>
>> news:1186516859.503046.118710@22g2000hsm.googlegroups.com...
>>
>>
>>
>> > Hi all,
>>
>> > I have a variable called
>>
>> > sym_dPhi =
>> > -282270057375923/2361183241434822606848*cos(phis
>> > +2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
>> > +1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
>> > +1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
>> > +5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
>> > +6355945788037667/1125899906842624)
>>
>> > where phis is created as syms phis.
>>
>> > vpa(sym_dyPhi,5) yields me
>> > ans =
>>
>> > [ empty sym ]
>>
>> > Why ?
>>
>> Do you have a typo in your command or in your posting? In the first
>> output,
>> your variable is named sym_dPhi, while in your command it's sym_dyPhi.
>> If
>> you had a variable named sym_dyPhi that was empty, VPA would return an
>> empty
>> sym. Alternately, if the line in this posting has a typo and you're
>> actually computing vpa(sy_dPhi, 5), what is phis at the time you call
>> VPA?
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>
> Hi Steve,
>
> Thanks for replying !
>
> Sorry about my initial post. I guarantee no typos in my script.
>
> when I call "phis", its still a sym ... meaning I have not substituted
> at value. I do that in the next step using subs(sym_dyPhi,some_value).
>
> What next ?

I think you're going to need to post:

the content of the sym_dyPhi variable
the content of the phis variable
the value you're substituting into sym_dyPhi
the output of "subs(sym_dyPhi, <the value you're substituting in>)"

--
Steve Lord
slord@mathworks.com


Subject: Re: syms and vpa problem

From: P

Date: 10 Aug, 2007 12:24:32

Message: 9 of 9

On Aug 8, 10:25 am, "Steven Lord" <sl...@mathworks.com> wrote:
> "P" <prashanthr...@gmail.com> wrote in message
>
> news:1186548206.565623.216510@k79g2000hse.googlegroups.com...
>
>
>
> > On Aug 7, 9:48 pm, "Steven Lord" <sl...@mathworks.com> wrote:
> >> "P" <prashanthr...@gmail.com> wrote in message
>
> >>news:1186516859.503046.118710@22g2000hsm.googlegroups.com...
>
> >> > Hi all,
>
> >> > I have a variable called
>
> >> > sym_dPhi =
> >> > -282270057375923/2361183241434822606848*cos(phis
> >> > +2835403426559781/1125899906842624)-5849622991223293/18889465931478580854784*cos(phis
> >> > +1649123417284613/281474976710656)+8867307977828847/75557863725914323419136*cos(phis
> >> > +1667188769632673/281474976710656)-6776253911855553/18889465931478580854784*cos(phis
> >> > +5867111522062989/9007199254740992)+7154406299740559/75557863725914323419136*cos(phis
> >> > +6355945788037667/1125899906842624)
>
> >> > where phis is created as syms phis.
>
> >> > vpa(sym_dyPhi,5) yields me
> >> > ans =
>
> >> > [ empty sym ]
>
> >> > Why ?
>
> >> Do you have a typo in your command or in your posting? In the first
> >> output,
> >> your variable is named sym_dPhi, while in your command it's sym_dyPhi.
> >> If
> >> you had a variable named sym_dyPhi that was empty, VPA would return an
> >> empty
> >> sym. Alternately, if the line in this posting has a typo and you're
> >> actually computing vpa(sy_dPhi, 5), what is phis at the time you call
> >> VPA?
>
> >> --
> >> Steve Lord
> >> sl...@mathworks.com
>
> > Hi Steve,
>
> > Thanks for replying !
>
> > Sorry about my initial post. I guarantee no typos in my script.
>
> > when I call "phis", its still a sym ... meaning I have not substituted
> > at value. I do that in the next step using subs(sym_dyPhi,some_value).
>
> > What next ?
>
> I think you're going to need to post:
>
> the content of the sym_dyPhi variable
> the content of the phis variable
> the value you're substituting into sym_dyPhi
> the output of "subs(sym_dyPhi, <the value you're substituting in>)"
>
> --
> Steve Lord
> sl...@mathworks.com

SOLVED THE MYSTERY !

Rather than providing more on this ... let me tell you guys, when this
happens ! IT happens when MATLAB stops the execution of my code and
goes to some wierd state. I am not able to call or use many functions
examples of which include vpa, subs, tic ... toc etc.

It gives me a wrong error ! It says my code is erroneous but I would
not agree with that cause in a different machine with different
version, the script runs fine !

http://groups.google.com/group/comp.soft-sys.matlab/browse_thread/thread/4ac1bcb548e064e1/3124207eb0564fcb#3124207eb0564fcb

That new post is the new problem I am facing related to this !

Thanks to all !
Super Thanks !
P

Tags for this Thread

Everyone's Tags:

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.

Tag Activity for This Thread
Tag Applied By Date/Time
symbolic toolbox us 07 Aug, 2007 18:52:40
vpa us 07 Aug, 2007 18:52:40
code us 07 Aug, 2007 18:52:40
maple us 07 Aug, 2007 18:52:40
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics