Ask Your Question

nablaoperator's profile - activity

2021-03-25 11:39:12 +0200 received badge  Good Question (source)
2020-12-20 14:16:52 +0200 received badge  Famous Question (source)
2019-05-22 11:08:13 +0200 received badge  Notable Question (source)
2016-05-22 21:39:40 +0200 received badge  Popular Question (source)
2015-01-14 10:21:52 +0200 received badge  Notable Question (source)
2014-06-13 08:46:07 +0200 received badge  Famous Question (source)
2013-09-13 12:57:02 +0200 received badge  Popular Question (source)
2013-07-22 16:30:17 +0200 received badge  Notable Question (source)
2012-12-20 17:10:01 +0200 received badge  Taxonomist
2012-11-24 15:04:53 +0200 received badge  Popular Question (source)
2012-06-25 10:51:10 +0200 received badge  Nice Question (source)
2012-06-25 10:29:45 +0200 commented answer autodeclare variables

Awesome, thanks!!

2012-06-25 10:29:38 +0200 received badge  Scholar (source)
2012-06-25 10:29:38 +0200 marked best answer autodeclare variables

You can use symbolic_expression, which will automatically detect variables. For example,

sage: symbolic_expression('3 * y')
3*y

If you need the variables in the global namespace, you can use

map(var, symbolic_expression('3 * y').variables())
2012-06-25 09:32:23 +0200 answered a question How to install sage5 in OpenSuSE 11.4

Awesome, thank you!

2012-05-24 10:02:24 +0200 asked a question How to install sage5 in OpenSuSE 11.4

Are there any packages?

2011-10-10 12:54:21 +0200 commented answer autodeclare variables

That's nice! Thank you!

2011-10-10 10:18:05 +0200 received badge  Student (source)
2011-10-10 08:02:21 +0200 commented answer collect multiple variables and simplify their coefficients

Okay, thank you! It seems I have to do it manually then.

2011-10-10 07:15:04 +0200 commented answer autodeclare variables

Unfortunately this doesn't work in the command line interface or in a standalone python program. Is there a similar command?

2011-10-10 06:08:55 +0200 received badge  Supporter (source)
2011-10-09 16:50:44 +0200 asked a question collect multiple variables and simplify their coefficients

Hi there!

In Mathematica you can do the following: Collect[expr, {var1, var2, var3}, Simplify]

This transforms

expr = var1expr11 + var2expr22 + var1var2expr12 + ...

to

var1Simplify[expr11] + var2Simplify[expr22] + var1var2Simplify[expr12] + ...

I was wondering if there is an easy way to do this in Sage.

So my questions are:

1) How can you collect multiple variables?

2) How can you manipulate their coefficients? (each coefficient is independent)

3*) How can you print the result in a pretty way? (e.g. collecting the expression by coefficients and printing each term in a new line)

Thanks for your help!

2011-10-09 15:30:30 +0200 commented answer autodeclare variables

Ah you're right. That's strange, a simple expression worked, but sin(x) not. I'll check it out. Thank you very much for your help!

2011-10-09 14:39:55 +0200 commented answer autodeclare variables

I'm afraid Maxima cannot handle my expression. I tried your workaround, but it fails on my expression (it has for example sin(x). Anyhow want to make it as general as possible).

2011-10-09 13:42:33 +0200 answered a question autodeclare variables

Thank you for your answer.

I import it from the rather unknown program "FORM" from Jos Vermaseren (I think it is only popular among theoretical particle physicists).

I'm not sure if FORM can export its declarations.

2011-10-09 13:02:41 +0200 asked a question autodeclare variables

Hello Everyone!

Is there a way to autodeclare variables?

For example:

I want to import an expression from another computer program. Now this expression is stored as a string, that means I have to evaluate it in sage.

sage_eval(expression)

It works fine, but if the expression contains variables, these have to be manually declared first as var('variables').

I want to do this automatically, e.g.: sage_eval(expression, autodeclarevariables=on)

Is there a way to do something like that?