Ask Your Question

mouse's profile - activity

2017-06-10 08:03:14 +0200 received badge  Famous Question (source)
2015-11-28 22:26:36 +0200 received badge  Notable Question (source)
2015-08-19 12:33:54 +0200 received badge  Famous Question (source)
2014-09-22 14:56:34 +0200 received badge  Famous Question (source)
2014-05-26 12:47:25 +0200 received badge  Popular Question (source)
2013-12-05 06:53:59 +0200 received badge  Taxonomist
2013-05-26 14:42:10 +0200 received badge  Student (source)
2012-12-01 22:26:13 +0200 received badge  Notable Question (source)
2012-09-06 13:21:39 +0200 received badge  Notable Question (source)
2011-12-23 00:07:54 +0200 received badge  Popular Question (source)
2011-12-08 14:14:02 +0200 received badge  Popular Question (source)
2011-02-20 09:32:59 +0200 received badge  Nice Answer (source)
2011-01-19 19:01:36 +0200 asked a question Problem with supercripts

I've read that variables can be subscripted with underscore "_" and superscripted with caret "^". However supescripting doesn't seem to work. I think the caret is seen as a power operator. How to work around this?

Subscript example that works:

var('x,y,z_a')
eqn = x == y*z_a
solve(eqn, z_a)

Superscript example that fails:

var('x,y,z^a')
eqn = x == y*z^a
solve(eqn, z^a)
2011-01-19 18:16:24 +0200 received badge  Editor (source)
2011-01-19 18:14:23 +0200 received badge  Supporter (source)
2011-01-17 23:19:32 +0200 commented answer Failure on symbolic solve

Hey Thanks. Other work is pounding on me today but I'll find some time to digest the answer. Appreciate the time you put into this. regards.

2011-01-17 17:34:10 +0200 asked a question Failure on symbolic solve

Trying to learn manipulation of symbolic expressions. However when I try this one I get a traceback. Is this a bug, limitation, or user error?

x,y,z = var('x y z')
assume(x>0)
assume(y>0)
assume(z>0)
eqn = (x == y**z)
solve(eqn, y)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_68.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("eCx5LHogPSB2YXIoJ3ggeSB6JykKYXNzdW1lKHg+MCkKYXNzdW1lKHk+MCkKYXNzdW1lKHo+MCkKZXFuID0gKHggPT0geSoqeikKc29sdmUoZXFuLCB5KQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>

  File "/tmp/tmpgB4hFo/___code___.py", line 8, in <module>
    exec compile(u'solve(eqn, y)
  File "", line 1, in <module>

  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/symbolic/relation.py", line 619, in solve
    ans = f.solve(*args,**kwds)
  File "expression.pyx", line 7518, in sage.symbolic.expression.Expression.solve (sage/symbolic/expression.cpp:27206)
  File "expression.pyx", line 7511, in sage.symbolic.expression.Expression.solve (sage/symbolic/expression.cpp:27084)
  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1474, in __call__
    return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)
  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1373, in function_call
    return self.new(s)
  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1154, in new
    return self(code)
  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1090, in __call__
    return cls(self, x, name=name)
  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.py", line 1517, in __init__
    raise TypeError, x
TypeError: Computation failed since Maxima requested additional constraints (try the command 'assume(>0)' before integral or limit evaluation, for example):
Is z an integer?
2011-01-17 05:41:45 +0200 received badge  Self-Learner (source)
2011-01-17 05:41:45 +0200 received badge  Teacher (source)
2011-01-17 05:34:05 +0200 answered a question How to rearrange terms in an expression

OK, after more googling I found a link to manipulating symbolic expressions which seems to cover what I want. Here'tis for any others that may be interested.

http://www.sagemath.org/doc/reference...

Good point Evgeny! So here's a simple example

var('x,y,z')

assume(z, 'integer')

eqn = x == y**z

solve(eqn, y)

Note: this will fail without the assume statement (see this response from kcrisman http://ask.sagemath.org/question/318/... ).

2011-01-17 00:29:42 +0200 commented answer How to use R with Sage?

So today I learned that R, which I use occasionally, is included in Sage and how to use it in the notebook. Great. Much appreciated.

2011-01-16 22:35:34 +0200 asked a question How to rearrange terms in an expression

I'm totally new to Sage. I was hoping I could use it for simple and complex application problems I run into at work. For example the relationship between flow rate, Q, and pressure drop, dP, for flow of a powerlaw fluid (m, n) in a cylindrical tube (L, R) is:

Q = (pi*R^3/((1/n)+3))*(Tau/m)^(1/n)

So I want to rearrange this expression for dP in terms of Q, m, n, L, R so I can then compute a table of results, plot dP versus Q etc. Now of course I can do the rearrangement by hand with pen and paper (or in my head on better days) but I was hoping that using the Sage notebook I could work through the rearrangement and thus have an digital record of the transformation so that others can follow along. However in all the hours of reading and watching tutorials, I have yet to see this simple process in action.

So far in my sage book I have:

Q, L, R, m, n, dP = var("Q, L, R, m, n, dP")
Tau = dP/(2*L/R)
Q = (pi*R**3/((1/n)+3))*(Tau/m)**(1/n)

(Note that the preview doesn't show the power symbol **, hope it appears in the posted question)

Is there a method, say, Q.rearrange(dP) that yields dP = f(Q, L, R, m, n)? If not, how do I write the intermediate steps in sage speak to give this expression?

Sorry if this is such a basic question.