[sage-support] Solving an ODE and simplifying the result

2019-05-13 Thread Oscar Alberto Castillo Felisola
This post was prepared to be upload to ask.sagemath.org, but I got a 
warning "Spam was detected on your post, sorry for if this is a mistake" 
that forbids me to post the question.

-


I'm interested in solving the differential equation $$3 h' + 3 h^2 = c_1,$$ 
where $c_1$ is a positive real number.

var('t')
var('c1', latex_name=r'c_1')
h = function('h')(t)
eq = -3*h^2 + c1 - 3*diff(h, t)
eq_sol = desolve(eq, h, ivar=t, contrib_ode=True)

The above code works, but it's not solved explicitly for $h$, so

h_sol = solve(eq_sol, h)
h_sol = h_sol[0]
h_sol

This gives something like  $$h\left(t\right) = \frac{\sqrt{3} \sqrt{c_{1}} 
{\left(e^{\left(\frac{2}{3} \, \sqrt{3} C \sqrt{c_{1}} + \frac{2}{3} \, 
\sqrt{3} \sqrt{c_{1}} t\right)} + 1\right)}}{3 \, 
{\left(e^{\left(\frac{2}{3} \, \sqrt{3} C \sqrt{c_{1}} + \frac{2}{3} \, 
\sqrt{3} \sqrt{c_{1}} t\right)} - 1\right)}},$$

in sage notation (non-LaTeX) it starts like

h(t) == 1/3*sqrt(3)*sqrt(c1)* ...

**Question 1:** Is there a way to assing to the solution (i.e. `h_sol`) the 
RHS of the above? without the `h(t) == ` part.

I had to assign by hand (it is ease, but it would be nice to automatize the 
assignation)

var('C')# the integration constant introduced above
h_sol = 1/3*sqrt(3)*sqrt(c1)* ...

Then, by simply looking at the solution it is clear that it can be 
simplified. I tried things like

h_sol = h_sol.canonicalize_radical()
h_sol = h_sol.collect_common_factors()
h_sol = h_sol.simplify_rectform(complexity_measure = None)

but none of them returns the expected result, which could be obtained from 
Mathematica's kernel

mathematica("DSolve[3*h'[t] + 3*h[t]^2 == C[1], h[t], t]//FullSimplify")

$$ \sqrt{\frac{c_1}{3}} \tanh\left( \sqrt{\frac{c_1}{3}} (t - 3 c_2) 
\right)  $$

**Question 2:** How could the expression `h_sol` be manipulated to obtain 
the hyperbolic tangent?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/f83d589a-c65f-4eb0-9075-b3e3f6dc6a20%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[sage-support] How to take out a matrix as common factors

2016-04-01 Thread Oscar Alberto Castillo Felisola
Dear community,

I'd like to show to my students how to obtain the structure functions of a 
Lie group, say SU(3). Therefore, I create a basis for the Lie algebra, 
normalized via the trace of the squares. Then, I defined a commutator 
function, and start calculating the algebra... However, I'd like to 
separate the matrix generator from the coefficient (structure constant 
element).

How (if possible) can I take out a matrix factor from the result of the 
commutator?

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Format of partial derivatives within sagemanifolds

2016-04-01 Thread Oscar Alberto Castillo Felisola
Dear community,

I'm using SAGE with SageManifolds to calculate Lie derivatives. First, I 
would like to congratulate all the team of developers, because day to day 
sagemanifolds get more useful. Next, the "problem".

I'm trying to find the most general rank two tensor compatible with O(3) 
symmetry. Here some code:

# The manifold
M = Manifold(4, 'M')

# The patch
X. = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')

# Killing vectors
Lx = M.vector_field('Lx')
Lx[:] = ( 0, 0, -cos(ph), cot(th)*sin(ph) )
Ly = M.vector_field('Ly')
Ly[:] = ( 0, 0, sin(ph), cot(th)*cos(ph) )
Lz = M.vector_field('Lz')
Lz[:] = ( 0, 0, 0, 1)

# The general tensor
T = M.tensor_field( 0, 2, 'T' )
for i in xrange(4):
for j in xrange(4):
T[i,j] = function("T%s%s" % (i,j))(t, r, th, ph)

# One of the Lie derivatives
LxT = T.lie_der(Lx)
LxT.display_comp() 

Then, the "problem" is that the PDE displayed show partial derivatives with 
respect to `th` or `ph` instead of using the LaTeX symbols as defined on 
the patch.

Is there a way to correct this behaviour?

Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: Sage Crash Report

2016-04-01 Thread Oscar Alberto Castillo Felisola
Thank you HG, Your suggestion worked like a charm. I create a new branch in 
my sage installation and tried your suggestion, and it works smoothly.

