Re: sympy version?

Doug Stewart <[email protected]> Thu, 27 Jan 2022 15:54:44 -0500
Newsgroups gmane.comp.gnu.octave.general
Message-ID <CAAohRsZeWE3JBDU9LKtVk8d3gmpmtMs41tN2B9yojVOWCR8a=g@mail.gmail.com>
Thanks but:
SymPy must be at least version 1.2; you have version 1.9.

Good, a working version of SymPy is installed.

But I still get the same error.

I attached the file that I am trying to run.


On Thu, Jan 27, 2022 at 3:37 PM Patrick Dupre <[email protected]> wrote:

> I just upgraded to ubuntu 20.04.3
>
> I compiled Octave  GNU Octave, version 7.0.91  3ca33008c4a9
> And installed
>      control *|   3.4.0
>     symbolic *|   2.9.0
> I get errors when running a program that I wrote and it worked before.
> *******************
>
> >> wheelsym1
>
> Symbolic pkg v2.9.0: Traceback (most recent call last):
>   File "<stdin>", line 28, in <module>
> AttributeError: 'pretty_PrintFunction' object has no attribute
> '__globals__'
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "<stdin>", line 12, in octoutput_drv
>   File "<stdin>", line 54, in octoutput
>   File "<stdin>", line 55, in octoutput
> AttributeError: module 'sympy' has no attribute 'compatibility'
> Closing the Python communications link.
>
> error: Python exception: AttributeError: 'pretty_PrintFunction' object has
> no attribute '__globals__'
>     occurred in python_header import block.
>     Try "sympref reset" and repeat your command?
>     (consider filing an issue at https://github.com/cbm755/octsympy/issues
> )
> error: called from
>     pycall_sympy__ at line 191 column 5
>     valid_sym_assumptions at line 38 column 10
>     assumptions at line 82 column 7
>     syms at line 97 column 13
>     wheelsym1 at line 2 column 1
> >>*****************************
>
> Do I need a different sympy version?
> Doug
>
>
> you may have to use sympy 1.4
>
> --
> DAS[image: Certificate for 206392]
>
> ---------- We are transitioning to a web based forum for community help
> discussions at https://octave.discourse.group/c/help
>


-- 
DAS[image: Certificate for 206392]

<https://linuxcounter.net/user/206392.html>


----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help
wheelsym1.m (text/x-objcsrc, 1.1 KB)
##setenv PYTHON python3
syms f1 f2 x y1 y2 s k1 k2 c m1 m2
## m1*s^2*y1 == s*c*y2 -s*c*y1 + k1*y2 -k1*y1
f1 = m1*s^2 * y1 == s*(c*(y2-y1)) + k1*(y2-y1)
f2 = m2*s^2 * y2 == s*(c*(y1-y2)) + k1*(y1-y2) + k2*(x-y2)
[y1a, y2a]=solve(f1,f2,y1,y2)
[n1 d1]=numden(y1a) # this is the bounce of the car body
mm1=sym('500')
mm2=sym('50')
kk2=sym('300000')
kk1=sym('10000')
cc=sym('1000')
d2=vpa(subs(d1,{ m1,m2,k2,k1,c},{ mm1, mm2, kk2,kk1,cc}),20)
d3=simplify(d2)
n2=vpa(subs(n1,{k1,k2,c},{kk1,kk2,cc}),20)
n3=simplify(n2)
f3=n3/d3
f4=factor(f3)
f5=f4/x
[n, d] = numden(f5)
num = double(sym2poly(n,s))
den = double(sym2poly(d,s))
sys=tf(num,den);
step(sys,3)
[n1 d1]=numden(y2a) # this is the bounce of the car wheel
d2=vpa(subs(d1,{ m1,m2,k2,k1,c},{ mm1, mm2, kk2,kk1,cc}),20)
d3=simplify(d2)
n2=vpa(subs(n1,{k1,k2,c,m1},{kk1,kk2,cc,mm1}),20)
n3=simplify(n2)
f3=n3/d3
f4=factor(f3)
f5=f4/x #Remove the x because the step function applies a step to the transfer function
[n, d] = numden(f5)
num = double(sym2poly(n,s))
den = double(sym2poly(d,s))
sys=tf(num,den)
hold on
step(sys,3)
hold off