Re: [sage-support] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2014-04-21 Thread kcrisman
Hi, I've updated the ticket you created 
(http://trac.sagemath.org/ticket/14493) with some example.  Let us know if 
they correctly say the problems you had.  Also thanks also for the feedback 
on the devel guide - it's not "good" to hear, but it is good to know that 
even people who do know what vi and emacs are don't always find it easy to 
follow, so that we can keep trying to improve it.

- kcrisman

On Wednesday, April 17, 2013 3:13:12 PM UTC-4, Gary McConnell wrote:
>
> I am very keen to help - my problem is utter incompetence at following the 
> high-level instructions in the manual for developers. Also I am on the VM 
> and I cannot access the sage directories directly. Is there a way you could 
> send me a manual file that I could modify and send back to you? Sorry :( I 
> promise I will learn this one day ...
>
> the page I was referring to is
>
> http://www.sagemath.org/doc/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize
>
> Also there are presumably many functions to which this syntax difference 
> applies ... how can I find them?
>
> Thanks!
>
>
> On Wed, Apr 17, 2013 at 3:42 PM, P Purkayastha 
> > wrote:
>
>> On 04/17/2013 07:16 PM, Gary McConnell wrote:
>>
>>> Ah I see now that this is implicit in the docs example ... thank you ...
>>> should we perhaps point that out explicitly, since the very same
>>> function takes two rather different syntaxes? I am happy to write a
>>> small amendment to the page.
>>>
>>
>> You are welcome to improve the docs. If it was confusing to you it will 
>> be confusing to someone else too in the future. So, if you have some ideas 
>> how to fix/enhance the documentation, please go ahead and submit a patch. :)
>>
>>
>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "sage-support" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/
>> topic/sage-support/3mekDq5Stvk/unsubscribe?hl=en.
>> To unsubscribe from this group and all its topics, 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.
>>
>>
>>
>

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


Re: [sage-support] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-05-02 Thread P Purkayastha


On Friday, May 3, 2013 3:14:30 AM UTC+8, Gary McConnell wrote:
>
> hi Basu
>
> really sorry about this - I've just gotten around to trying this again - 
> but I am afraid I simply don't understand the most basic things of what I 
> have to do. You are right that indeed the patch file thingo seems to have 
> been created. So I went in search of these mysterious files and tried to 
> unpack the 5.8 stuff, but all it does is try to install it, which crashes 
> (please see attached screenshot) ... and obviously if I try to open the 
> .spkg thing itself inside an editor I just get utter gibberish ...
>

Oh. I never asked you to *install* it. I asked you to simply *unpack* it. 
Run the following command from outside your sage installation directory.

tar xvf /path/to/sage-5.8.spkg

Then you will see a sage-5.8 directory in the directory you are in.
 

>
> Also it has been over 20 years since I last used vi or emacs ... is there 
> a window-based OS X text editor for morons like me please? eg Can I just 
> use TextEdit? :)
>
> I hope I'm not depressing you with this as much as I am myself 
>
> Thanks again for all your kind help
>
> Gary
>
>
> On Sat, Apr 27, 2013 at 4:10 AM, P Purkayastha 
> > wrote:
>
>> On 04/26/2013 09:05 PM, Gary McConnell wrote:
>>
>>> Hi
>>>
>>> OK I have successfully raised trac tkt 14493, but that's about it. I'm
>>> afraid I am so unused to this stuff that I cannot even follow the
>>> instructions above. I tried to download 5.8 from that link, but it
>>> failed to install. But I'm not even sure I was meant to install it! ie
>>> maybe I just need the code stored somewhere - not sure what you meant
>>> ... (I already have 5.7 working in this machine). I set up the file from
>>> step 2, and then from step 4 I changed directory to Applications/sage
>>> but Applications/sage/sage is a file not a directory. So I ran "./sage
>>> -hg qnew 14493_documentation.patch" and it quietly blinked for a second
>>> and then gave me a new command line - apparently doing absolutely
>>> nothing! So when you say hack hack hack etc :) I am not sure what I am
>>> supposed to be hacking!!
>>>
>>> Sorry if this is moronic, but I'll get there eventually 
>>>
>>
>> Hello,
>>   No, I outlined the instructions below if you don't want to install the 
>> sage source. After the step 4 ii) you will get no output. But you can check 
>> that the patch file has been created by using the command
>>
>> /path/to/sage -hg qser
>>
>> Note that I wrote /path/to/sage because it is supposed to be the sage 
>> script from your existing sage installation, NOT the unpacked sage-5.8 
>> directory.
>>
>> By "hack hack", I meant that you just carry on with the changes you want 
>> to perform on the actual files. The hg will keep track of the changes. You 
>> can see a diff of the changes when you run the command
>>
>> /path/to/sage -hg qdiff
>>
>> Hope that helps,
>>   basu.
>>
>>  
>>> If you don't want to install the sage from source, you can download
>>> the sage spkg and work with that.  This is OK since you intend to do
>>> only documentation changes. In this case, follow the steps below:
>>>
>>> 1. download the sage spkg from
>>> http://www.sagemath.org/__packages/standard/sage-5.8.__spkg
>>>
>>> 
>>> This contains the source code.
>>>
>>> 2. Create a file in $HOME/.hgrc containing your name as mentioned 
>>> here:
>>> http://www.sagemath.org/doc/__developer/producing_patches.__html
>>>
>>> 
>>>
>>> 3. Open a ticket in trac so that you can get the ticket number.
>>> Let's say the number is 12345.
>>>
>>> 4. Use the inbuilt mercurial inside Sage to create the patch.
>>>   i) First change directory to the unpacked sage/sage directory
>>> ii) Next, run the command (where /path/to/sage is where the sage
>>> script is present and 12345 is the ticket number)
>>> /path/to/sage -hg qnew 12345_documentation.patch
>>> iii) Hack hack hack and make your changes :)
>>> You will need to follow the developer documentation for syntax and
>>> formatting.
>>> iv) Now that you are satisfied with your changes, run
>>> /path/to/sage -hg qref -m "a one line description of your changes"
>>> v) Make hg generate the patch:
>>> /path/to/sage -hg export qtip > ~/$(/path/to/sage -hg qtop)
>>>
>>> 5. Go back to the ticket and upload the patch that is present at
>>> ~/12345_documentation.patch
>>>
>>> Hopefully, this procedure will become much simpler after the move to
>>> git, since trivial changes can be made directly in github (if the
>>> project remains hosted in github).
>>>
>>>
>>> --
>>> You received this message because you are subscribed to a topic in
>>> the Google Groups "sage-support" group.
>>> To unsubscribe from this topic, visit
>>> 
>>> https://groups.google.com/d/__topic/sage-suppor

