The most important is how get diagnostic information about why the
solve call failed (returned None). The system of equations I am
solving for are pretty simple, I am problem just miss using the
interface. However with the only output of the system being returning
None, I have no way to figure out my mistake.
So here is an example I am trying:
from sympy import Symbol, solve
C = Symbol('C', constant=True, real=True)
R = Symbol('R', constant=True, real=True)
Rf = Symbol('Rf', constant=True, real=True)
Ri = Symbol('Ri', constant=True, real=True)
s = Symbol('s')
V1 = Symbol('V1')
Vminus = Symbol('Vminus')
Vplus = Symbol('Vplus')
Vout = Symbol('Vout')
eqs = [C*V1*s + Vplus*(-2*C*s - 1/R), Vminus*(-1/Ri - 1/Rf) + Vout/Rf,
C*Vplus*s + V1*(-C*s - 1/R) + Vout/R, -Vminus + Vplus]
print solve(eqs, Vout)
What I want to see is:
Vout = Vplus*(s**2*C**2 + 3*s*C/R + 1/R^2)/(s*C/R)
When I worked it by hand there was another solution
Vout = Vminus*(1/Ri + 1/Rf)*Rf
so that is likely the problem. However is there any way for sympy to
give me both solutions? Or at least indicate that was the problem?
Thanks.
The assumption 'constant=True' doesn't have a meaning to sympy. Also,
since you are not solving this with any values (everything is
symbolic) you don't have to put assumptions about the answer being
real on your symbols. Just create your variables...
>>> var('R, C, Ri, Vout, V1, Rf, Vminus, Vplus, s')
(R, C, Ri, Vout, V1, Rf, Vminus, Vplus, s)
define your equations...
>>> eqs = [C*V1*s + Vplus*(-2*C*s - 1/R),
... Vminus*(-1/Ri - 1/Rf) + Vout/Rf,
... C*Vplus*s + V1*(-C*s - 1/R) + Vout/R,
... -Vminus + Vplus]
...
>>>
Now, if you just want *some* solution, don't list any variables:
>>> solve(eqs)
[{Vminus: Vplus, Vout: (V1**2 - V1*Vplus - Vplus**2)/(V1 - 2*Vplus), R: Vplus/(C
*s*(V1 - 2*Vplus)), Ri: Rf*Vplus*(V1 - 2*Vplus)/(V1 - Vplus)**2}]
If you want to solve some equation for a single variable, use 'manual'
>>> solve(eqs, Vout, manual=True)
[(Vminus*(Rf + Ri)/Ri,)]
> What I want to see is:
> Vout = Vplus*(s**2*C**2 + 3*s*C/R + 1/R^2)/(s*C/R)
>
Ahh... then that means you want the solution (lhs) to *not* contain
those values. So what *do* you want to allow on the lhs?
Here are all the variables in the equations...
>>> vall=reduce(set.union, [e.free_symbols for e in eqs])
>>> vall
set([R, C, Ri, Vout, V1, Rf, Vminus, Vplus, s])
You *don't* want the variables in the rhs of what you just indicated
to be on the lhs of the answers...
>>> dont = (Vplus*(s**2*C**2 + 3*s*C/R + 1/R**2)/(s*C/R)).free_symbols
>>> dont
set([R, Vplus, s, C])
So what you will accept on the lhs is anything else...
>>> want = vall - dont
>>> want
set([Vminus, Vout, V1, Rf, Ri])
So try that:
>>> solve(eqs,want)
[{Vminus: Vplus, Vout: Vplus*(C**2*R**2*s**2 + 3*C*R*s + 1)/(C*R*s), V1: Vplus*(
2*C*R*s + 1)/(C*R*s), Rf: 0}, {Vminus: Vplus, Vout: Vplus*(C**2*R**2*s**2 + 3*C*
R*s + 1)/(C*R*s), V1: Vplus*(2*C*R*s + 1)/(C*R*s), Rf: Ri*(C*R*s + 1)**2/(C*R*s)
}]
And there you go:
>>> for k, v in _[0].items():
... print k,
... print '\t',v
...
Vminus Vplus
Vout Vplus*(C**2*R**2*s**2 + 3*C*R*s + 1)/(C*R*s)
V1 Vplus*(2*C*R*s + 1)/(C*R*s)
Rf 0
> When I worked it by hand there was another solution
> Vout = Vminus*(1/Ri + 1/Rf)*Rf
> so that is likely the problem. However is there any way for sympy to
> give me both solutions? Or at least indicate that was the problem?
You have to give it direction...what do you want your solution in
terms of. We might have gotten this other solution by saying we don't
want any of those rhs variables (this is going to get ugly, but bear
through til the end):
Like before, define what you don't want solved for:
>>> dont=(Vminus*(1/Ri + 1/Rf)*Rf).free_symbols
>>> want = vall - dont
>>> solve(eqs,want)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...more error messages
raise CoercionFailed("can't convert %s of type %s to %s" % (a, K0, K1))
sympy.polys.polyerrors.CoercionFailed: can't convert DMF(([[[[[[PythonRationalTy
pe(-1, 1)], []]], [[[PythonRationalType(2, 1)], []], [[PythonRationalType(-1, 1)
, PythonRationalType(0, 1)]]]]]], [[[[[[PythonRationalType(2, 1)]]]]]]), QQ) of
type QQ(s,C,Rf,Ri,Vminus,sqrt(Rf**2*Vminus**2 - 4*Rf*Ri*Vminus**2)) to QQ[s,C,Rf
,Ri,Vminus,sqrt(Rf**2*Vminus**2 - 4*Rf*Ri*Vminus**2)]
So go ahead and use the manual option:
>>> solve(eqs,want,manual=True)
[{Vplus: Vminus, Vout: Vminus*(Rf + Ri)/Ri, V1: (Rf*Vminus + 2*Ri*Vminus - sqrt(
Rf**2*Vminus**2 - 4*Rf*Ri*Vminus**2))/(2*Ri), C: Vminus/(-2*R*Vminus*s + R*s*(Rf
*Vminus + 2*Ri*Vminus - sqrt(Rf**2*Vminus**2 - 4*Rf*Ri*Vminus**2))/(2*Ri))}, {Vp
lus: Vminus, Vout: Vminus*(Rf + Ri)/Ri, V1: (Rf*Vminus + 2*Ri*Vminus + sqrt(Rf**
2*Vminus**2 - 4*Rf*Ri*Vminus**2))/(2*Ri), C: Vminus/(-2*R*Vminus*s + R*s*(Rf*Vmi
nus + 2*Ri*Vminus + sqrt(Rf**2*Vminus**2 - 4*Rf*Ri*Vminus**2))/(2*Ri))}]
And again, there you go:
>>> _[0][Vout]
Vminus*(Rf + Ri)/Ri
Write if you have more questions. I'm not sure why the None is
returned in this case, buthopefully you have a better idea to get what
you want and what you 'dont',
Chris
def test_exclude():
R, C, Ri, Vout, V1, Rf, Vminus, Vplus, s = symbols('R, C, Ri,
Vout, V1, Rf, Vminus, Vplus, s')
eqs = [C*V1*s + Vplus*(-2*C*s - 1/R),
Vminus*(-1/Ri - 1/Rf) + Vout/Rf,
C*Vplus*s + V1*(-C*s - 1/R) + Vout/R,
-Vminus + Vplus]
assert solve(eqs, exclude=s*C*R) == [
{Vminus: Vplus,
Vout: Vplus*(C**2*R**2*s**2 + 3*C*R*s + 1)/(C*R*s),
V1: Vplus*(2*C*R*s + 1)/(C*R*s),
Ri: C*R*Rf*s/(C*R*s + 1)**2}]
assert solve(eqs, exclude=[Vplus, s, C]) == [
{Vminus: Vplus,
Vout: (V1**2 - V1*Vplus - Vplus**2)/(V1 - 2*Vplus),
R: Vplus/(C*s*(V1 - 2*Vplus)),
I have released SymPy packages for Maemo 4 OS (Diablo, used in
Nokia N800/N810 tablets), Maemo 5 OS (Fremantle, used in Nokia N900
smartphone) and MeeGo 1.2 Harmattan OS (used by Nokia N9 smartphone
available since 1-2 months ago), all of them are full (not only kernel)
Linux mobile OS :
http://talk.maemo.org/showpost.php?p=1119313
http://forum.meego.com/showthread.php?t=4870
SymPy for Maemo 5 OS has almost 100 k downloads since July 2010 :
http://maemo.dadablog.net/AppStats.php?package=python-sympy&os=fremantl
<http://maemo.dadablog.net/AppStats.php?package=python-sympy&os=fremantl>SymPy
interactive shell (icon launching isympy) has 15 k downloads by Maemo 5
user in 2 months :
http://maemo.dadablog.net/AppStats.php?package=python-sympy-ui&os=fremantle
<http://maemo.dadablog.net/AppStats.php?package=python-sympy-ui&os=fremantle>
IPython on Maemo 4/5 and MeeGo 1.2 Harmattan is also available so
interactive use of SymPy is easier. Last week I have released IPython
0.10.2 for MeeGo 1.2 Harmattan :
http://talk.maemo.org/showthread.php?p=1123672
The "Terminal" on Nokia N9 is excellent with virtual keyboard including
tab, ctrl, arrow keys, full characters to develop, etc.
Other scientific Python packages are also available : NumPy (Maemo
5, MeeGo Harmattan), SciPy (Maemo 5), MatPlotLib (Maemo 5), etc.
Nokia N9 (with MeeGo 1.2 Harmattan) is selling and well reviewed
all over Internet. Nokia N9 has, in my opinion, the best Python
implementation of current smartphones/tablets, with many Python modules
available :
http://wiki.meego.com/Harmattan_Python
So, if somebody needs a good touch smartphone with excellent Python
support, I recommend Nokia N9 which I am using since 17/11/2011 (I am
also a long time user of Nokia N900 and N810).
I hope to continue to maintain and port Python packages to Maemo 4,
5 and MeeGo Harmattan, with priority for SymPy.
This is pretty much exactly the kind of information I was looking
for. I figured those kinds of features existed, I was just unable to
locate them with the documentation. Is there a documentation page
that expands on what you are talking about, so in the future I know
where to start?
Keith
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
Yeah, Stefan is right, that page should be trasfered to the Github
wiki (it's also very, very outdated; it might as well be rewritten
from scratch). So, if you'd be willing to do it, then go right ahead,
if not, I won't forget to add in your packages once I get around to
doing it.
>
> I suppose that the core developers wont mind even if you add those packages
> yourself to the github wiki (after making them aware of that). If that
> particular page is not already transfered you can transfer it and add the
> packages to the list.
>
> On 20 November 2011 12:40, Roberto Colistete Jr.
> <roberto....@gmail.com> wrote:
>>
>> What about citing SymPy installation for tablets/smartphones in
>> http://code.google.com/p/sympy/wiki/DownloadInstallation?tm=2
>> http://code.google.com/p/sympy/wiki/DownloadInstallation
>> ?
>>
>> I have released SymPy packages for Maemo 4 OS (Diablo, used in Nokia
>> N800/N810 tablets), Maemo 5 OS (Fremantle, used in Nokia N900 smartphone)
>> and MeeGo 1.2 Harmattan OS (used by Nokia N9 smartphone available since 1-2
>> months ago), all of them are full (not only kernel) Linux mobile OS :
>> http://talk.maemo.org/showpost.php?p=1119313
>> http://forum.meego.com/showthread.php?t=4870
>> SymPy for Maemo 5 OS has almost 100 k downloads since July 2010 :
>> http://maemo.dadablog.net/AppStats.php?package=python-sympy&os=fremantl
That's a huge number of downloads! I guess people really like
experimenting with their phones (or I am/we are seriously
underestimating the number of users SymPy has).
>>
>> <http://maemo.dadablog.net/AppStats.php?package=python-sympy&os=fremantl>SymPy
>> interactive shell (icon launching isympy) has 15 k downloads by Maemo 5 user
>> in 2 months :
>>
>> http://maemo.dadablog.net/AppStats.php?package=python-sympy-ui&os=fremantle
>>
>> <http://maemo.dadablog.net/AppStats.php?package=python-sympy-ui&os=fremantle>
>> IPython on Maemo 4/5 and MeeGo 1.2 Harmattan is also available so
>> interactive use of SymPy is easier. Last week I have released IPython 0.10.2
>> for MeeGo 1.2 Harmattan :
>> http://talk.maemo.org/showthread.php?p=1123672
>> The "Terminal" on Nokia N9 is excellent with virtual keyboard including
>> tab, ctrl, arrow keys, full characters to develop, etc.
>>
>> Other scientific Python packages are also available : NumPy (Maemo 5,
>> MeeGo Harmattan), SciPy (Maemo 5), MatPlotLib (Maemo 5), etc.
>>
>> Nokia N9 (with MeeGo 1.2 Harmattan) is selling and well reviewed all
>> over Internet. Nokia N9 has, in my opinion, the best Python implementation
>> of current smartphones/tablets, with many Python modules available :
>> http://wiki.meego.com/Harmattan_Python
>>
>> So, if somebody needs a good touch smartphone with excellent Python
>> support, I recommend Nokia N9 which I am using since 17/11/2011 (I am also a
>> long time user of Nokia N900 and N810).
>>
>> I hope to continue to maintain and port Python packages to Maemo 4, 5
>> and MeeGo Harmattan, with priority for SymPy.
Yes, thanks for doing this! I was actually aware of these packages,
but you're right, they aren't mentioned anywhere in our pages. If
there's anything you need from us to make your job easier, feel free
to drop us a line.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to sy...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sympy+un...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
--
Vladimir Perić
SymPy 0.6.6 was maintained by Tom Tanner, released in January 2010.
My contribution to Maemo/MeeGo started in September with SymPy 0.7.1.
The SymPy 0.7.1 Interactive Shell package (with an icon and visible
in Application Manager) gave a lot more visibility to SymPy on Maemo 5.
> About mentioning the packages - it seems that there is an ongoing (and
> slow) transfer of wiki pages from google code to the github wiki.
>
> I suppose that the core developers wont mind even if you add those
> packages yourself to the github wiki (after making them aware of
> that). If that particular page is not already transfered you can
> transfer it and add the packages to the list.
Thanks.
Aaron Meurer
>> sympy+un...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+un...@googlegroups.com.
I have recently released PyGlet and a new SymPy package version for
Maemo 5 OS (Nokia N900 smartphone), so SymPy 'Plot()' can now work on a
smartphone, including interactive manipulation of OpenGL plots.
http://talk.maemo.org/showthread.php?t=78568
I have also made a "SymPy for smartphones & tablets" web site :
http://www.robertocolistete.net/Python/SymPy/
comparing SymPy on 7 mobile OS : Android, iOS, Maemo 4 (Diablo), Maemo 5
(Fremantle), MeeGo 1.2 Harmattan and Symbian.
If you think it is interesting, the above site can be linked from
some SymPy wiki page.
Best regards,
Roberto
The maemo stuff can be quite useful for me. Thanks.
I do not think that anybody among the developers will be against if
you add those (as a link or even better as a wiki page) to the wiki
(it's publicly editable on github).
On 5 February 2012 02:58, Roberto Colistete Jr.
Hi Stefan,
I am also waiting for your 'Plotting framework'
(https://github.com/sympy/sympy/pull/673) using MatPlotLib to become
available to SymPy git master, so I will package SymPy for Maemo 5 and
MeeGo Harmattan (both have MatPlotLib) with this new plotting capability.
> I do not think that anybody among the developers will be against if
> you add those (as a link or even better as a wiki page) to the wiki
> (it's publicly editable on github).
Ok, I will wait a little bit more, if no objections, I will try to
place a link in github wiki.
Regards,
Roberto
I guess http://docs.sympy.org/dev/outreach.html#projects-using-sympy
is a good place for it too.
Aaron Meurer
This is Smit Mehta here, an aspiring participant for GSoC 2012. I just
wanted to ask that whats the final opinion of all? Are we still
serious about the project for creating a GUI for SymPy for Android
phones using Python SL4A scripting platform? If yes, I am really
interested in it. I already have good enough experience with Python
and PyQt4 (reference [1]) and am sure that I can learn extra tools to
do this project. Can someone please guide me in this context?
[1] https://github.com/smit-mehta/acadmin.
--
Smit Mehta
II year, B.Tech
Computer Science and Engineering
IIT Madras
+91-9884996531
Aaron Meurer
Since now, Roberto is willing to mentor this project, can I start
working on it and gather all the technical pre-requisites that i will
need for this project?
By the way, for this project, I think we will need to require that you
demonstrate your ability to program in whatever language Android uses
(is it Java or C?), in addition to your normal patch requirement to
Python. We don't really have any projects with that at the moment.
Do you have any prior work in this area? Or maybe you could start
some skeleton code for the project and push that up to a GitHub repo.
Aaron Meurer
I am now candidate to mentorship with subject : SymPy GUI for
Android using Python SL4A.
So, for Android, it is indeed possible to only use
Python+HTML+JavaScript+CSS to create softwares with user interface. And
C/Java would not be a requirement for any student work if related to my
mentorship subject.
Regards, Roberto
>>>>>> I have also made a "SymPy for smartphones& tablets" web site :
| Assunto: | SymPy for Maemo 4 & 5 and MeeGo 1.2 Harmattan |
|---|---|
| Data: | Sun, 20 Nov 2011 09:40:59 -0200 |
| De: | Roberto Colistete Jr. <roberto....@gmail.com> |
| Para: | sy...@googlegroups.com |
Cool. Does mathjax printing work in the notebook (i.e., %load_ext sympy.interactive.ipythonprinting)?
| Assunto: | SymPy 0.7.2 for Maemo 4 & 5 and MeeGo 1.2 Harmattan |
|---|---|
| Data: | Mon, 21 Jan 2013 14:30:45 -0200 |
| De: | Roberto Colistete Jr. <Roberto....@gmail.com> |
| Para: | sy...@googlegroups.com |
| Assunto: | SymPy 0.7.2 for Maemo 4 & 5 and MeeGo 1.2 Harmattan |
|---|---|
| Data: | Mon, 21 Jan 2013 14:30:45 -0200 |
| De: | Roberto Colistete Jr. <Roberto....@gmail.com> |
| Para: | sy...@googlegroups.com |
Hi,
SymPy 0.7.3 was released in August 5th 2013 for Maemo 4 OS (Nokia N800/N810 tablets), Maemo 5 OS (Nokia N900 smartphone) and MeeGo 1.2 Harmattan OS (Nokia N9 smartphone), see the Maemo.org Talk topic :
http://talk.maemo.org/showthread.php?t=78568
It is available in Maemo 4 & 5 repositories, and in my personal MeeGo Harmattan repository.
As Maemo 4 & 5 are limited to Python 2.5 and SymPy 0.7.3 is the last version for Python 2.5, this is the last version of SymPy for Maemo 4 (which dates from 2007). Maemo 5 has a community release of Python 2.7, so maybe new SymPy versions will work.
On Maemo 5 there is PyGlet and MatPlotLib (1.0.0), so SymPy 0.7.3 "Plot()" and mpmath plotting work. On MeeGo Harmattan the new plotting module and mpmath plotting work with MatPlotLib 1.2.1.
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.
As Maemo 4 & 5 are limited to Python 2.5 and SymPy 0.7.3 is the last version for Python 2.5, this is the last version of SymPy for Maemo 4 (which dates from 2007). Maemo 5 has a community release of Python 2.7, so maybe new SymPy versions will work.
Sorry to hear that, but it was time to move forward. Dropping 2.5 support has made a lot of things a lot easier, like supporting Python 3 in a single code-base.
On Maemo 5 there is PyGlet and MatPlotLib (1.0.0), so SymPy 0.7.3 "Plot()" and mpmath plotting work. On MeeGo Harmattan the new plotting module and mpmath plotting work with MatPlotLib 1.2.1.
That's good that you are using the new plotting module. That matplotlib version is a little old, so hopefully there won't be any issues there. I seem to recall that some old version had some bug that prevented something from working (was it 3d plotting?).
The next thing I guess is to get IPython 1.0.0 supported (or is it already?).