Best wishes!
Oscar.

On Thursday, 31 March 2016 14:56:08 UTC-3, HG wrote:
>
> sagemanifolds compiles well usually... Just follow the install doc and 
> sm-install.sh :
>
> http://sagemanifolds.obspm.fr/download.html#script_install/sm-install.sh
>
> I prefer than git.
>
> Le 31/03/2016 19:00, Oscar Alberto Castillo Felisola a écrit :
>
> Hi Eric, 
>
> I finally compiled the source of sage from github, but I got a merge 
> conflict when I added the sagemanifolds branch. I'll post further when I 
> get to the office. Hope you could help me.
>
> Cheers.
>
> On Tuesday, 29 March 2016 15:51:53 UTC-3, Eric Gourgoulhon wrote: 
>>
>> Hi Oscar, 
>>
>> I'm afraid I cannot help much with your specific problem. The only thing 
>> I can tell is that Sage 7.1 + SageManifolds 0.9 works well on Ubuntu, which 
>> is based on Debian, but of course differs from it.
>>
>> Best regards,
>>
>> Eric.
>>
>> Le mardi 29 mars 2016 16:04:20 UTC+2, Oscar Alberto Castillo Felisola a 
>> écrit : 
>>>
>>> Dear community,  
>>>
>>> lately, I'm having problems with the installation of SAGE. I downloaded 
>>> the version Sage v.7.1 for Debian_8, and it seems to work... but I 
>>> installed sagemanifold v.0.9, and I got the report file attached to this 
>>> post.
>>>
>>> I'm having problems too when compiling the scr code, because the file 
>>> `flint*` has a problem.
>>>
>>> Any suggestions?
>>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support...@googlegroups.com .
> To post to this group, send email to sage-s...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sage Crash Report

2016-03-31 Thread Oscar Alberto Castillo Felisola
Hi Eric,

I finally compiled the source of sage from github, but I got a merge 
conflict when I added the sagemanifolds branch. I'll post further when I 
get to the office. Hope you could help me.

Cheers.

On Tuesday, 29 March 2016 15:51:53 UTC-3, Eric Gourgoulhon wrote:
>
> Hi Oscar, 
>
> I'm afraid I cannot help much with your specific problem. The only thing I 
> can tell is that Sage 7.1 + SageManifolds 0.9 works well on Ubuntu, which 
> is based on Debian, but of course differs from it.
>
> Best regards,
>
> Eric.
>
> Le mardi 29 mars 2016 16:04:20 UTC+2, Oscar Alberto Castillo Felisola a 
> écrit :
>>
>> Dear community, 
>>
>> lately, I'm having problems with the installation of SAGE. I downloaded 
>> the version Sage v.7.1 for Debian_8, and it seems to work... but I 
>> installed sagemanifold v.0.9, and I got the report file attached to this 
>> post.
>>
>> I'm having problems too when compiling the scr code, because the file 
>> `flint*` has a problem.
>>
>> Any suggestions?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Sage Crash Report

2016-03-31 Thread Oscar Alberto Castillo Felisola
Hi Volker,

I discover that a git repository hosted at github. I was able to compile 
the source from that repository, which is by the way more updated that the 
repository advertised at the documentation.

Nonetheless, I'm still having problems when trying to compile the 
sagemanifolds branch... It gave me some conflict issues, and didn't work 
after the resolution.

Thank you!

On Tuesday, 29 March 2016 19:39:07 UTC-3, Volker Braun wrote:
>
> Should be fixed in the next version. In the meantime, you can download the 
> source tarball and compile that.
>
>
>
> On Tuesday, March 29, 2016 at 4:04:20 PM UTC+2, Oscar Alberto Castillo 
> Felisola wrote:
>>
>> Dear community, 
>>
>> lately, I'm having problems with the installation of SAGE. I downloaded 
>> the version Sage v.7.1 for Debian_8, and it seems to work... but I 
>> installed sagemanifold v.0.9, and I got the report file attached to this 
>> post.
>>
>> I'm having problems too when compiling the scr code, because the file 
>> `flint*` has a problem.
>>
>> Any suggestions?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Sage Crash Report

2016-03-29 Thread Oscar Alberto Castillo Felisola
Dear community, 

lately, I'm having problems with the installation of SAGE. I downloaded the 
version Sage v.7.1 for Debian_8, and it seems to work... but I installed 
sagemanifold v.0.9, and I got the report file attached to this post.

I'm having problems too when compiling the scr code, because the file 
`flint*` has a problem.

Any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.
***

IPython post-mortem report