Re: [sage-support] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-26 Thread Gary McConnell
Hi

OK I have successfully raised trac tkt 14493, but that's about it. I'm
afraid I am so unused to this stuff that I cannot even follow the
instructions above. I tried to download 5.8 from that link, but it failed
to install. But I'm not even sure I was meant to install it! ie maybe I
just need the code stored somewhere - not sure what you meant ... (I
already have 5.7 working in this machine). I set up the file from step 2,
and then from step 4 I changed directory to Applications/sage but
Applications/sage/sage is a file not a directory. So I ran "./sage -hg qnew
14493_documentation.patch" and it quietly blinked for a second and then
gave me a new command line - apparently doing absolutely nothing! So when
you say hack hack hack etc :) I am not sure what I am supposed to be
hacking!!

Sorry if this is moronic, but I'll get there eventually 


On Sat, Apr 20, 2013 at 6:00 PM, P Purkayastha  wrote:

> On 04/18/2013 03:13 AM, Gary McConnell wrote:
>
>> I am very keen to help - my problem is utter incompetence at following
>> the high-level instructions in the manual for developers. Also I am on
>> the VM and I cannot access the sage directories directly. Is there a way
>> you could send me a manual file that I could modify and send back to
>> you? Sorry :( I promise I will learn this one day ...
>>
>> the page I was referring to is
>> http://www.sagemath.org/doc/**reference/numerical/sage/**
>> numerical/optimize.html#sage.**numerical.optimize.minimize
>>
>> Also there are presumably many functions to which this syntax difference
>> applies ... how can I find them?
>>
>> Thanks!
>>
>
> I failed to notice this reply earlier.
>
> I think it is better if you can submit a patch to trac. The patch is
> generated by mercurial and it can automatically populate the author
> attribution and other information. These information is used by a patchbot
> that automatically tests the patches for validity and performs other tests.
>
> To generate the patch, you can either install the sage library code.
>
> If you don't want to install the sage from source, you can download the
> sage spkg and work with that.  This is OK since you intend to do only
> documentation changes. In this case, follow the steps below:
>
> 1. download the sage spkg from http://www.sagemath.org/**
> packages/standard/sage-5.8.**spkg
> This contains the source code.
>
> 2. Create a file in $HOME/.hgrc containing your name as mentioned here:
> http://www.sagemath.org/doc/**developer/producing_patches.**html
>
> 3. Open a ticket in trac so that you can get the ticket number. Let's say
> the number is 12345.
>
> 4. Use the inbuilt mercurial inside Sage to create the patch.
>  i) First change directory to the unpacked sage/sage directory
> ii) Next, run the command (where /path/to/sage is where the sage script is
> present and 12345 is the ticket number)
> /path/to/sage -hg qnew 12345_documentation.patch
> iii) Hack hack hack and make your changes :)
> You will need to follow the developer documentation for syntax and
> formatting.
> iv) Now that you are satisfied with your changes, run
> /path/to/sage -hg qref -m "a one line description of your changes"
> v) Make hg generate the patch:
> /path/to/sage -hg export qtip > ~/$(/path/to/sage -hg qtop)
>
> 5. Go back to the ticket and upload the patch that is present at
> ~/12345_documentation.patch
>
> Hopefully, this procedure will become much simpler after the move to git,
> since trivial changes can be made directly in github (if the project
> remains hosted in github).
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/sage-support/**3mekDq5Stvk/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscribe@**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
> .
>
>
>

-- 
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] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-21 Thread Gary McConnell
Dear @ppurka

thanks so much - i am now finally back at home with my trusty Macs and
hopefully will be able to do the above, eventually  :)

For me this is entering an exciting new phase! Thanks again.

Best regards

Gary


On Sat, Apr 20, 2013 at 6:00 PM, P Purkayastha  wrote:

> On 04/18/2013 03:13 AM, Gary McConnell wrote:
>
>> I am very keen to help - my problem is utter incompetence at following
>> the high-level instructions in the manual for developers. Also I am on
>> the VM and I cannot access the sage directories directly. Is there a way
>> you could send me a manual file that I could modify and send back to
>> you? Sorry :( I promise I will learn this one day ...
>>
>> the page I was referring to is
>> http://www.sagemath.org/doc/**reference/numerical/sage/**
>> numerical/optimize.html#sage.**numerical.optimize.minimize
>>
>> Also there are presumably many functions to which this syntax difference
>> applies ... how can I find them?
>>
>> Thanks!
>>
>
> I failed to notice this reply earlier.
>
> I think it is better if you can submit a patch to trac. The patch is
> generated by mercurial and it can automatically populate the author
> attribution and other information. These information is used by a patchbot
> that automatically tests the patches for validity and performs other tests.
>
> To generate the patch, you can either install the sage library code.
>
> If you don't want to install the sage from source, you can download the
> sage spkg and work with that.  This is OK since you intend to do only
> documentation changes. In this case, follow the steps below:
>
> 1. download the sage spkg from http://www.sagemath.org/**
> packages/standard/sage-5.8.**spkg
> This contains the source code.
>
> 2. Create a file in $HOME/.hgrc containing your name as mentioned here:
> http://www.sagemath.org/doc/**developer/producing_patches.**html
>
> 3. Open a ticket in trac so that you can get the ticket number. Let's say
> the number is 12345.
>
> 4. Use the inbuilt mercurial inside Sage to create the patch.
>  i) First change directory to the unpacked sage/sage directory
> ii) Next, run the command (where /path/to/sage is where the sage script is
> present and 12345 is the ticket number)
> /path/to/sage -hg qnew 12345_documentation.patch
> iii) Hack hack hack and make your changes :)
> You will need to follow the developer documentation for syntax and
> formatting.
> iv) Now that you are satisfied with your changes, run
> /path/to/sage -hg qref -m "a one line description of your changes"
> v) Make hg generate the patch:
> /path/to/sage -hg export qtip > ~/$(/path/to/sage -hg qtop)
>
> 5. Go back to the ticket and upload the patch that is present at
> ~/12345_documentation.patch
>
> Hopefully, this procedure will become much simpler after the move to git,
> since trivial changes can be made directly in github (if the project
> remains hosted in github).
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/sage-support/**3mekDq5Stvk/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscribe@**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
> .
>
>
>

-- 
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] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-17 Thread Gary McConnell
I am very keen to help - my problem is utter incompetence at following the
high-level instructions in the manual for developers. Also I am on the VM
and I cannot access the sage directories directly. Is there a way you could
send me a manual file that I could modify and send back to you? Sorry :( I
promise I will learn this one day ...

the page I was referring to is
http://www.sagemath.org/doc/reference/numerical/sage/numerical/optimize.html#sage.numerical.optimize.minimize

Also there are presumably many functions to which this syntax difference
applies ... how can I find them?

Thanks!


On Wed, Apr 17, 2013 at 3:42 PM, P Purkayastha  wrote:

> On 04/17/2013 07:16 PM, Gary McConnell wrote:
>
>> Ah I see now that this is implicit in the docs example ... thank you ...
>> should we perhaps point that out explicitly, since the very same
>> function takes two rather different syntaxes? I am happy to write a
>> small amendment to the page.
>>
>
> You are welcome to improve the docs. If it was confusing to you it will be
> confusing to someone else too in the future. So, if you have some ideas how
> to fix/enhance the documentation, please go ahead and submit a patch. :)
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/sage-support/**3mekDq5Stvk/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscribe@**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
> .
>
>
>

-- 
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] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-17 Thread Gary McConnell
Ah I see now that this is implicit in the docs example ... thank you ...
should we perhaps point that out explicitly, since the very same function
takes two rather different syntaxes? I am happy to write a small amendment
to the page.


On Wed, Apr 17, 2013 at 1:09 PM, P Purkayastha  wrote:

> On 04/17/2013 07:05 PM, Gary McConnell wrote:
>
>> OK I have now uncovered another weird sage-python problem. I think I
>> should be the go-to guy to wreck otherwise perfectly healthy code :).
>>
>> If you try to use the function minimize() with the python function
>> @ppurka defined above then you get the error
>>
>> TypeError: g() takes exactly 2 arguments (1 given)
>>
>>
>> whereas if I try to do the minimize using a SAGE function as per my
>> original message, we get back to the same "coercion to real" problem.
>> Here is some dumb code to show the problem:
>>
>> vars = var('x y')
>> def gg(x,y): return sin(x) + cos(y)
>> minimize(gg,[0,0])
>>
>> gives the above error; whereas:
>>
>> vars = var('x y')
>> gg = sin(x) + cos(y)
>> minimize(gg,[0,0])
>>
>> works fine  I cannot see anywhere in the reference manual where the
>> syntax for minimize() for python functions, should be different from
>> that for SAGE functions right?!
>>
>> Kind regards
>>
>> Gary
>>
>
> Hello Gary,
>
>   The minimize function takes in a function which has only *one* argument.
> That argument itself can be tuple or list. So, this very simple
> modification to your code works:
>
> sage: def gg(x): return sin(x[0]) + cos(x[1])
> sage: minimize(gg,[0,0])
> Optimization terminated successfully.
>  Current function value: -2.00
>  Iterations: 72
>  Function evaluations: 139
> (-1.5707636272, 3.14159570731)
>
>   basu.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/**
> topic/sage-support/**3mekDq5Stvk/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscribe@**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
> .
>
>
>

-- 
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] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-17 Thread Gary McConnell
OK I have now uncovered another weird sage-python problem. I think I should
be the go-to guy to wreck otherwise perfectly healthy code :).

If you try to use the function minimize() with the python function @ppurka
defined above then you get the error

TypeError: g() takes exactly 2 arguments (1 given)


whereas if I try to do the minimize using a SAGE function as per my
original message, we get back to the same "coercion to real" problem. Here
is some dumb code to show the problem:

vars = var('x y')
def gg(x,y): return sin(x) + cos(y)
minimize(gg,[0,0])

gives the above error; whereas:

vars = var('x y')
gg = sin(x) + cos(y)
minimize(gg,[0,0])

works fine  I cannot see anywhere in the reference manual where the
syntax for minimize() for python functions, should be different from that
for SAGE functions right?!

Kind regards

Gary

PS using SAGE 5.7 on VM version 4.2.10 on Windows 7 on an HP notebook


On Wed, Apr 17, 2013 at 11:11 AM, Gary McConnell  wrote:

> Sorry - at ease ...
>
> If I name the plot PP or something then put just 'PP' in a different cell
> from its definition, it shows up fine.
>
> Thanks again for the help
>
> Kind regards
>
> Gary
>
>
> On Wed, Apr 17, 2013 at 10:39 AM, GaryMak wrote:
>
>> Hi @ppurka - thank you very much as I would never have thought of that! -
>> that certainly fixes the crashing problem - but I now have an even more
>> bizarre problem, which is that plot3d does literally nothing! I have
>> re-booted everything but it makes no difference. Here is my code:
>>
>> s = 4
>> a=1/s
>> b=1/s
>> c=1/s
>> d=i/s
>> theta, phi = var('theta,phi')
>> def f(theta,phi): return ( (a*exp(i*theta)-1)*d*exp(i*phi) -
>> (b*exp(i*phi)-1)*c*exp(i*theta) ) . abs()
>> plot3d(f,(theta,0,pi),(phi,0,pi))
>>
>> I know that plot3d works in the same notebook() session say on examples
>> from the SAGE Reference manual, and the function f as you defined it also
>> works fine on individual (pairs of) angles ... does this code work on your
>> computer?
>>
>> Thanks again
>>
>>
>>
>>
>> On Wednesday, April 17, 2013 2:54:35 AM UTC+2, P Purkayastha wrote:
>>>
>>> On 04/16/2013 09:57 PM, GaryMak wrote:
>>> > Hi
>>> >
>>> > I am trying to use plot functions for the first time in sage -
>>> apologies
>>> > if this is a dumb question for a change.
>>> >
>>> > I have a square matrix M of fixed complex numbers which are then all
>>> > multiplied by a different phase depending on which column they are in.
>>> > (In the 2x2 example below M=[a,b;c,d] and column 1 is multiplied by
>>> > exp(i*theta) and column 2 is multiplied by exp(i*phi) ). I then take
>>> > another fixed matrix A away from M and take f=det(M-A).abs() as my
>>> > output. I have explicitly written this formula for A = [1,1;0,0]
>>> below.
>>> > So the function I would like to plot is f as a function of theta and
>>> phi
>>> > (in this case).
>>> >
>>> > a = 1/2
>>> > b = - i/3
>>> > c = 1/4
>>> > d = i/5
>>> > theta, phi = var('theta,phi')
>>> > f(theta,phi) = ( (a*exp(i*theta)-1)*d*exp(i***phi) -
>>> > (b*exp(i*phi)-1)*c*exp(i***theta) ) . abs()
>>> > plot3d(f, (theta,0,pi), (phi,0,pi))
>>> >
>>> > No matter how I try to do this, even if I explicitly write out the
>>> > complex conjugates of each element, I get what for me is a
>>> record-length
>>> > screed of error stuff ending in 'TypeError: unable to coerce to a real
>>> > number', originating in the command 'plot3d(...etc...)'. I have
>>> attached
>>> > a text file with the full output of one of my attempts.
>>> >
>>> > I can see that in a way I am asking a lot of the interpreter; but then
>>> > again I feel I have explicitly made the thing real by the time it gets
>>> > to be an input for the plot3d function.
>>> >
>>> > Is there any way around this, or do I have to start writing complexes
>>> as
>>> > a+bi etc and do it the hard way?
>>> >
>>> > Many thanks
>>> >
>>> > Gary
>>>
>>> The problem is actually in the conversion of your function to a
>>> fast_float() version of the function. Apparently, it fails for symbolic
>>> "complex" functions (which are not really complex) even in this trivial
>>> example:
>>>
>>> f(theta, phi) = (theta + i * phi).abs()
>>> ff = fast_float(f, 'theta', 'phi')
>>>
>>> One trivial workaround is to define your function to be a python
>>> function. Somehow, it works. :)
>>>
>>> def f(theta,phi): return ( (a*exp(i*theta)-1)*d*exp(i***phi) -
>>> (b*exp(i*phi)-1)*c*exp(i***theta) ) . abs()
>>>
>>> plot3d(f, (theta, 0, pi), (phi, 0, phi))
>>>
>>>
>>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "sage-support" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/sage-support/3mekDq5Stvk/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, 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

Re: [sage-support] Re: plot3d using real-valued real-parameter functions but involving complex numbers as intermediates

2013-04-17 Thread Gary McConnell
Sorry - at ease ...

If I name the plot PP or something then put just 'PP' in a different cell
from its definition, it shows up fine.

Thanks again for the help

Kind regards

Gary


On Wed, Apr 17, 2013 at 10:39 AM, GaryMak wrote:

> Hi @ppurka - thank you very much as I would never have thought of that! -
> that certainly fixes the crashing problem - but I now have an even more
> bizarre problem, which is that plot3d does literally nothing! I have
> re-booted everything but it makes no difference. Here is my code:
>
> s = 4
> a=1/s
> b=1/s
> c=1/s
> d=i/s
> theta, phi = var('theta,phi')
> def f(theta,phi): return ( (a*exp(i*theta)-1)*d*exp(i*phi) -
> (b*exp(i*phi)-1)*c*exp(i*theta) ) . abs()
> plot3d(f,(theta,0,pi),(phi,0,pi))
>
> I know that plot3d works in the same notebook() session say on examples
> from the SAGE Reference manual, and the function f as you defined it also
> works fine on individual (pairs of) angles ... does this code work on your
> computer?
>
> Thanks again
>
>
>
>
> On Wednesday, April 17, 2013 2:54:35 AM UTC+2, P Purkayastha wrote:
>>
>> On 04/16/2013 09:57 PM, GaryMak wrote:
>> > Hi
>> >
>> > I am trying to use plot functions for the first time in sage -
>> apologies
>> > if this is a dumb question for a change.
>> >
>> > I have a square matrix M of fixed complex numbers which are then all
>> > multiplied by a different phase depending on which column they are in.
>> > (In the 2x2 example below M=[a,b;c,d] and column 1 is multiplied by
>> > exp(i*theta) and column 2 is multiplied by exp(i*phi) ). I then take
>> > another fixed matrix A away from M and take f=det(M-A).abs() as my
>> > output. I have explicitly written this formula for A = [1,1;0,0] below.
>> > So the function I would like to plot is f as a function of theta and
>> phi
>> > (in this case).
>> >
>> > a = 1/2
>> > b = - i/3
>> > c = 1/4
>> > d = i/5
>> > theta, phi = var('theta,phi')
>> > f(theta,phi) = ( (a*exp(i*theta)-1)*d*exp(i***phi) -
>> > (b*exp(i*phi)-1)*c*exp(i***theta) ) . abs()
>> > plot3d(f, (theta,0,pi), (phi,0,pi))
>> >
>> > No matter how I try to do this, even if I explicitly write out the
>> > complex conjugates of each element, I get what for me is a
>> record-length
>> > screed of error stuff ending in 'TypeError: unable to coerce to a real
>> > number', originating in the command 'plot3d(...etc...)'. I have
>> attached
>> > a text file with the full output of one of my attempts.
>> >
>> > I can see that in a way I am asking a lot of the interpreter; but then
>> > again I feel I have explicitly made the thing real by the time it gets
>> > to be an input for the plot3d function.
>> >
>> > Is there any way around this, or do I have to start writing complexes
>> as
>> > a+bi etc and do it the hard way?
>> >
>> > Many thanks
>> >
>> > Gary
>>
>> The problem is actually in the conversion of your function to a
>> fast_float() version of the function. Apparently, it fails for symbolic
>> "complex" functions (which are not really complex) even in this trivial
>> example:
>>
>> f(theta, phi) = (theta + i * phi).abs()
>> ff = fast_float(f, 'theta', 'phi')
>>
>> One trivial workaround is to define your function to be a python
>> function. Somehow, it works. :)
>>
>> def f(theta,phi): return ( (a*exp(i*theta)-1)*d*exp(i***phi) -
>> (b*exp(i*phi)-1)*c*exp(i***theta) ) . abs()
>>
>> plot3d(f, (theta, 0, pi), (phi, 0, phi))
>>
>>
>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/3mekDq5Stvk/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, 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.
>
>
>

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