Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Dima Pasechnik
On Tue, Dec 6, 2022 at 3:40 PM Dima Pasechnik  wrote:

> even more fun can be had by trying to plot the symbolic derivative of the
> function at hand. It's just making no sense at all what I see...
>

regarding the original function, perhaps plot is trying to do a numeric
derivative of it, but it's so bad that it gets confused...


>
>
> On Tue, Dec 6, 2022 at 1:41 PM Dima Pasechnik  wrote:
>
>> I can only say that the precision settings are ignored somewhere, so you
>> get e.g. with digits=20, not 30, the following:
>> sage: sage: def foo(x):
>> : : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 +
>> 1)*(tanh(x)^2 - 1)/tan(1/2*pi*tanh(x)), digits
>> : =20))
>> :
>> sage: [foo(t) for t in [1..30]]
>> [1.93774723784661,
>>  1.96821438642349,
>>  1.99513501225342,
>>  1.99933077915401,
>>  1.0923138260,
>>  1.8771214757,
>>  1.9833695304,
>>  1.9977492984,
>>  1.9996954002,
>>  1.587773,
>>  1.944087,
>>  1.992499,
>>  1.996552,
>>  2.042880,
>>  1.864906,
>>  1.9996835578,
>>  1.9995885087,
>>  2.0113072913,
>>  2.1042817460,
>>  2.3433318607,
>>  1.99883239681839,
>>  1.99062668609516,
>>  1.94465796436172,
>>  2.14811194088516,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000]
>>
>> or wihout digits set:
>> sage: [foo(t) for t in [1..30]]
>> [1.93774723784661,
>>  1.96821438642349,
>>  1.99513501225340,
>>  1.99933077915395,
>>  1.0923138165,
>>  1.8771213936,
>>  1.9833692570,
>>  1.9977472377,
>>  1.9996716508,
>>  1.9996314183,
>>  1.9991577607,
>>  1.9955972581,
>>  1.8381431810,
>>  1.2717313233,
>>  1.99985733718347,
>>  1.99771319132044,
>>  2.00589700214384,
>>  1.91808127189615,
>>  1.23125745353424,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000,
>>  -0.000]
>>
>> if it were able to use the 30 digits, we would not have seen that drop
>> down of the function graph to 0 somewhere just before 20.
>>
>>
>> On Tue, Dec 6, 2022 at 1:28 PM Emmanuel Charpentier <
>> emanuel.charpent...@gmail.com> wrote:
>>
>>> The same thing happens after :
>>>
>>> sage: def foo(x):
>>> : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
>>> 1)/tan(1/2*pi*tanh(x)), digits=30))
>>> :
>>> sage: foo
>>> 
>>> sage: plot(foo, (1, 30))
>>> Launched png viewer for Graphics object consisting of 1 graphics primitive
>>>
>>>
>>>
>>> Le mardi 6 décembre 2022 à 14:23:48 UTC+1, Emmanuel Charpentier a écrit :
>>>
 Le mardi 6 décembre 2022 à 14:16:56 UTC+1, dim…@gmail.com a écrit :

 It's plotting via matplotlib, perhaps that's why the precision setting
> is ignored (or pehaps something like RDF is hardcoded in Sage plotting 
> code)
>
 That wouldn’t explain why the specification included in the lambda
 expression in the third example isn’t accepted : matplotlib should see
 the RR values returned by it (which *do* accept the precision
 specification).


>
> On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
> emanuel.c...@gmail.com> wrote:
>
>> Question already asked on |`ask.sagemath.org`](
>> https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
>> where it didn't attract a lot of attention...
>>
>> Let
>>
>> ```
>> sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
>> x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 -
>> 1)/tan(1/2*pi*tanh(x))
>> ```
>>
>> It can be shown (see Juanjo's answer [here](
>> https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
>> that this finction's limit at `x=oo` is 2.
>>
>> A couple CASes are wrong about it :
>>
>> ```
>> sage: f(x).limit(x=oo)
>> 0
>> sage: f(x).limit(x=oo, algorithm="maxima")
>> 0
>> ```
>>
>> A couple get it right :
>>
>> ```
>> sage: f(x).limit(x=oo, algorithm="giac")
>> 2
>> sage: f(x).limit(x=oo, algorithm="mathematica_free")
>> 2
>> ```
>>
>> And Sympy currently never returns.
>>
>> A "naïve" way to explore this is to assess the situation is to look
>> for numerical values :
>>
>> ```
>> plot(f, (1, 30))
>> ```
>> [image: tmp_bnpx6r7n.png]
>>
>> This plot hints at ill-conditionong of the epression of the function.
>> And it turns out that this ill-conditioning can be overcome by specifying
>> an "absurd" precision :
>>
>> ```
>> sage: f(30).n()
>> -0.000
>> sage: f(30).n(digits=30)
>> 1.9483984586167962667231030
>> ```
>>
>> But `plot` seems 

Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Dima Pasechnik
even more fun can be had by trying to plot the symbolic derivative of the
function at hand. It's just making no sense at all what I see...


On Tue, Dec 6, 2022 at 1:41 PM Dima Pasechnik  wrote:

> I can only say that the precision settings are ignored somewhere, so you
> get e.g. with digits=20, not 30, the following:
> sage: sage: def foo(x):
> : : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2
> - 1)/tan(1/2*pi*tanh(x)), digits
> : =20))
> :
> sage: [foo(t) for t in [1..30]]
> [1.93774723784661,
>  1.96821438642349,
>  1.99513501225342,
>  1.99933077915401,
>  1.0923138260,
>  1.8771214757,
>  1.9833695304,
>  1.9977492984,
>  1.9996954002,
>  1.587773,
>  1.944087,
>  1.992499,
>  1.996552,
>  2.042880,
>  1.864906,
>  1.9996835578,
>  1.9995885087,
>  2.0113072913,
>  2.1042817460,
>  2.3433318607,
>  1.99883239681839,
>  1.99062668609516,
>  1.94465796436172,
>  2.14811194088516,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000]
>
> or wihout digits set:
> sage: [foo(t) for t in [1..30]]
> [1.93774723784661,
>  1.96821438642349,
>  1.99513501225340,
>  1.99933077915395,
>  1.0923138165,
>  1.8771213936,
>  1.9833692570,
>  1.9977472377,
>  1.9996716508,
>  1.9996314183,
>  1.9991577607,
>  1.9955972581,
>  1.8381431810,
>  1.2717313233,
>  1.99985733718347,
>  1.99771319132044,
>  2.00589700214384,
>  1.91808127189615,
>  1.23125745353424,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000,
>  -0.000]
>
> if it were able to use the 30 digits, we would not have seen that drop
> down of the function graph to 0 somewhere just before 20.
>
>
> On Tue, Dec 6, 2022 at 1:28 PM Emmanuel Charpentier <
> emanuel.charpent...@gmail.com> wrote:
>
>> The same thing happens after :
>>
>> sage: def foo(x):
>> : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
>> 1)/tan(1/2*pi*tanh(x)), digits=30))
>> :
>> sage: foo
>> 
>> sage: plot(foo, (1, 30))
>> Launched png viewer for Graphics object consisting of 1 graphics primitive
>>
>> ​
>>
>>
>> Le mardi 6 décembre 2022 à 14:23:48 UTC+1, Emmanuel Charpentier a écrit :
>>
>>> Le mardi 6 décembre 2022 à 14:16:56 UTC+1, dim…@gmail.com a écrit :
>>>
>>> It's plotting via matplotlib, perhaps that's why the precision setting
 is ignored (or pehaps something like RDF is hardcoded in Sage plotting 
 code)

>>> That wouldn’t explain why the specification included in the lambda
>>> expression in the third example isn’t accepted : matplotlib should see
>>> the RR values returned by it (which *do* accept the precision
>>> specification).
>>>
>>>

 On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
 emanuel.c...@gmail.com> wrote:

