Ask Your Question

franpena's profile - activity

2024-04-16 12:03:27 +0200 received badge  Notable Question (source)
2022-04-18 12:25:48 +0200 edited question negative number cannot be raised to a fractional power in RDF

negative number cannot be raised to a fractional power in RDF Hi, can anyone tell me why this evaluation is correct: va

2022-04-18 12:22:53 +0200 edited question negative number cannot be raised to a fractional power in RDF

negative number cannot be raised to a fractional power in RDF Hi, can anyone tell me why this evaluation is correct: va

2022-04-18 12:04:22 +0200 received badge  Organizer (source)
2022-04-18 12:03:51 +0200 edited question negative number cannot be raised to a fractional power in RDF

negative number cannot be raised to a fractional power in RDF Hi, can anyone tell why this evaluation is correct: var(

2022-04-18 12:03:07 +0200 asked a question negative number cannot be raised to a fractional power in RDF

negative number cannot be raised to a fractional power in RDF Hi, can anyone tell why this evaluation is correct: var(

2021-07-17 04:39:34 +0200 received badge  Notable Question (source)
2020-10-22 04:05:36 +0200 received badge  Popular Question (source)
2020-01-07 17:30:33 +0200 received badge  Popular Question (source)
2019-12-01 04:36:21 +0200 received badge  Popular Question (source)
2017-11-30 17:23:21 +0200 received badge  Notable Question (source)
2017-07-20 04:34:47 +0200 received badge  Popular Question (source)
2017-02-14 18:42:39 +0200 asked a question Memory error mixing exact numbers and decimal ones

Hi,

I wonder why this code gives an error in Sage 7.5.1:

f(x)=3*sin(2*pi*(1.75-2*x))
if abs(f(0.7)) < 1e-12:
     print 1

MemoryError: Not enough memory to calculate cyclotomic polynomial of 428914250225777
2017-02-10 17:20:56 +0200 commented answer Evaluating the derivative of piecewise functions

Thank you @paulmasson. So that means that piecewise cannot operate as similar as Piecewise does with symbolic expressions. In my opinion this is a drawback.

2017-02-10 16:54:38 +0200 received badge  Scholar (source)
2017-02-10 16:54:09 +0200 received badge  Editor (source)
2017-02-10 16:38:44 +0200 received badge  Supporter (source)
2017-02-09 17:44:53 +0200 asked a question find_root does not fulfill tolerance

In Sage 7.3 the result of:

find_root((4*x^4-x^2).function(x),-0.25,0.4,xtol=1e-13,rtol=1e-13)

is

1.6619679287440101e-10

One would expect that the error with the exact solution (x=0) would be lower than 1e-13. I imagine that the multiplicity of the root produces this effect. Does somebody know the numerical algorithm behind find_root?

Thanks in advance.

UPDATE: Thanks to @kcrisman, I see that find_root calls brentq. The documentation of such function says:

Safer algorithms are brentq, brenth, ridder, and bisect, but they all require that the root first be bracketed in an interval where the function changes sign. The brentq algorithm is recommended for general use in one dimensional problems when such an interval has been found.

Since 4x^4-x^2 has a root in 0 with multiplicity 2, this condition is not fulfilled. Is there any other command in Sage different from find_root to numerically calculate roots for general functions that can handle with roots with multiplicity bigger than 1?

2017-02-05 14:49:35 +0200 received badge  Student (source)
2017-02-05 02:09:52 +0200 asked a question Evaluating the derivative of piecewise functions

Hi,

In Sage 7.5 you can numerically evaluate the derivative of a regular symbolic expression using:

sage: h(x) = sin(x)
sage: diff(h)(2).n()
-0.416146836547142

Old Piecewise functions could be treated in the same way:

sage: g = Piecewise([([0,2], sin(x)), ((2,3), cos(x))])
... DeprecationWarning ...
sage: diff(g)(1).n()
0.540302305868140

However, new piecewise functions don't:

sage: f = piecewise([([0,2], sin(x)), ((2,3), cos(x))])
sage: diff(f)(1).n()
... Error ...

Thanks in advance.

2015-06-05 15:58:30 +0200 commented answer Differences between load and attach

The point is, if there is not a slowdown in the 'attach' performance, should not be always 'attach' preferred over 'load'? I.e., same speed, more features!

2015-06-03 18:18:02 +0200 asked a question Differences between load and attach

Is the automatic reload of modified files the only difference between 'load' and 'attach'? In such case, if there is not a slowdown in the 'attach' performance, should not be always 'attach' preferred over 'load'?