Ask Your Question

rtc's profile - activity

2018-07-18 08:03:00 -0600 received badge  Popular Question (source)
2018-07-18 03:55:18 -0600 received badge  Famous Question (source)
2018-07-18 00:35:24 -0600 marked best answer Simplify trig expressions with the double angle formula

I am trying to simplify the following expression in sage:

(sqrt(3)/3*cos(x)+1/3*sin(x))

the resulting expression should be:

2/3*cos(pi/6-x)

.simplify_full(), trig_reduce(), or simplify_trig() cannot produce this simplification.

Is sage currently capable of doing this?

2018-07-17 03:45:05 -0600 received badge  Notable Question (source)
2017-05-24 08:55:36 -0600 received badge  Notable Question (source)
2017-05-24 08:51:37 -0600 received badge  Good Question (source)
2017-05-23 17:26:18 -0600 received badge  Popular Question (source)
2017-04-09 04:39:46 -0600 marked best answer functions of variables with matrices

I am trying to make a function of a variable with sage for example:

f(x) = sin(x)
f(x+y)

yields:

sin(x+y)

However if It is in a matrix this no longer works:

f(x) = matrix([[sin(x)],[cos(x)]])
f(x+y)

yields:

sin(x)
cos(x)

Is this not possible or am I missing something to make this work?

I am using sage 7.3 on Ubuntu 16.04 with the aims ppa.

2016-12-13 09:28:26 -0600 asked a question Current State of Sage Notebooks?

I was just curious as to what the current plan for notebooks in sage are. If open the sage notebook server the command windows states "Please wait while the old SageNB Notebook server starts..." But that still seems to be the default. There is also the option to use jupyter notebook. Is that going to be the new default? The ArchWiki seems to state just that: ArchWiki

To summarize, there is "the old SageNB", jupyter, and the Sage Math Cloud notebook, is there a plan for what is the default or recommended option?

2016-11-14 23:25:54 -0600 commented answer Sage seems to be improperly computing an infinite sum, and giving an incorrect answer

In the upstream bug report it seems to have now been fixed.

2016-11-08 08:42:58 -0600 received badge  Enthusiast
2016-11-06 19:28:41 -0600 received badge  Popular Question (source)
2016-11-02 23:05:32 -0600 received badge  Nice Question (source)
2016-11-02 15:29:13 -0600 commented answer Sage seems to be improperly computing an infinite sum, and giving an incorrect answer

@krisman thanks!

2016-11-02 14:44:56 -0600 received badge  Good Answer (source)
2016-11-02 14:43:58 -0600 received badge  Enlightened (source)
2016-11-02 14:43:58 -0600 received badge  Good Answer (source)
2016-11-02 12:23:14 -0600 asked a question Sage seems to be improperly computing an infinite sum, and giving an incorrect answer

Reference this question: https://ask.sagemath.org/question/353...

Here is the evaluation of an infinite sum in sage:

var('n')
f(n) = (-1)^(n+1)/(3*n+6*(-1)^n)
sum(f(2*n)+f(2*n+1),n,0,oo)

1/3*log(2) - 7/9

Evaluating the same sum in Mathematica:

f[n_] := (-1)^(n + 1)/(3*n + 6*(-1)^n)
Sum[f[2*n] + f[2*n + 1], {n, 0, Infinity}]

1/6 (-2 + Log[4])

Sage seems to be giving an incorrect solution. Am I missing something?

2016-11-02 12:19:07 -0600 commented answer How I can test this equality with sage?

That is a very good question. I am going to ask another question to see if someone knows. It seems that sage is improperly computing this sum. https://ask.sagemath.org/question/353...

2016-11-02 03:07:28 -0600 received badge  Nice Answer (source)
2016-11-02 01:43:35 -0600 received badge  Nice Answer (source)
2016-11-02 01:22:36 -0600 answered a question factor x^2 - 30*x + 2817 in sqrt(-2)

I think you are looking for the roots of the polynomial:

f = x^2 - 30*x + 2817
f.roots()

which gives:

[(-36*I*sqrt(2) + 15, 1), (36*I*sqrt(2) + 15, 1)]

This would mean that your original function is equal to:

$$ x^2-30x+2817 = \left(x-(15-36 \sqrt{-2})\right)\left(x-(15+36\sqrt{-2})\right)$$

2016-11-02 00:23:59 -0600 commented answer How I can test this equality with sage?

You can't get it directly, as far as I know. It seems to be a difficult sum for CAS to solve.

2016-11-02 00:23:59 -0600 received badge  Commentator
2016-11-01 23:57:09 -0600 received badge  Teacher (source)
2016-11-01 21:53:01 -0600 answered a question How I can test this equality with sage?

A way to do it is to check if the expression is true with bool() for example

bool(2==2)
True

Or

bool(2==4)
False

With your expression you would have:

var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)

This returns false because sage doesn't seem to be able to prove their equality. So either they aren't equal or sage can't simplify it enough to prove it. So you might have to do some manipulation by hand until you can get it to a simpler state that sage can then work with.

Another option is to do a numerical approximation of the infinite sum:

var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353

((log(2)-1)/3).n()
−0.102284273146685

This code approximates the sum with the first 100,000 terms. We can see that the numerical approximation of this function does seem to approach $$\frac{log(2)-1}{3}$$