> Question already asked on |`ask.sagemath.org`](
> https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
> where it didn't attract a lot of attention...
>
> Let
>
> ```
> sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
> x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 -
> 1)/tan(1/2*pi*tanh(x))
> ```
>
> It can be shown (see Juanjo's answer [here](
> https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
> that this finction's limit at `x=oo` is 2.
>
> A couple CASes are wrong about it :
>
> ```
> sage: f(x).limit(x=oo)
> 0
> sage: f(x).limit(x=oo, algorithm="maxima")
> 0
> ```
>
> A couple get it right :
>
> ```
> sage: f(x).limit(x=oo, algorithm="giac")
> 2
> sage: f(x).limit(x=oo, algorithm="mathematica_free")
> 2
> ```
>
> And Sympy currently never returns.
>
> A "naïve" way to explore this is to assess the situation is to look
> for numerical values :
>
> ```
> plot(f, (1, 30))
> ```
> [image: tmp_bnpx6r7n.png]
>
> This plot hints at ill-conditionong of the epression of the function.
> And it turns out that this ill-conditioning can be overcome by specifying
> an "absurd" precision :
>
> ```
> sage: f(30).n()
> -0.000
> sage: f(30).n(digits=30)
> 1.9483984586167962667231030
> ```
>
> But `plot` seems to *ignore* this specification :
>
> ```
> sage: plot(lambda u:f(u).n(digits=30), (1, 30))
> ```
>
> [image: tmp_jeq3c8ko.png]
>
> We can try to "isolate" the precision specification in a Python
> function, which seems to work :
>
> ```
> sage: def foo(x): return RR(f(x).n(digits=30))
> sage: foo(30)
> 

Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Oscar Benjamin
On Tue, 6 Dec 2022 at 12:53, Emmanuel Charpentier
 wrote:
>
>
> And Sympy currently never returns.

With current SymPy master it takes 6 seconds:

In [1]: %time log(tan(pi/2*tanh(x))).diff(x).limit(x, oo)
CPU times: user 5.73 s, sys: 24 ms, total: 5.75 s
Wall time: 5.75 s
Out[1]: 2

The fix was part of a GSOC project this summer and will be in SymPy 1.12:
https://github.com/sympy/sympy/pull/23844

--
Oscar

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAHVvXxSvaiH1mKt4kNgfs%2Bndhf22B2Hsvyav0tTHwpFC6Oq9Uw%40mail.gmail.com.


Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Dima Pasechnik
I can only say that the precision settings are ignored somewhere, so you
get e.g. with digits=20, not 30, the following:
sage: sage: def foo(x):
: : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2
- 1)/tan(1/2*pi*tanh(x)), digits
: =20))
:
sage: [foo(t) for t in [1..30]]
[1.93774723784661,
 1.96821438642349,
 1.99513501225342,
 1.99933077915401,
 1.0923138260,
 1.8771214757,
 1.9833695304,
 1.9977492984,
 1.9996954002,
 1.587773,
 1.944087,
 1.992499,
 1.996552,
 2.042880,
 1.864906,
 1.9996835578,
 1.9995885087,
 2.0113072913,
 2.1042817460,
 2.3433318607,
 1.99883239681839,
 1.99062668609516,
 1.94465796436172,
 2.14811194088516,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000]

or wihout digits set:
sage: [foo(t) for t in [1..30]]
[1.93774723784661,
 1.96821438642349,
 1.99513501225340,
 1.99933077915395,
 1.0923138165,
 1.8771213936,
 1.9833692570,
 1.9977472377,
 1.9996716508,
 1.9996314183,
 1.9991577607,
 1.9955972581,
 1.8381431810,
 1.2717313233,
 1.99985733718347,
 1.99771319132044,
 2.00589700214384,
 1.91808127189615,
 1.23125745353424,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000,
 -0.000]

if it were able to use the 30 digits, we would not have seen that drop down
of the function graph to 0 somewhere just before 20.


On Tue, Dec 6, 2022 at 1:28 PM Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> The same thing happens after :
>
> sage: def foo(x):
> : return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
> 1)/tan(1/2*pi*tanh(x)), digits=30))
> :
> sage: foo
> 
> sage: plot(foo, (1, 30))
> Launched png viewer for Graphics object consisting of 1 graphics primitive
>
> ​
>
>
> Le mardi 6 décembre 2022 à 14:23:48 UTC+1, Emmanuel Charpentier a écrit :
>
>> Le mardi 6 décembre 2022 à 14:16:56 UTC+1, dim…@gmail.com a écrit :
>>
>> It's plotting via matplotlib, perhaps that's why the precision setting is
>>> ignored (or pehaps something like RDF is hardcoded in Sage plotting code)
>>>
>> That wouldn’t explain why the specification included in the lambda
>> expression in the third example isn’t accepted : matplotlib should see
>> the RR values returned by it (which *do* accept the precision
>> specification).
>>
>>
>>>
>>> On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
>>> emanuel.c...@gmail.com> wrote:
>>>
 Question already asked on |`ask.sagemath.org`](
 https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
 where it didn't attract a lot of attention...

 Let

 ```
 sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
 x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 -
 1)/tan(1/2*pi*tanh(x))
 ```

 It can be shown (see Juanjo's answer [here](
 https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
 that this finction's limit at `x=oo` is 2.

 A couple CASes are wrong about it :

 ```
 sage: f(x).limit(x=oo)
 0
 sage: f(x).limit(x=oo, algorithm="maxima")
 0
 ```

 A couple get it right :

 ```
 sage: f(x).limit(x=oo, algorithm="giac")
 2
 sage: f(x).limit(x=oo, algorithm="mathematica_free")
 2
 ```

 And Sympy currently never returns.

 A "naïve" way to explore this is to assess the situation is to look for
 numerical values :

 ```
 plot(f, (1, 30))
 ```
 [image: tmp_bnpx6r7n.png]

 This plot hints at ill-conditionong of the epression of the function.
 And it turns out that this ill-conditioning can be overcome by specifying
 an "absurd" precision :

 ```
 sage: f(30).n()
 -0.000
 sage: f(30).n(digits=30)
 1.9483984586167962667231030
 ```

 But `plot` seems to *ignore* this specification :

 ```
 sage: plot(lambda u:f(u).n(digits=30), (1, 30))
 ```

 [image: tmp_jeq3c8ko.png]

 We can try to "isolate" the precision specification in a Python
 function, which seems to work :

 ```
 sage: def foo(x): return RR(f(x).n(digits=30))
 sage: foo(30)
 1.9483984586
 ```

 but is still defeated byr the inner gears of `plot` :

 ```
 sage: plot(foo, (1, 30))
 ```

 [image: tmp_dg2gelpc.png]

 Why, Ô why ???


 --
 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.

Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Emmanuel Charpentier


The same thing happens after :

sage: def foo(x):
: return RR(N(-1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
1)/tan(1/2*pi*tanh(x)), digits=30))
: 
sage: foo

sage: plot(foo, (1, 30))
Launched png viewer for Graphics object consisting of 1 graphics primitive

​


Le mardi 6 décembre 2022 à 14:23:48 UTC+1, Emmanuel Charpentier a écrit :

> Le mardi 6 décembre 2022 à 14:16:56 UTC+1, dim…@gmail.com a écrit :
>
> It's plotting via matplotlib, perhaps that's why the precision setting is 
>> ignored (or pehaps something like RDF is hardcoded in Sage plotting code)
>>
> That wouldn’t explain why the specification included in the lambda 
> expression in the third example isn’t accepted : matplotlib should see 
> the RR values returned by it (which *do* accept the precision 
> specification).
>
>
>>
>> On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
>> emanuel.c...@gmail.com> wrote:
>>
>>> Question already asked on |`ask.sagemath.org`](
>>> https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
>>>  
>>> where it didn't attract a lot of attention...
>>>
>>> Let
>>>
>>> ```
>>> sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
>>> x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
>>> 1)/tan(1/2*pi*tanh(x))
>>> ```
>>>
>>> It can be shown (see Juanjo's answer [here](
>>> https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
>>>  
>>> that this finction's limit at `x=oo` is 2.
>>>
>>> A couple CASes are wrong about it :
>>>
>>> ```
>>> sage: f(x).limit(x=oo)
>>> 0
>>> sage: f(x).limit(x=oo, algorithm="maxima")
>>> 0
>>> ```
>>>
>>> A couple get it right :
>>>
>>> ```
>>> sage: f(x).limit(x=oo, algorithm="giac")
>>> 2
>>> sage: f(x).limit(x=oo, algorithm="mathematica_free")
>>> 2
>>> ```
>>>
>>> And Sympy currently never returns.
>>>
>>> A "naïve" way to explore this is to assess the situation is to look for 
>>> numerical values :
>>>
>>> ```
>>> plot(f, (1, 30))
>>> ```
>>> [image: tmp_bnpx6r7n.png]
>>>
>>> This plot hints at ill-conditionong of the epression of the function. 
>>> And it turns out that this ill-conditioning can be overcome by specifying 
>>> an "absurd" precision :
>>>
>>> ```
>>> sage: f(30).n()
>>> -0.000
>>> sage: f(30).n(digits=30)
>>> 1.9483984586167962667231030
>>> ```
>>>
>>> But `plot` seems to *ignore* this specification :
>>>
>>> ```
>>> sage: plot(lambda u:f(u).n(digits=30), (1, 30))
>>> ```
>>>
>>> [image: tmp_jeq3c8ko.png]
>>>
>>> We can try to "isolate" the precision specification in a Python 
>>> function, which seems to work :
>>>
>>> ```
>>> sage: def foo(x): return RR(f(x).n(digits=30))
>>> sage: foo(30)
>>> 1.9483984586
>>> ```
>>>
>>> but is still defeated byr the inner gears of `plot` :
>>>
>>> ```
>>> sage: plot(foo, (1, 30))
>>> ```
>>>
>>> [image: tmp_dg2gelpc.png]
>>>
>>> Why, Ô why ???
>>>
>>>
>>> -- 
>>> 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 view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sage-support/db271244-0ad7-4484-8a46-bdc4b1edd0f0n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>> ​
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/de783db9-35b4-47a4-88ba-064a1f67f532n%40googlegroups.com.


Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Emmanuel Charpentier


Le mardi 6 décembre 2022 à 14:16:56 UTC+1, dim…@gmail.com a écrit :

It's plotting via matplotlib, perhaps that's why the precision setting is 
> ignored (or pehaps something like RDF is hardcoded in Sage plotting code)
>
That wouldn’t explain why the specification included in the lambda 
expression in the third example isn’t accepted : matplotlib should see the 
RR values returned by it (which *do* accept the precision specification).


>
> On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
> emanuel.c...@gmail.com> wrote:
>
>> Question already asked on |`ask.sagemath.org`](
>> https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
>>  
>> where it didn't attract a lot of attention...
>>
>> Let
>>
>> ```
>> sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
>> x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
>> 1)/tan(1/2*pi*tanh(x))
>> ```
>>
>> It can be shown (see Juanjo's answer [here](
>> https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
>>  
>> that this finction's limit at `x=oo` is 2.
>>
>> A couple CASes are wrong about it :
>>
>> ```
>> sage: f(x).limit(x=oo)
>> 0
>> sage: f(x).limit(x=oo, algorithm="maxima")
>> 0
>> ```
>>
>> A couple get it right :
>>
>> ```
>> sage: f(x).limit(x=oo, algorithm="giac")
>> 2
>> sage: f(x).limit(x=oo, algorithm="mathematica_free")
>> 2
>> ```
>>
>> And Sympy currently never returns.
>>
>> A "naïve" way to explore this is to assess the situation is to look for 
>> numerical values :
>>
>> ```
>> plot(f, (1, 30))
>> ```
>> [image: tmp_bnpx6r7n.png]
>>
>> This plot hints at ill-conditionong of the epression of the function. And 
>> it turns out that this ill-conditioning can be overcome by specifying an 
>> "absurd" precision :
>>
>> ```
>> sage: f(30).n()
>> -0.000
>> sage: f(30).n(digits=30)
>> 1.9483984586167962667231030
>> ```
>>
>> But `plot` seems to *ignore* this specification :
>>
>> ```
>> sage: plot(lambda u:f(u).n(digits=30), (1, 30))
>> ```
>>
>> [image: tmp_jeq3c8ko.png]
>>
>> We can try to "isolate" the precision specification in a Python function, 
>> which seems to work :
>>
>> ```
>> sage: def foo(x): return RR(f(x).n(digits=30))
>> sage: foo(30)
>> 1.9483984586
>> ```
>>
>> but is still defeated byr the inner gears of `plot` :
>>
>> ```
>> sage: plot(foo, (1, 30))
>> ```
>>
>> [image: tmp_dg2gelpc.png]
>>
>> Why, Ô why ???
>>
>>
>> -- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/db271244-0ad7-4484-8a46-bdc4b1edd0f0n%40googlegroups.com
>>  
>> 
>> .
>>
> ​

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d4815776-3bbd-44b1-bc46-cfc423cdedf4n%40googlegroups.com.


Re: [sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Dima Pasechnik
It's plotting via matplotlib, perhaps that's why the precision setting is
ignored (or pehaps something like RDF is hardcoded in Sage plotting code)


On Tue, Dec 6, 2022 at 12:53 PM Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> Question already asked on |`ask.sagemath.org`](
> https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
> where it didn't attract a lot of attention...
>
> Let
>
> ```
> sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
> x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 -
> 1)/tan(1/2*pi*tanh(x))
> ```
>
> It can be shown (see Juanjo's answer [here](
> https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
> that this finction's limit at `x=oo` is 2.
>
> A couple CASes are wrong about it :
>
> ```
> sage: f(x).limit(x=oo)
> 0
> sage: f(x).limit(x=oo, algorithm="maxima")
> 0
> ```
>
> A couple get it right :
>
> ```
> sage: f(x).limit(x=oo, algorithm="giac")
> 2
> sage: f(x).limit(x=oo, algorithm="mathematica_free")
> 2
> ```
>
> And Sympy currently never returns.
>
> A "naïve" way to explore this is to assess the situation is to look for
> numerical values :
>
> ```
> plot(f, (1, 30))
> ```
> [image: tmp_bnpx6r7n.png]
>
> This plot hints at ill-conditionong of the epression of the function. And
> it turns out that this ill-conditioning can be overcome by specifying an
> "absurd" precision :
>
> ```
> sage: f(30).n()
> -0.000
> sage: f(30).n(digits=30)
> 1.9483984586167962667231030
> ```
>
> But `plot` seems to *ignore* this specification :
>
> ```
> sage: plot(lambda u:f(u).n(digits=30), (1, 30))
> ```
>
> [image: tmp_jeq3c8ko.png]
>
> We can try to "isolate" the precision specification in a Python function,
> which seems to work :
>
> ```
> sage: def foo(x): return RR(f(x).n(digits=30))
> sage: foo(30)
> 1.9483984586
> ```
>
> but is still defeated byr the inner gears of `plot` :
>
> ```
> sage: plot(foo, (1, 30))
> ```
>
> [image: tmp_dg2gelpc.png]
>
> Why, Ô why ???
>
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/db271244-0ad7-4484-8a46-bdc4b1edd0f0n%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAAWYfq2wmF1jUH85LVFzjO33LxBr%2BxvSg4dYJ9mSSxNwXzz4FA%40mail.gmail.com.


[sage-support] Plot doesn't respect numerical precision specification.

2022-12-06 Thread Emmanuel Charpentier
Question already asked on 
|`ask.sagemath.org`](https://ask.sagemath.org/question/64934/plotting-ill-conditionned-function/),
 
where it didn't attract a lot of attention...

Let

```
sage: f(x)=log(tan(pi/2*tanh(x))).diff(x) ; f
x |--> -1/2*pi*(tan(1/2*pi*tanh(x))^2 + 1)*(tanh(x)^2 - 
1)/tan(1/2*pi*tanh(x))
```

It can be shown (see Juanjo's answer 
[here](https://ask.sagemath.org/question/64794/inconsistentincorrect-value-of-limit-involving-tan-and-tanh/))
 
that this finction's limit at `x=oo` is 2.

A couple CASes are wrong about it :

```
sage: f(x).limit(x=oo)
0
sage: f(x).limit(x=oo, algorithm="maxima")
0
```

A couple get it right :

```
sage: f(x).limit(x=oo, algorithm="giac")
2
sage: f(x).limit(x=oo, algorithm="mathematica_free")
2
```

And Sympy currently never returns.

A "naïve" way to explore this is to assess the situation is to look for 
numerical values :

```
plot(f, (1, 30))
```
[image: tmp_bnpx6r7n.png]

This plot hints at ill-conditionong of the epression of the function. And 
it turns out that this ill-conditioning can be overcome by specifying an 
"absurd" precision :

```
sage: f(30).n()
-0.000
sage: f(30).n(digits=30)
1.9483984586167962667231030
```

But `plot` seems to *ignore* this specification :

```
sage: plot(lambda u:f(u).n(digits=30), (1, 30))
```

[image: tmp_jeq3c8ko.png]

We can try to "isolate" the precision specification in a Python function, 
which seems to work :

```
sage: def foo(x): return RR(f(x).n(digits=30))
sage: foo(30)
1.9483984586
```

but is still defeated byr the inner gears of `plot` :

```
sage: plot(foo, (1, 30))
```

[image: tmp_dg2gelpc.png]

Why, Ô why ???


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/db271244-0ad7-4484-8a46-bdc4b1edd0f0n%40googlegroups.com.


[sage-support] plot() silently switches to a different scale when numbers are too big

2022-09-20 Thread erentar2002

My problem can be explained with the following two plots:

plot(factorial(x),x,0,9)

and

plot(factorial(x),x,0,10)

When plotting up to 9, the plot gives me exactly what i expect, a 
linear-linear plot.
When plotting up to 10 though, sage silently chose to make the y-axis 
log10. This should not be the standard behavior as it leads to confusion.


--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/4566a5e1-3d74-29bc-5f9c-059a6b5c2bd7%40gmail.com.


[sage-support] Plot implicit polar equations

2020-10-22 Thread Rosalia Hernandez
How can we plot implicit polar equations like r^2=5-4cos(theta) in SageMath?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/54d9cb31-a094-4de5-b06c-920f53f5a4ddn%40googlegroups.com.


[sage-support] Plot saving segfault on 6.8, works on 6.7 (same machine, same config)

2015-07-28 Thread Andrzej Giniewicz
Hello again,

I have fresh build of sage 6.8 that (after setting locale) passed all
tests. Unfortunately when I tried to build my book which works with
sage 6.7 built on same machine with same options - I'm getting
segfault.

It occurs when I try to save the plot into svg for the second time
after using matplotlib.rc('text', usetex=True) - if I don't make
matplotlib use TeX, saving to svg works. If I write png after setting
use TeX, it also works. Using savefig from matplotlib also fails, also
when using ./sage -ipython.

Full output in http://pastebin.com/ZfEj7WgY including gdb.
Log from installing matplotlib: http://pastebin.com/qFY8y8wN

Machine is Arch Linux (last updated 2 years ago), gcc 4.8.0.

Failing code:

sage: import matplotlib
sage: matplotlib.rc('text', usetex=True)
sage: plot(sin).save('test.svg') # works
sage: plot(sin).save('test.svg') # segfault

Tried with and without custom CFLAGS optimizations - same effect.

Any idea what it might be? Smells like freetype, but on sage 6.7
everything works.

Thanks in advance,
Andrzej.

-- 
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] plot a 3d polyhedron with transparent background?

2015-07-06 Thread Daniel Friedan
Is it possible to plot a 3d polyhedron with transparent background?

When I use .plot(transparent=True) on a 2d polyhedron, and save to a file, 
the background is transparent.

When I do the same for a 3d polyhedron, the background is white.

p2=Polyhedron(vertices=[[0,1],[1,0]])
p3=Polyhedron(vertices=[[0,1,1],[1,0,0]])
p2_plot = p2.plot(transparent=True)
p3_plot = p3.plot(transparent=True)
p2_plot.save(the_file2)   # saved image has transparent background
p3_plot.save(the_file3)   # saved image has white background

thanks,
Daniel

-- 
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] plot command doesn't work from a function

2014-11-03 Thread Michael Beeson


sage: def testPlot():

: u = [[1,2],[3,4],[5,7]]

: list_plot(u)

: 

sage: testPlot()

sage: 


doesn't produce any plot,  but executing the body of the function directly 
at the sage prompt does produce a plot.
What am I doing wrong?




-- 
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] Plot the modulus of a complex function.

2014-01-28 Thread Albert Schueller
This morning I figured out how to plot the modulus of a complex function in 
sage.  In my travails I wondered why the first snippet works, but the 
second does not?  Is there any easy way to make the second snippet work?

#Plot the modulus of the function, works
var('z',domain=CC)
var('x y', domain=RR)
var('rp ip')
z=x+i*y
rp = (2+z.conjugate()+z^3).real()
ip = (2+z.conjugate()+z^3).imag()
m(x,y) = sqrt(rp^2+ip^2)
plot3d(m(x,y).simplify(),(x,-1.5,1.5),(y,-1.5,1.5))




My question is, why doesn't this work?

#Plot the modulus of the function, fails
var('z',domain=CC)
var('x y', domain=RR)
z=x+i*y
m(x,y) = abs(2+z.conjugate()+z^3)
plot3d(m(x,y),(x,-1.5,1.5),(y,-1.5,1.5))

-- 
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/groups/opt_out.


[sage-support] plot returns an error when given a callable class

2013-12-17 Thread Alden
I wrote a class with a __call__ method, and I want to plot an instance of 
it using plot() in the sage notebook.  I run the commands:

import circle_homeo
import cyclic_order
h = circle_homeo.PSL2R_action(cyclic_order.CyclicOrder('abAB'))[0]

(this doesn't matter; all that should matter is that h is some callable 
class)

plot(h, xmin=0, xmax=1)

returns the error:

*
Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_32.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8 
-*-\\n + 
_support_.preparse_worksheet_cell(base64.b64decode(cGxvdChoLCB4bWluPTAsIHhtYXg9MSk=),globals())+\\n);
 
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpnBGA3K/___code___.py, line 3, in module
exec compile(u'plot(h, xmin=_sage_const_0 , xmax=_sage_const_1 )
  File , line 1, in module

  File 
/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py,
 
line 692, in wrapper
return func(*args, **kwds)
  File 
/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/misc/decorators.py,
 
line 537, in wrapper
return func(*args, **options)
  File 
/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py,
 
line 1130, in plot
G = _plot(funcs, (xmin, xmax), **kwds)
  File 
/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/plot.py,
 
line 1236, in _plot
funcs, ranges = setup_for_eval_on_grid(funcs, [xrange], 
options['plot_points'])
  File 
/home/akwalker/Documents/software/sage-5.3/local/lib/python2.7/site-packages/sage/plot/misc.py,
 
line 148, in setup_for_eval_on_grid
return fast_float(funcs, *vars,**options), [tuple(range+[range_step]) 
for range,range_step in zip(ranges, range_steps)]
  File fast_eval.pyx, line 1377, in sage.ext.fast_eval.fast_float 
(sage/ext/fast_eval.c:9718)
AttributeError: EquivariantRHomeo instance has no attribute '__float__'
***

However, if I do:

f = lambda x:h(x)
plot(f, xmin=0, xmax=1)

That works fine.  Is there something I need to do to the class to convince 
plot() to call it?


-- 
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/groups/opt_out.


[sage-support] Plot of a 2-var discontinous function

2013-11-19 Thread Jotace
Hello to everyone

I was trying to plot a discontinuous function of two variables like this

cmsel = [colormaps['hot'](i) for i in sxrange(0,1,0.05)]
Surff=plot3d(arctan(y/x),(x,-1,1),(y,-1,1),adaptive=True, color=cmsel)
show(Surff)

This works very fine for continuous functions. I cannot use the 
adaptive=True option when f is not continuous. Is there anything like the 
detect_pole = True for 3d plots?

thanks!

JC

-- 
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/groups/opt_out.


[sage-support] Plot is maybe too good :)

2013-11-03 Thread Rolandb
Hi,

The following works, but should '==' work?

var('a,b')
b=5
plot(a^2-b==3,a,1,7)

Roland
 
 
 

-- 
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/groups/opt_out.


Re: [sage-support] Plot is maybe too good :)

2013-11-03 Thread Christophe Bal
Hello,
I think also that there is a problem.

More simply, something like


--
var('a')
plot(a^2==3,a,1,7)
--

should work like

---
var('a')
plot(bool(a^2==3),a,1,7)
---

But the plot function doesn't support booleans.
Just try this.

--
var('a')
plot(a^2=3,a,1,7)
--

Best regards.
Christophe.

-- 
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/groups/opt_out.


[sage-support] Plot several functions in the same graphic - A stack like method

2013-11-03 Thread Christophe Bal
Hello,
here is a way to draw several functions on the same graphic.


myFamily = plot(0, x, 1, 7)

for a in range(1, 10):
myFamily += plot(a*x^2+2, x, 1, 7)

show(myFamily)


I find this simple but a little ugly because I use plot(0, x, 1, 7)
that indeed is not  in my family of functions.

Is there a better way ? Just a precision : here I use a simple
family of functions but I'm looking for a kind of stack functionality
for plotting functions.

Best regards.
Christophe

-- 
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/groups/opt_out.


[sage-support] plot the solution obtained from desolve_system

2013-07-10 Thread Flavio Coelho
Hi,

I am trying to plot the solutions the following system of ODEs

var('t')
A = function('A',t)
B = function('B',t)
de1 = diff(A,t) == -k1*A+k2*B
de2 = diff(B,t) == k1*A-k2*B
sol = desolve_system([de1,de2],[A,B],ics=[500,0])
show(sol)
solA, solB = sol[0].rhs(), sol[1].rhs()
plot((solA,solB),(t,0,50))

however the solution includes A(0) and B(0) as seen below:

[A(t)=111(6A(0)-5B(0))e(-1120t)+511A(0)+511B(0),B(t)=-111(6A(0)-5B(0))e(-11
20t)+611A(0)+611B(0)]
How do specify the initial contidions so that my plot command above works? 
Now I am getting the following error:

verbose 0 (2424: plot.py, generate_plot_points) WARNING: When plotting,
failed to evaluate function at 200 points.
verbose 0 (2424: plot.py, generate_plot_points) Last error message:
'unable to simplify to float approximation'
verbose 0 (2424: plot.py, generate_plot_points) WARNING: When plotting,
failed to evaluate function at 200 points.
verbose 0 (2424: plot.py, generate_plot_points) Last error message:
'unable to simplify to float approximation'


-- 
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/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread William Stein
On Sun, Jun 9, 2013 at 3:25 PM,  computational.gr...@gmail.com wrote:
 Suppose I have a complex function f(z) with a continuous family of zeros 
 (e.g., f(z)=z-|z|)

 Is there a way to easily plot the set of zeros of f in sage, regardless of 
 how complicated the function f is?


You might find complex_plot useful.  For example, for

f(z) = z - abs(z)
complex_plot(f, (-3,3), (-3,3))

you'll see a *black line* at the zero set of f(z).

In the notebook you mind find an interact like this useful:


z = var('z')
@interact
def _(f = z-abs(z), B=(2..10)):
show(complex_plot(f, (-B,B), (-B,B)))

Or just click on

http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674

 --
 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?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread computational . group
Thanks, this is exactly what I was looking for!

In fact, I had tried out complex_plot but I must have been using a 
different color function or something, because the roots were much less 
apparent to me. Not sure why I couldn't figure this out on my own...

I suppose I have two follow-up questions now:
1. how can I improve the precision of the zero set (it seems to be drawn in 
low resolution right now)
2. what is the best way to turn off the other colors (draw non-zeros as 
white)

On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote:

 On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com javascript: 
 wrote: 
  Suppose I have a complex function f(z) with a continuous family of zeros 
 (e.g., f(z)=z-|z|) 
  
  Is there a way to easily plot the set of zeros of f in sage, regardless 
 of how complicated the function f is? 
  

 You might find complex_plot useful.  For example, for 

 f(z) = z - abs(z) 
 complex_plot(f, (-3,3), (-3,3)) 

 you'll see a *black line* at the zero set of f(z). 

 In the notebook you mind find an interact like this useful: 


 z = var('z') 
 @interact 
 def _(f = z-abs(z), B=(2..10)): 
 show(complex_plot(f, (-B,B), (-B,B))) 

 Or just click on 

 http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674 

  -- 
  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 javascript:. 
  To post to this group, send email to 
  sage-s...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sage-support?hl=en. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



 -- 
 William Stein 
 Professor of Mathematics 
 University of Washington 
 http://wstein.org 


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread William Stein
On Mon, Jun 10, 2013 at 9:09 AM,  computational.gr...@gmail.com wrote:
 Thanks, this is exactly what I was looking for!

 In fact, I had tried out complex_plot but I must have been using a different
 color function or something, because the roots were much less apparent to
 me. Not sure why I couldn't figure this out on my own...

 I suppose I have two follow-up questions now:
 1. how can I improve the precision of the zero set (it seems to be drawn in
 low resolution right now)

Use plot_points:

f(z) = z - abs(z)
complex_plot(f, (-3,3), (-3,3), plot_points=200)

 2. what is the best way to turn off the other colors (draw non-zeros as
 white)

I don't know if this is possible or implemented at present.


 On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote:

 On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote:
  Suppose I have a complex function f(z) with a continuous family of zeros
  (e.g., f(z)=z-|z|)
 
  Is there a way to easily plot the set of zeros of f in sage, regardless
  of how complicated the function f is?
 

 You might find complex_plot useful.  For example, for

 f(z) = z - abs(z)
 complex_plot(f, (-3,3), (-3,3))

 you'll see a *black line* at the zero set of f(z).

 In the notebook you mind find an interact like this useful:


 z = var('z')
 @interact
 def _(f = z-abs(z), B=(2..10)):
 show(complex_plot(f, (-B,B), (-B,B)))

 Or just click on

 http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674

  --
  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 http://groups.google.com/group/sage-support?hl=en.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 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?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread computational . group
Ah, that's unfortunate. Might be a fun summer project to try to implement, 
if I knew where to start.

On another note: I really like the @interact annotation. I'm messing around 
with it, because I would like to add another parameter to my plot - an 
integer representing an index in a discrete family of functions. But I keep 
getting python errors about my expression not being symbolic when I try to 
include an integer parameter (like n = var('n'), then passing in n=2). Any 
tips?

On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote:

 On Mon, Jun 10, 2013 at 9:09 AM,  computati...@gmail.com javascript: 
 wrote: 
  Thanks, this is exactly what I was looking for! 
  
  In fact, I had tried out complex_plot but I must have been using a 
 different 
  color function or something, because the roots were much less apparent 
 to 
  me. Not sure why I couldn't figure this out on my own... 
  
  I suppose I have two follow-up questions now: 
  1. how can I improve the precision of the zero set (it seems to be drawn 
 in 
  low resolution right now) 

 Use plot_points: 

 f(z) = z - abs(z) 
 complex_plot(f, (-3,3), (-3,3), plot_points=200) 

  2. what is the best way to turn off the other colors (draw non-zeros 
 as 
  white) 

 I don't know if this is possible or implemented at present. 

  
  On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote: 
  
  On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote: 
   Suppose I have a complex function f(z) with a continuous family of 
 zeros 
   (e.g., f(z)=z-|z|) 
   
   Is there a way to easily plot the set of zeros of f in sage, 
 regardless 
   of how complicated the function f is? 
   
  
  You might find complex_plot useful.  For example, for 
  
  f(z) = z - abs(z) 
  complex_plot(f, (-3,3), (-3,3)) 
  
  you'll see a *black line* at the zero set of f(z). 
  
  In the notebook you mind find an interact like this useful: 
  
  
  z = var('z') 
  @interact 
  def _(f = z-abs(z), B=(2..10)): 
  show(complex_plot(f, (-B,B), (-B,B))) 
  
  Or just click on 
  
  http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674 
  
   -- 
   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 http://groups.google.com/group/sage-support?hl=en. 

   For more options, visit https://groups.google.com/groups/opt_out. 
   
   
  
  
  
  -- 
  William Stein 
  Professor of Mathematics 
  University of Washington 
  http://wstein.org 
  
  -- 
  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 javascript:. 
  To post to this group, send email to 
  sage-s...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sage-support?hl=en. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



 -- 
 William Stein 
 Professor of Mathematics 
 University of Washington 
 http://wstein.org 


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread computational . group
Okay, so the following works:

z = var('z')
n = 2
@interact
def _(f = ((z+1)^n-abs(z^n+1)), B=(2..10)):
show(complex_plot(f, (-B,B), (-B,B)))

But the following doesn't:

z = var('z')

@interact
def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)):
show(complex_plot(f, (-B,B), (-B,B)))

On Monday, June 10, 2013 11:33:01 AM UTC-5, William wrote:

 On Mon, Jun 10, 2013 at 9:24 AM,  computati...@gmail.com javascript: 
 wrote: 
  Ah, that's unfortunate. Might be a fun summer project to try to 
 implement, 
  if I knew where to start. 

 1. http://www.sagemath.org/development.html 

 2. SAGE_ROOT/devel/sage/sage/plot/complex_plot.pyx  which I found by 
 doing search_src('complex_plot') 

  On another note: I really like the @interact annotation. I'm messing 
 around 
  with it, because I would like to add another parameter to my plot - an 
  integer representing an index in a discrete family of functions. But I 
 keep 
  getting python errors about my expression not being symbolic when I try 
 to 
  include an integer parameter (like n = var('n'), then passing in n=2). 
 Any 
  tips? 

 Just put 

   n = 2 

 instead?  You have to post code for a more useful answer 

  
  On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote: 
  
  On Mon, Jun 10, 2013 at 9:09 AM,  computati...@gmail.com wrote: 
   Thanks, this is exactly what I was looking for! 
   
   In fact, I had tried out complex_plot but I must have been using a 
   different 
   color function or something, because the roots were much less 
 apparent 
   to 
   me. Not sure why I couldn't figure this out on my own... 
   
   I suppose I have two follow-up questions now: 
   1. how can I improve the precision of the zero set (it seems to be 
 drawn 
   in 
   low resolution right now) 
  
  Use plot_points: 
  
  f(z) = z - abs(z) 
  complex_plot(f, (-3,3), (-3,3), plot_points=200) 
  
   2. what is the best way to turn off the other colors (draw 
 non-zeros 
   as 
   white) 
  
  I don't know if this is possible or implemented at present. 
  
   
   On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote: 
   
   On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote: 
Suppose I have a complex function f(z) with a continuous family of 
zeros 
(e.g., f(z)=z-|z|) 

Is there a way to easily plot the set of zeros of f in sage, 
regardless 
of how complicated the function f is? 

   
   You might find complex_plot useful.  For example, for 
   
   f(z) = z - abs(z) 
   complex_plot(f, (-3,3), (-3,3)) 
   
   you'll see a *black line* at the zero set of f(z). 
   
   In the notebook you mind find an interact like this useful: 
   
   
   z = var('z') 
   @interact 
   def _(f = z-abs(z), B=(2..10)): 
   show(complex_plot(f, (-B,B), (-B,B))) 
   
   Or just click on 
   
   http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674 
   
-- 
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 
http://groups.google.com/group/sage-support?hl=en. 
For more options, visit https://groups.google.com/groups/opt_out. 


   
   
   
   -- 
   William Stein 
   Professor of Mathematics 
   University of Washington 
   http://wstein.org 
   
   -- 
   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 http://groups.google.com/group/sage-support?hl=en. 

   For more options, visit https://groups.google.com/groups/opt_out. 
   
   
  
  
  
  -- 
  William Stein 
  Professor of Mathematics 
  University of Washington 
  http://wstein.org 
  
  -- 
  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 javascript:. 
  To post to this group, send email to 
  sage-s...@googlegroups.comjavascript:. 

  Visit this group at http://groups.google.com/group/sage-support?hl=en. 
  For more options, visit https://groups.google.com/groups/opt_out. 
  
  



 -- 
 William Stein 
 Professor of Mathematics 
 University of Washington 
 http://wstein.org 


-- 
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 

Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread William Stein
On Mon, Jun 10, 2013 at 9:24 AM,  computational.gr...@gmail.com wrote:
 Ah, that's unfortunate. Might be a fun summer project to try to implement,
 if I knew where to start.

1. http://www.sagemath.org/development.html

2. SAGE_ROOT/devel/sage/sage/plot/complex_plot.pyx  which I found by
doing search_src('complex_plot')

 On another note: I really like the @interact annotation. I'm messing around
 with it, because I would like to add another parameter to my plot - an
 integer representing an index in a discrete family of functions. But I keep
 getting python errors about my expression not being symbolic when I try to
 include an integer parameter (like n = var('n'), then passing in n=2). Any
 tips?

Just put

  n = 2

instead?  You have to post code for a more useful answer


 On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote:

 On Mon, Jun 10, 2013 at 9:09 AM,  computati...@gmail.com wrote:
  Thanks, this is exactly what I was looking for!
 
  In fact, I had tried out complex_plot but I must have been using a
  different
  color function or something, because the roots were much less apparent
  to
  me. Not sure why I couldn't figure this out on my own...
 
  I suppose I have two follow-up questions now:
  1. how can I improve the precision of the zero set (it seems to be drawn
  in
  low resolution right now)

 Use plot_points:

 f(z) = z - abs(z)
 complex_plot(f, (-3,3), (-3,3), plot_points=200)

  2. what is the best way to turn off the other colors (draw non-zeros
  as
  white)

 I don't know if this is possible or implemented at present.

 
  On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote:
 
  On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote:
   Suppose I have a complex function f(z) with a continuous family of
   zeros
   (e.g., f(z)=z-|z|)
  
   Is there a way to easily plot the set of zeros of f in sage,
   regardless
   of how complicated the function f is?
  
 
  You might find complex_plot useful.  For example, for
 
  f(z) = z - abs(z)
  complex_plot(f, (-3,3), (-3,3))
 
  you'll see a *black line* at the zero set of f(z).
 
  In the notebook you mind find an interact like this useful:
 
 
  z = var('z')
  @interact
  def _(f = z-abs(z), B=(2..10)):
  show(complex_plot(f, (-B,B), (-B,B)))
 
  Or just click on
 
  http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674
 
   --
   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
   http://groups.google.com/group/sage-support?hl=en.
   For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 
  --
  William Stein
  Professor of Mathematics
  University of Washington
  http://wstein.org
 
  --
  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 http://groups.google.com/group/sage-support?hl=en.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 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?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread William Stein
Try this:

z,n = var('z,n')

@interact
def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)):
f = f.subs(n=n)
show(f)
show(complex_plot(f, (-B,B), (-B,B)))

On Mon, Jun 10, 2013 at 9:42 AM,  computational.gr...@gmail.com wrote:
 Okay, so the following works:


 z = var('z')
 n = 2
 @interact
 def _(f = ((z+1)^n-abs(z^n+1)), B=(2..10)):
 show(complex_plot(f, (-B,B), (-B,B)))

 But the following doesn't:


 z = var('z')

 @interact
 def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)):
 show(complex_plot(f, (-B,B), (-B,B)))

 On Monday, June 10, 2013 11:33:01 AM UTC-5, William wrote:

 On Mon, Jun 10, 2013 at 9:24 AM,  computati...@gmail.com wrote:
  Ah, that's unfortunate. Might be a fun summer project to try to
  implement,
  if I knew where to start.

 1. http://www.sagemath.org/development.html

 2. SAGE_ROOT/devel/sage/sage/plot/complex_plot.pyx  which I found by
 doing search_src('complex_plot')

  On another note: I really like the @interact annotation. I'm messing
  around
  with it, because I would like to add another parameter to my plot - an
  integer representing an index in a discrete family of functions. But I
  keep
  getting python errors about my expression not being symbolic when I try
  to
  include an integer parameter (like n = var('n'), then passing in n=2).
  Any
  tips?

 Just put

   n = 2

 instead?  You have to post code for a more useful answer

 
  On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote:
 
  On Mon, Jun 10, 2013 at 9:09 AM,  computati...@gmail.com wrote:
   Thanks, this is exactly what I was looking for!
  
   In fact, I had tried out complex_plot but I must have been using a
   different
   color function or something, because the roots were much less
   apparent
   to
   me. Not sure why I couldn't figure this out on my own...
  
   I suppose I have two follow-up questions now:
   1. how can I improve the precision of the zero set (it seems to be
   drawn
   in
   low resolution right now)
 
  Use plot_points:
 
  f(z) = z - abs(z)
  complex_plot(f, (-3,3), (-3,3), plot_points=200)
 
   2. what is the best way to turn off the other colors (draw
   non-zeros
   as
   white)
 
  I don't know if this is possible or implemented at present.
 
  
   On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote:
  
   On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote:
Suppose I have a complex function f(z) with a continuous family of
zeros
(e.g., f(z)=z-|z|)
   
Is there a way to easily plot the set of zeros of f in sage,
regardless
of how complicated the function f is?
   
  
   You might find complex_plot useful.  For example, for
  
   f(z) = z - abs(z)
   complex_plot(f, (-3,3), (-3,3))
  
   you'll see a *black line* at the zero set of f(z).
  
   In the notebook you mind find an interact like this useful:
  
  
   z = var('z')
   @interact
   def _(f = z-abs(z), B=(2..10)):
   show(complex_plot(f, (-B,B), (-B,B)))
  
   Or just click on
  
   http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674
  
--
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
http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
   
   
  
  
  
   --
   William Stein
   Professor of Mathematics
   University of Washington
   http://wstein.org
  
   --
   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
   http://groups.google.com/group/sage-support?hl=en.
   For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 
  --
  William Stein
  Professor of Mathematics
  University of Washington
  http://wstein.org
 
  --
  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 http://groups.google.com/group/sage-support?hl=en.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 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 

Re: [sage-support] Plot the zeros of a complex function

2013-06-10 Thread computational . group
Looks great, thanks for all the help!
I'll see about messing around with complex_plot a bit to support pure zero 
plots, if it amounts to something I'll get back in touch...

On Monday, June 10, 2013 11:55:28 AM UTC-5, William wrote:

 Try this: 

 z,n = var('z,n') 

 @interact 
 def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)): 
 f = f.subs(n=n) 
 show(f) 
 show(complex_plot(f, (-B,B), (-B,B))) 

 On Mon, Jun 10, 2013 at 9:42 AM,  computati...@gmail.com javascript: 
 wrote: 
  Okay, so the following works: 
  
  
  z = var('z') 
  n = 2 
  @interact 
  def _(f = ((z+1)^n-abs(z^n+1)), B=(2..10)): 
  show(complex_plot(f, (-B,B), (-B,B))) 
  
  But the following doesn't: 
  
  
  z = var('z') 
  
  @interact 
  def _(f = ((z+1)^n-abs(z^n+1)), n = (2..10), B=(2..10)): 
  show(complex_plot(f, (-B,B), (-B,B))) 
  
  On Monday, June 10, 2013 11:33:01 AM UTC-5, William wrote: 
  
  On Mon, Jun 10, 2013 at 9:24 AM,  computati...@gmail.com wrote: 
   Ah, that's unfortunate. Might be a fun summer project to try to 
   implement, 
   if I knew where to start. 
  
  1. http://www.sagemath.org/development.html 
  
  2. SAGE_ROOT/devel/sage/sage/plot/complex_plot.pyx  which I found by 
  doing search_src('complex_plot') 
  
   On another note: I really like the @interact annotation. I'm messing 
   around 
   with it, because I would like to add another parameter to my plot - 
 an 
   integer representing an index in a discrete family of functions. But 
 I 
   keep 
   getting python errors about my expression not being symbolic when I 
 try 
   to 
   include an integer parameter (like n = var('n'), then passing in 
 n=2). 
   Any 
   tips? 
  
  Just put 
  
n = 2 
  
  instead?  You have to post code for a more useful answer 
  
   
   On Monday, June 10, 2013 11:13:41 AM UTC-5, William wrote: 
   
   On Mon, Jun 10, 2013 at 9:09 AM,  computati...@gmail.com wrote: 
Thanks, this is exactly what I was looking for! 

In fact, I had tried out complex_plot but I must have been using a 
different 
color function or something, because the roots were much less 
apparent 
to 
me. Not sure why I couldn't figure this out on my own... 

I suppose I have two follow-up questions now: 
1. how can I improve the precision of the zero set (it seems to be 
drawn 
in 
low resolution right now) 
   
   Use plot_points: 
   
   f(z) = z - abs(z) 
   complex_plot(f, (-3,3), (-3,3), plot_points=200) 
   
2. what is the best way to turn off the other colors (draw 
non-zeros 
as 
white) 
   
   I don't know if this is possible or implemented at present. 
   

On Monday, June 10, 2013 10:02:12 AM UTC-5, William wrote: 

On Sun, Jun 9, 2013 at 3:25 PM,  computati...@gmail.com wrote: 
 Suppose I have a complex function f(z) with a continuous family 
 of 
 zeros 
 (e.g., f(z)=z-|z|) 
 
 Is there a way to easily plot the set of zeros of f in sage, 
 regardless 
 of how complicated the function f is? 
 

You might find complex_plot useful.  For example, for 

f(z) = z - abs(z) 
complex_plot(f, (-3,3), (-3,3)) 

you'll see a *black line* at the zero set of f(z). 

In the notebook you mind find an interact like this useful: 


z = var('z') 
@interact 
def _(f = z-abs(z), B=(2..10)): 
show(complex_plot(f, (-B,B), (-B,B))) 

Or just click on 


 http://sagecell.sagemath.org/?q=cdcdd7e5-73b4-4c87-87e2-1be300f86674 

 -- 
 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 
 http://groups.google.com/group/sage-support?hl=en. 
 For more options, visit 
 https://groups.google.com/groups/opt_out. 
 
 



-- 
William Stein 
Professor of Mathematics 
University of Washington 
http://wstein.org 

-- 
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 
http://groups.google.com/group/sage-support?hl=en. 
For more options, visit https://groups.google.com/groups/opt_out. 


   
   
   
   -- 
   William Stein 
   Professor of Mathematics 
   University of Washington 
   http://wstein.org 
   
   -- 
   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 
 

[sage-support] Plot zeros of complex function

2013-06-09 Thread computational . group
(I hope this isn't a double post - I just tried to post this question but 
it didn't show up, so I'm trying again)

How do you plot the zeros of a complex function in sage? For instance, I am 
interested in plotting the zero sets of some complex functions with a 
continuous family of zeros (i.e. f(z)=z-|z|), in a way that is independent 
of how complicated the expression for f(z) is.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-support] Plot the zeros of a complex function

2013-06-09 Thread computational . group
Suppose I have a complex function f(z) with a continuous family of zeros (e.g., 
f(z)=z-|z|)

Is there a way to easily plot the set of zeros of f in sage, regardless of how 
complicated the function f is?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-support] plot color computet by function

2012-08-24 Thread David Joyner
On Wed, Aug 22, 2012 at 12:15 PM, danjo86 dan...@sommerfeld-timmaspe.de wrote:
 Hey,

  i need some help. I try to definde the mandelbrotset with colors defined by 
 following function:

 sage: def mandel(x,y):
   v=[];c=x+y*i;z=c;v.append(z)
   for m in range(30):
   if abs(z)2:
   z=z^2+c;v.append(z);color=exp(-m)
   return color


I don't know the answer to your question but I don't see the purpose of
v.append(z);. Maybe it is a formatting issue that was lost in the email,
but it seems to play no role in your function. Or am I missing something?



 Then i typed: plot3d(0,(x,-2,2),(y,-2,2),rgbcolor=hue(mandel))

 Now i get TypeError?
 May anyone has an idea?

 Thanks for help
 Danjo

 --
 You received this message because you are subscribed to the Google Groups 
 sage-support group.
 To post to this group, send email to sage-support@googlegroups.com.
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] plot color computet by function

2012-08-22 Thread danjo86
Hey,

 i need some help. I try to definde the mandelbrotset with colors defined by 
following function: 

sage: def mandel(x,y):
  v=[];c=x+y*i;z=c;v.append(z)
  for m in range(30):
  if abs(z)2:
  z=z^2+c;v.append(z);color=exp(-m)
  return color

Then i typed: plot3d(0,(x,-2,2),(y,-2,2),rgbcolor=hue(mandel))

Now i get TypeError?
May anyone has an idea?

Thanks for help
Danjo

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Plot window in Sage

2012-07-05 Thread Carlos Baptista
I have a fairly simple question. 

Whenever I plot something in Sage, my plot is shown in Gwenview. Although I 
consider Gwenview to be a good app, I don't want it to be launched merely 
to show me a plot. Is there a way to configure Sage to use a simple window 
instead of an image viewer in order to present plots. I would like a simple 
window similar to what one would get from using the python package 
matplotlib.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Plot in Sage

2011-05-10 Thread Santanu Sarkar
How to plot
x^2 +y^2+z^2 =1 and x^2+y^2+2z^2 =1  where -1=x,y,z=1 in 3d?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Plot order in Graphics() object

2011-03-25 Thread Jeroen Demeyer
Hello sage-support,

Is there way to change the *order* that objects from a Graphics object
are plotted (i.e. the Z-order)?  Consider the following code in the
notebook for a 2D plot::

p1 = plot(sin, 0, 10, thickness=10, color='green')
p2 = polygon([(0,0), (10,0), (10,1), (0,1)], color='gray')
p3 = point((0,0), size=500)

When plotting p1+p2+p3 or p3+p2+p1 or whatever order, it seems that p3
is painted first, then p2 on top of that, then p3 on top of that.
So it seems that there is no way to plot a point inside a polygon,
because the polygon will always obscure the point.


Thanks,
Jeroen.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] plot(): no ticks and arrow on axes?

2011-01-31 Thread Renato Budinich
On Mon, Jan 31, 2011 at 12:48 AM, Francois Maltey fmal...@nerim.fr wrote:

 Renato a écrit :

  Hello, I can't understand how the ticks option works in plot()... I
 want to have no ticks or labels on the axis.

 Also, is it possible to show the arrows on the axis? like this:
 http://www.homeschoolmath.net/blog/few-complex-numbers.gif

 I'm using latest version of sage



 Search ticks and axes in plot? and copy/paste the examples :

 plot(sin(pi*x), (x, -8, 8), ticks=[[],[]], axes=false)
 + arrow((-8,0),(8,0), color=black)
 + arrow((0,-1),(0,1), color=black)


 If you want a grid add a function as

 def grid (xmin, xmax, ymin, ymax) :
   linesYcst = add (line ([(xmin, k), (xmax, k)]) for k in [ceil (ymin)..
 floor(ymax)])
   linesXcst = add (line ([(k, ymin), (k, ymax)]) for k in [ceil (xmin)..
 floor(xmax)])
   return linesXcst+linesYcst

 read the help about line2d? and find the right options !

 Then add to your (almost) last plot : + grid (the right area)

 F.




many thanks

renato

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] plot(): no ticks and arrow on axes?

2011-01-30 Thread Renato
Hello, I can't understand how the ticks option works in plot()... I
want to have no ticks or labels on the axis.

Also, is it possible to show the arrows on the axis? like this:
http://www.homeschoolmath.net/blog/few-complex-numbers.gif

I'm using latest version of sage

cheers
renato

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] plot(): no ticks and arrow on axes?

2011-01-30 Thread Francois Maltey

Renato a écrit :

Hello, I can't understand how the ticks option works in plot()... I
want to have no ticks or labels on the axis.

Also, is it possible to show the arrows on the axis? like this:
http://www.homeschoolmath.net/blog/few-complex-numbers.gif

I'm using latest version of sage
  


Search ticks and axes in plot? and copy/paste the examples :

plot(sin(pi*x), (x, -8, 8), ticks=[[],[]], axes=false)
+ arrow((-8,0),(8,0), color=black)
+ arrow((0,-1),(0,1), color=black)


If you want a grid add a function as

def grid (xmin, xmax, ymin, ymax) :
   linesYcst = add (line ([(xmin, k), (xmax, k)]) for k in [ceil 
(ymin).. floor(ymax)])
   linesXcst = add (line ([(k, ymin), (k, ymax)]) for k in [ceil 
(xmin).. floor(xmax)])

   return linesXcst+linesYcst

read the help about line2d? and find the right options !

Then add to your (almost) last plot : + grid (the right area)

F.


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] plot problem

2011-01-18 Thread Daniel Harris
Hello everybody

I am just looking at sketching graphs and I came across a problem that
has me stumped.  The graph I am trying to sketch is

(x-3) / ( (x+1) * (x-2) )

now I have plotted the graph in sage on my TI-83 and at wolfram and
they all different.  Now I am thinking is sage right and the others
wrong? or have I made an error inputting the equation?

I would certainly welcome some help on the issue

Thanks in advance

Dan

PS this is just for fun and not an exam piece or any test

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] plot problem

2011-01-18 Thread Robert Bradshaw
On Tue, Jan 18, 2011 at 2:35 PM, Daniel Harris
mail.dhar...@googlemail.com wrote:
 Hello everybody

 I am just looking at sketching graphs and I came across a problem that
 has me stumped.  The graph I am trying to sketch is

 (x-3) / ( (x+1) * (x-2) )

 now I have plotted the graph in sage on my TI-83 and at wolfram and
 they all different.  Now I am thinking is sage right and the others
 wrong? or have I made an error inputting the equation?

 I would certainly welcome some help on the issue

What range are you plotting over? -1  x  1? -5  x  5? This could
make a big difference on what the graph looks like. Likewise, what is
the scale of the y-axis? I don't think Sage yet tries to remove the
asymptotes at -1 and 2 from the plot.

- Robert

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] plot problem

2011-01-18 Thread Daniel Harris
On Tue, Jan 18, 2011 at 10:51 PM, Robert Bradshaw
rober...@math.washington.edu wrote:
 On Tue, Jan 18, 2011 at 2:35 PM, Daniel Harris
 mail.dhar...@googlemail.com wrote:
 Hello everybody

 I am just looking at sketching graphs and I came across a problem that
 has me stumped.  The graph I am trying to sketch is

 (x-3) / ( (x+1) * (x-2) )

 now I have plotted the graph in sage on my TI-83 and at wolfram and
 they all different.  Now I am thinking is sage right and the others
 wrong? or have I made an error inputting the equation?

 I would certainly welcome some help on the issue

 What range are you plotting over? -1  x  1? -5  x  5? This could
 make a big difference on what the graph looks like. Likewise, what is
 the scale of the y-axis? I don't think Sage yet tries to remove the
 asymptotes at -1 and 2 from the plot.


-1.5   x  3 the y peak at x=2 is the part that bothers me.  It
doesnt seem to show up on my calc or wolfram alpha?

Dan

 - Robert

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] plot 3d complex function

2010-09-03 Thread sps
Can I have a 3d plot graph about a complex funtion in sage?
For example:
f(z)=abs(1/(z-z0))?

I've just tried by the function complex_plot but output is 2d graph!
What command I have to use?
Thanks

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] plot

2010-04-22 Thread pallab
How to specify variables in a plot. Say I want something  like,

At=S*x
S=4
plot(At,0,2)

Question is that how to instruct Sage that I want to plot against 'x'.
In Mathematica this is conveniently done by

Plot[At,{x,0,2}]

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] plot

2010-04-22 Thread Mike Hansen
On Thu, Apr 22, 2010 at 2:46 AM, pallab pallabb...@gmail.com wrote:
 How to specify variables in a plot. Say I want something  like,

 At=S*x
 S=4
 plot(At,0,2)

Note that when you assign S=4 it doesn't change the value of S in At.


 Question is that how to instruct Sage that I want to plot against 'x'.
 In Mathematica this is conveniently done by

 Plot[At,{x,0,2}]

You can do this by

sage: var('S, x')
(S, x)
sage: At = S*x; At
S*x
sage: At.subs(S=4)
4*x
sage: plot(At.subs(S=4), (x,0,2))

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Plot problem: reduce() of empty sequence with no initial value

2010-03-31 Thread Jose Guzman

Hi everybody,

I am trying to plot a function called 'r' defined as :

sage: var('r,alpha,beta')
sage: r = alpha/(alpha + beta)

whose components are:

sage: r_alpha = 1.0/(1.7 + e**(-(x+28.2)/13.5) )
sage: r_beta = e**(-(x+63.0)/7.8) / e**(-(x+28.8)/13.1+1.7)

However if I try now to plot r as as function of these equations, for 
example as follows


sage: plot(r.subs(alpha = r_alpha, beta =r_beta),-100,100)

I get this error message:

sage: TypeError: reduce() or empty sequence with no initial value

Strange enough, I can plot both r_alpha and r_beta independently, and 
resolve/plot the function numerically. Moreover, if I substitute


sage: r_alpha = 1.0/(1.7 + e**(-(x+28.2)/13.5) ) # remove numerator
sage : r_alpha = (1.7 + e**(-(x+28.2)/13.5) )

I can plot the function r (obviously this is not the desired function). 
Does anybody has an idea about how to solve that?


--
José Guzmán
Physiologisches Institut der Universität Freiburg
Engesser Str. 4
Phone: +49-761-203-5165
Telefax: +49-761-203-5104
D-79108 Freiburg Germany

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

To unsubscribe, reply using remove me as the subject.


Re: [sage-support] plot/show bug in plotting of DiGraphs for macs?

2010-01-24 Thread Minh Nguyen
Hi David,

On Mon, Jan 25, 2010 at 11:08 AM, David Joyner wdjoy...@gmail.com wrote:

SNIP

 Is this a bug?

I don't think so. Using www.sagenb.org, I got plots [1] of the given
digraphs. On bsd.math, I got similar results [2]. In both cases, some
of the images are cropped so some part of a vertex is cut off. Ticket
#7299 [3] is meant to fix the image cropping issue.


[1] http://www.sagenb.org/home/pub/1409

[2] 
http://sage.math.washington.edu/home/mvngu/doc/screenshots/wdjoyner-2010-01-25/

[3] http://trac.sagemath.org/sage_trac/ticket/7299

-- 
Regards
Minh Van Nguyen

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Plot not working on Mac OS X 10.6.2

2009-12-12 Thread jason.t.stein
I recently installed Sage Version 4.2.1 on my MacBook Pro and while
basic symbolic and numeric computation work, simple plots like plot
(x^2, -5, 5) do not work. They don't even produce an error. Any
suggestions?

Thanks for you time.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] plot(from server)

2009-10-14 Thread Mikie

I want to include a simple plotting form in my server.  I noticed in
the notebook the plotting function creates an image.  It must save it
to the server then display it.

My output page displays strings
 request.write(p%s/p % part1)

Is there anyway to get it to display an image?
Thanx

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot function for x^(1/3)

2009-09-24 Thread Iskay

I wanted to plot x^(1/3) in sage. When I typed it on sage it returned
this.

f = x^(1/3)
plot(f)
verbose 0 (2999: plot.py, generate_plot_points) WARNING: When
plotting, failed to evaluate function at 100 points.
verbose 0 (2999: plot.py, generate_plot_points) Last error message:
'negative number to a fractional power not real'


And I only could see just one side of the graph.

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot a vertical label in the y axis and LaTeX typesetting.

2009-04-15 Thread Jose Guzman

Hi there

I am trying to teach some simple principles of single compartment models 
with sage and I plotted a couple of exponential equations in my notebook.

Although I got a nice x-axis () and other labels and similar things, I 
cannot find a way to plot the y-axis in the vertical axis. Is there 
anyway to do it?

You can take a look to my notebook to see what I mean 
http://sagenb.org/home/pub/457

Another additional problem is that the LaTeX fonts are pretty small, and 
I  cannot represent Greek letters (like alpha, tau, pi,etc..) in the 
labels (see the syntax bellow).

xlabel = text('Time (Units of $\tau$)',(3,-.10), rgbcolor='black')

This \tau does not show up in the graphic, but strange enough, this 
works out of the box (pretty small though)

lnlabel = text('Unrecoverable fraction ($f_{U} = 1 - 
f_{S}$)',(4,FS+.05),rgbcolor='black')

thank you very much in advance for your help and care!


Jose.

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] plot doesn't plot what I expect, can someone please explain why?

2009-03-08 Thread compound eye

hello

I expected the code below to plot a diagonal line from 0,0 to 2,2 then
a horizontal line from 2,2

but instead it plots a horizontal line starting at 0,2

x = var('x')

def splitTest(n):

if n  2:
return n
else:
return 2

plot(splitTest(x),0,4)


splitTest(1) returns 1 as expected

can anyone explain this to me?
cheers

Mathew
cheers

mathew
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot some function F(variable, constant)

2009-02-21 Thread hpon

Hello,

I have created a function F = F(x, const).  I would like to create a
2D-plot of F in some range of x.  What should the syntax look like?

Regards,
Peter
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot points wich solve an equitation

2009-01-06 Thread Fencer

Hi there,

Is it possible to plot points wich solve an certain equation (for
example x^2+y^2+z^2=1).
At the moment my idea is to give him f(x)=x for the x axis g(y)=y for
the y-axis and for the z axis I will give him 1 when x,y,z solves the
equitation.
My problem is that I don't know how to get the z-part working it
working.

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot axis tick interval

2008-12-01 Thread exty

Hi,

How can I change the distance between axis ticks when plotting in the
notebook. I want to plot a simple 2d graph where the tick interval
would be an integer, eg. 1.

For example:

p = plot(sin, [-10, 10])
p.axes_range(-10, 10, -10, 10)

Currently this will result in a plot where the interval is 2.5.

In gnuplot my request would be possible by using:
set xtics 1
set ytics 1

-exty

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot in spherical coordinates.

2008-11-23 Thread A.Z.

I want to plot a function in spherical coordinates (rho, phi, theta),
but i haven't found any examples in tutorial or reference manual. So,
how can i do it in sage?
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Plot in spherical coordinates.

2008-11-22 Thread A.Z.

I need to draw a plot in the spherical coordinate system, but I
haven't found any examples in tutorial or reference manual. So, is
there any way to do it in sage? And how to make grid in such kind of
plots?

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] plot problem with points and contours

2008-10-14 Thread Marshall Hampton

I am trying to do a demo for a class and I have encountered a strange
and very annoying error (or I am missing something).

If I do:
{{{
var('x,y')
f = (x^2+y^2)^(.5)
cp = contour_plot(f,(-3,3),(-4,4), fill=False, plot_points = 80, cmap
= 'winter', contours=srange(2.9,3.1,.1))
g = x^2/4+y^2/9-1
gp = implicit_plot(g,(-3,3),(-4,4), plot_points = 80)
pts = point2d([[0,3],[2,0],[-2,0],[0,-3]])
show(cp+gp+pts,figsize = [7*3/4,7])
}}}
then the points with positive coordinates seem misplaced by about 1/10
of a unit; they should be on the ellipse.

-M. Hampton
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] plot?? more informative?

2008-06-07 Thread tkeller

for me(linux ubuntu 8.04)  plot?? yields : arg is not a module,
class, method, function, traceback, frame, or code object
Source code for type plot? for help and examples not available.

Is there a simple way to get at this source?  Specifically I was
interested in making axes labels plot vertically when when
appropriate.   It may be that I have a broken build that is producing
this, so a simple confirmatory/denial report would be great.

regards,
thomas
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---