ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 28 Jul 2018 03:24:51 +0200implicitly defining a sequence of variableshttps://ask.sagemath.org/question/8181/implicitly-defining-a-sequence-of-variables/To define a general polynomial in Maple one writes
p := sum(a[i]*x^i,i=0..n);
and gets $p = \sum _{i=0}^{n}a_{{i}}{x}^{i}$.
So the "a[i]" are implicitly understood as variables, and their number (n) is also a variable. Or perhaps "a" is implicitly understood as a sequence of variables? I don't know what happens behind the scenes here, but it is very usefull.
Trying to accomplish this in sage I reached
sage: var('x,i,n')
(x, i, n)
sage: a = function('a')
sage: p = sum(a(i)*x^i,i,0,n);p
sum(x^i*a(i), i, 0, n)
Is this the right way? It doesn't behave as nice as in maple. Trying series, taylor, and diff only taylor works correctly:
sage: p.series(x==0,3)
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
....
RuntimeError: power::eval(): division by zero
sage: p.taylor(x,0,3)
x^3*a(3) + x^2*a(2) + x*a(1) + a(0)
sage: p.diff(x)
i*x^(i - 1)*a(i)*D[0](sum)(x^i*a(i), i, 0, n)
In Maple they all give good results.
Am I going at this the right way? Is there a way to implicitly define variables as in Maple?
parzanWed, 22 Jun 2011 06:48:29 +0200https://ask.sagemath.org/question/8181/Accessing Maple from Sage osx (.dmg version)https://ask.sagemath.org/question/43183/accessing-maple-from-sage-osx-dmg-version/What is the "right" way to set up Sage to access Maple from a Jupyter notebook on MacOSX from the .dmg version? For the command line version, I've set my path variables correctly and Maple easily runs from Sage. However, when I open the GUI version of sage, Maple isn't on the path and I'm not sure how to add it (even temporarily).
Following up to the answer below, my issue might not be that the PATH is in error. I've set the path correctly (or so I believe), but Maple still isn't accessible from the GUI version of Maple.Michael BurrSat, 28 Jul 2018 03:24:51 +0200https://ask.sagemath.org/question/43183/How to run maple in cocal?https://ask.sagemath.org/question/38985/how-to-run-maple-in-cocal/Is it possible? I get an error, when i try! thethaWed, 27 Sep 2017 23:20:21 +0200https://ask.sagemath.org/question/38985/maple program to find adomian polynomialshttps://ask.sagemath.org/question/26097/maple-program-to-find-adomian-polynomials/ can someone please help me compute a program using maple for the Adomian poly's algorithm found in this paper
http://www.researchgate.net/profile/Jafar_Biazar/publication/254397857_A_Simple_Algorithm_for_Calculating_Adomian_Polynomials/links/53d162e90cf228d363e5bf0c.pdf.
thank you!
manara12Mon, 09 Mar 2015 17:50:29 +0100https://ask.sagemath.org/question/26097/Manipulations with symbolic functionshttps://ask.sagemath.org/question/24114/manipulations-with-symbolic-functions/Hello! I'm trying to migrate to Sage from Maple and facing some difficulties with symbolic manipulations, which is the most important part of my work. For example, I want to define the following equality:
N(t + delta * t, A) = ( N(t, A + sigma * sqrt(delta * t)) * (1 - p(t, A))
+ N(t, A - sigma * sqrt(delta * t)) * p(t, A) )
where the function N(t,A) is yet unknown, and I can't find a way to to do correctly. After that I want to manipulate this equality, for example by substituting Taylor series of N instead of it. In Maple this whole thing is very straightforward, but I really can't find a way to do the same in Sage. Any help will be much appreciated.
StanislavSun, 14 Sep 2014 16:03:39 +0200https://ask.sagemath.org/question/24114/Best way to convert Maple to sagehttps://ask.sagemath.org/question/7605/best-way-to-convert-maple-to-sage/I want to convert this Maple to sage:
[http://www.maplesoft.com/applications/view.aspx?SID=3851&view=html][1]
What sage functions/packages should I be using? I'm new to sage so any help is greatly appreciated.
Thanks,
=miles=
[1]: http://www.maplesoft.com/applications/view.aspx?SID=3851&view=htmlTeamTeamUSASat, 21 Aug 2010 06:07:25 +0200https://ask.sagemath.org/question/7605/why sage help not give out a function'name Directory by subjects?https://ask.sagemath.org/question/10820/why-sage-help-not-give-out-a-functionname-directory-by-subjects/index is too big,not differentiate between by different subjects
like magma/maple/mathematica,all numberfield'function name get together, all group'function name get together, all autoform'function name get together,every function link to DocumentationcjshWed, 11 Dec 2013 02:59:59 +0100https://ask.sagemath.org/question/10820/why sage help not give out a function'name Directory by subjects?https://ask.sagemath.org/question/10814/why-sage-help-not-give-out-a-functionname-directory-by-subjects/index is too big,not differentiate between by different subjects
like magma/maple/mathematica,all numberfield'function name get together, all group'function name get together, all autoform'function name get together,every function link to DocumentationcjshWed, 11 Dec 2013 03:00:02 +0100https://ask.sagemath.org/question/10814/calling maplehttps://ask.sagemath.org/question/10032/calling-maple/I am trying to get maple to work inside sage. I have maple installed and in .bashrc I made an alias to run ./maple from where it is installed when I type 'maple' in terminal, and it works fine:
> ~$ maple
> |\^/| Maple 16 (X86 64 LINUX)
>._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2012
> \ MAPLE / All rights reserved. Maple is a trademark of
> <____ ____> Waterloo Maple Inc.
> | Type ? for help.
>>
But when I run a maple command inside sage, for example
> sage: maple('2+2')
it returns a TypeError and tells me that I should install maple.
I read the documentation [here](http://www.sagemath.org/doc/reference/interfaces/sage/interfaces/maple.html) and it says I should have a script called maple and put it in PATH in order to be able to run maple in sage. What I don't understand is where is the PATH. I tried the sage_root (sage installation folder), and home folder. None seem to be working.
Has anyone got this to work, and how?k1Tue, 16 Apr 2013 17:56:31 +0200https://ask.sagemath.org/question/10032/Maple versus Sage, porting issueshttps://ask.sagemath.org/question/9210/maple-versus-sage-porting-issues/Consider the expression
if (m == 3) or (m == -3) : print n, m
Could a simple minded programmer ever expect to see an output
different from n, 3 or n, -3 for some n?
No, because it is /verboten/ by logic that m can have a
different value from 3 or -3!
Let's check it nevertheless with Maple:
for n from 0 to 50 do
m := n mod 8:
if (m = 3) or (m = -3) then print(n, m) fi od:
3, 3
11, 3
19, 3
27, 3
35, 3
43, 3
And now the same with Sage.
for n in (0..50):
m = mod(n, 8)
if (m == 3) or (m == -3) : print n, m
3 3
5 5
11 3
13 5
19 3
21 5
27 3
29 5
35 3
37 5
43 3
45 5
How many simple minded Maple programmers have broken their necks with such alike?
Could someone please point to a page in the Sage documentation where this is explained and due warnings are given, if such a page exists?
petropolisSun, 05 Aug 2012 07:30:48 +0200https://ask.sagemath.org/question/9210/maple interface RuntimeErrorhttps://ask.sagemath.org/question/8480/maple-interface-runtimeerror/I have ubuntu linux with sage and maple13 for linux instaled.
maple.console, maple.interact and %maple work but not maple(...) (maple.<tab> OK):
sage: maple('2+2')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (17, 0))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/home/joao/<ipython console> in <module>()
/usr/local/share/sage/local/lib/python2.6/site-packages/IPython/Prompts.pyc in __call__(self, arg)
550
551 # and now call a possibly user-defined print mechanism
--> 552 manipulated_val = self.display(arg)
553
554 # user display hooks can change the variable to be stored in
/usr/local/share/sage/local/lib/python2.6/site-packages/IPython/Prompts.pyc in _display(self, arg)
576 return IPython.generics.result_display(arg)
577 except TryNext:
--> 578 return self.shell.hooks.result_display(arg)
579
580 # Assign the default display method:
/usr/local/share/sage/local/lib/python2.6/site-packages/IPython/hooks.pyc in __call__(self, *args, **kw)
139 #print "prio",prio,"cmd",cmd #dbg
140 try:
--> 141 ret = cmd(*args, **kw)
142 return ret
143 except ipapi.TryNext, exc:
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/misc/displayhook.pyc in result_display(ip_self, obj)
148 # IPython's default result_display() uses the IPython.genutils.Term.cout stream.
149 # See also local/lib/python2.6/site-packages/IPython/hooks.py.
--> 150 print_obj(IPython.genutils.Term.cout, obj)
151
152 def displayhook(obj):
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/misc/displayhook.pyc in print_obj(out_stream, obj)
140 if _check_tall_list_and_print(out_stream, obj):
141 return
--> 142 print >>out_stream, `obj`
143
144 def result_display(ip_self, obj):
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/interfaces/maple.pyc in __repr__(self)
1056 """
1057 self._check_valid()
-> 1058 return self.parent().get(self._name)
1059
1060 def _latex_(self):
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/interfaces/maple.pyc in get(self, var)
609 '2'
610 """
--> 611 s = self.eval('printf("%%q",%s)'%var)
612 return s
613
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in eval(self, code, strip, synchronize, locals, allow_use_file, split_lines, **kwds)
1034 if (split_lines is "nofile" and allow_use_file and
1035 self._eval_using_file_cutoff and len(code) > self._eval_using_file_cutoff):
-> 1036 return self._eval_line_using_file(code)
1037 elif split_lines:
1038 return '\n'.join([self._eval_line(L, allow_use_file=allow_use_file, **kwds)
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc in _eval_line_using_file(self, line)
653 tmp_to_use = self._remote_tmpfile()
654 try:
--> 655 s = self._eval_line(self._read_in_file_command(tmp_to_use), allow_use_file=False)
656 except pexpect.EOF, msg:
657 if self._quit_string() in line:
/usr/local/share/sage/local/lib/python2.6/site-packages/sage/interfaces/maple.pyc in _eval_line(self, line, allow_use_file, wait_for_prompt)
559 e.expect('__sage__;')
560 e.expect(self._prompt)
--> 561 raise RuntimeError, "An error occurred running a Maple command:\nINPUT:\n%s\nOUTPUT:\n%s"%(line, z)
562 return z
563
RuntimeError: An error occurred running a Maple command:
INPUT:
read "/home/joao/.sage//temp/asus/2128//interface//tmp2178";
OUTPUT:
on line 2, unexpected end of input
Error, while reading `/home/joao/.sage//temp/asus/2128//interface//tmp2178`
Can you help me?joaomfrancoWed, 16 Nov 2011 15:11:14 +0100https://ask.sagemath.org/question/8480/Disable syntax highlighting in sws2texhttps://ask.sagemath.org/question/8304/disable-syntax-highlighting-in-sws2tex/Hi
I am using sws2tex to convert sage notebooks to latex.
I am wondering if it is possible to disable syntax highlighting?
The reason I want this is that sometimes I use the Maple and Matlab interfaces directly in the notebook, and the syntax highlighting looks wrong here.
I know I can remove it manually after creating the tex file, but I would like to be able to disable it instead.
Another small question:
Is it possible to disable the "attachfile"?
Of course this is not so important since it requires removing 1 or 2 lines, but it could be nice though...KabiSat, 03 Sep 2011 10:07:46 +0200https://ask.sagemath.org/question/8304/