{'commit_hash': u'7f50c6b',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': 
'/home/oscar/Software/SageMath/local/lib/python2.7/site-packages/IPython',
 'ipython_version': '4.1.2',
 'os_name': 'posix',
 'platform': 'Linux-3.16.0-4-amd64-x86_64-with-debian-8.3',
 'sys_executable': '/home/oscar/Software/SageMath/local/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.10 (default, Mar 22 2016, 15:57:51) \n[GCC 4.9.3]'}

***



***

Crash traceback:

---
---
ImportError   Python 2.7.10: /home/oscar/Software/SageMath/local/bin/python
   Tue Mar 29 10:58:32 2016
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/home/oscar/Software/SageMath/src/bin/sage-ipython in ()
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 """
  4 Sage IPython startup script.
  5 """
  6 
  7 # Install extra readline commands before IPython initialization
  8 from sage.repl.readline_extra_commands import *
  9 
 10 from sage.repl.interpreter import SageTerminalApp
 11 
 12 app = SageTerminalApp.instance()
---> 13 app.initialize()
global app.initialize = >
 14 app.start()

 in initialize(self=, argv=None)

/home/oscar/Software/SageMath/local/lib/python2.7/site-packages/traitlets/config/application.py
 in catch_config_error(method=, 
app=, *args=(None,), **kwargs={})
 59 
 60 
#-
 61 # Application class
 62 
#-
 63 
 64 @decorator
 65 def catch_config_error(method, app, *args, **kwargs):
 66 """Method decorator for catching invalid config 
(Trait/ArgumentErrors) during init.
 67 
 68 On a TraitError (generally caused by bad config), this will print 
the trait's
 69 message, and exit the app.
 70 
 71 For use on init methods, to prevent invoking excepthook on invalid 
input.
 72 """
 73 try:
---> 74 return method(app, *args, **kwargs)
method = 
app = 
args = (None,)
kwargs = {}
 75 except (TraitError, ArgumentError) as e:
 76 app.print_help()
 77 app.log.fatal("Bad config encountered during initialization:")
 78 app.log.fatal(str(e))
 79 app.log.debug("Config at the time: %s", app.config)
 80 app.exit(1)
 81 
 82 
 83 class ApplicationError(Exception):
 84 pass
 85 
 86 
 87 class LevelFormatter(logging.Formatter):
 88 """Formatter with additional `highlevel` record
 89 

/home/oscar/Software/SageMath/local/lib/python2.7/site-packages/IPython/terminal/ipapp.py
 in initialize(self=, argv=None)
291 
292 return super(TerminalIPythonApp, self).parse_command_line(argv)
293 
294 @catch_config_error
295 def initialize(self, argv=None):
296 """Do actions after construct, but before starting the app."""
297 super(TerminalIPythonApp, self).initialize(argv)
298 if self.subapp is not None:
299 # don't bother initializing further, starting subapp
300 return
301 # print self.extra_args
302 if self.extra_args and not self.something_to_run:
303 self.file_to_run = self.extra_args[0]
304 self.init_path()
305 # create the shell
--> 306 self.init_shell()
self.init_shell = >
307 # and draw the banner
308 self.init_banner()
309 # Now a variety of 

[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
Thank you very much Harald!

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
Hi. I know that one can define a function by declaring

sage: f = function('f', t,r)

However, I'm interested in declaring a matrix filled with different 
functions. Of course, for a small matrix I can do it by hand, but for 
huge matrices it is boring and make no sense. 

Is it possible to do what I need? 

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
I'd like to obtain something like

f11 = function('f11', t,r)
f12 = function('f12', t,r)
f21 = function('f21', t,r)
f22 = function('f22', t,r)
M = matrix(2,2, [[f11, f12], [f21, f22]])

Note that in principle all the functions depend on the same variables.

If the assignation of functions could be used as components of a metric of 
sagemanifold, would be even better.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Plots and their fontsizes

2014-12-05 Thread Oscar Alberto Castillo Felisola
Is it possible to choose different fontsize(s) for the axis labels and the 
numbers in the axis? 

I'm particularly interested in the `implicit_plot` function, but if it 
works in a usual `plot` is good enough!!!

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] GIT repository and installation

2014-07-14 Thread Oscar Alberto Castillo Felisola
I'm a regular user of Sage. First I used the Ubuntu version, and now that I 
run a Debian flavour of Linux, I compile the source each time a new version 
is release.

However, I'm intriguing whether or not is possible to build Sage from the 
git repository.

*Is it possible? How could I do that?*

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] GIT repository and installation

2014-07-14 Thread Oscar Alberto Castillo Felisola
Checking it out! Thank you John.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.