12:00 AM
this took .16s on v9, .09s on v8 (from what I see in the notebook)
(I just ArrayPlot it by the way, any ideas for how to make it look nicer?)

Can you do it with PolarPlot[...] command?
Is the basic idea to generate the points with initial value z=0 then get tuples such as (0,1), (2,3.333) etc -- and then plot them on a plane?

@hhh apparently, but you need to make sure you are adding tuples the entries of which mean the same thing
(ie, vectors in the same basis)

@rm-rf What is block size? What does it mean?

12:18 AM
(p.s. I have no idea how to get the colors working... just trying random stuff)
@hhh I don't know. That is something to do with opencl, not mathematica related.

tasteful animated effort here
@rm-rf did not post it directly as it's really annoying...
always knew I should have become an interior decorator

@acl lol... more suited to my previous gravatar :P

@rm-rf I thought of that yes

(that's what I was gunning for, but ended up with a hodge podge of pink blue and black)

it's strange (and annoying) that the exact same code is almost twice as slow on 9 as on 8
it's compiled to C so maybe it's also a different version of gcc

12:28 AM
Hmm... Is this your code or Mark's?

mine

Ok, let me try it...

oh you have both?
Remove[mndCompld10];
mndCompld10 =
Compile[{{steps, _Integer}, {maxiter, _Integer}, {xmax, _Real}},
Module[{z, c, iters},
Table[
iters = 0.;
z = c = -xmax + 2.*xmax*n/steps - 0.5 +
I*(-xmax + 2.*xmax*m/steps);
While[(iters < maxiter) && (Abs@z < 2),
iters++;
z = z^2 + c
];
Sqrt[iters/maxiter],
{m, 1, steps}, {n, 1, steps}
]
],
{{z, _Complex}, {c, _Complex}},
CompilationTarget -> "C",
RuntimeOptions -> "Speed"
];
then
lst = mndCompld10[500, 200, 2]; // AbsoluteTiming

Takes roughly the same amount of time on both.

hm
OK then must be a gcc version issue
thanks

12:30 AM
Oh wait... no.
The code above is much faster in v8

ah. yes that is what I see

I have the same
It's 0.13 in V9 and 0.08 in V8

@rm-rf can you save the C code it outputs somewhere and send it to me somehow?
(guess you know how?)

@acl CompilePrint?

@rm-rf for instance yes
thanks

12:35 AM
On a similar token: Do you have any idea why the Sort command is about 50% slower on a Mac then on Windows? I have very similar specs machines but the windows one is always faster when it comes to Sort.

@rm-rf got it thanks

@Matariki Hmm... Leonid made a comment on that somewhere, but I don't know where. Let me try looking
(I don't remember if he mentioned the reason or just that this happened)

OK thanks
It's just as if it depends on the implementation of the OS
Mac and Linux seem to loose some ground there
I recently run even Benchmark and my impression got confirmed when I looked at the RandomSort times. While my mac is faster in every benchmark test but the Sort.

@rm-rf bytecode seems to be the same
oh well

12:43 AM
@Matariki Couldn't find it, sorry.

@acl bizarre!

@rm-rf Thanks for the effort!

@OleksandrR. maybe the C code is different, or maybe the way it's linked is different...

@acl btw, is there a way to generate a valid C file from the compiled function?

@rm-rf CUDAQ[] returns false?!

12:45 AM
@hhh Then your machine is not cuda enabled

@rm-rf compilable via the appropriate command line incantation, you mean?

@acl yes

@rm-rf did you see this: Compile/tutorial/CompilationTarget#136930869
it's more or less the kind of thing you'd write for librarylink

@rm-rf I see -- @acl mentioned this earlier. To acl, how did you get the Mandelbrot working? Without cuda?

niiice

12:48 AM
@hhh which mandelbrot?

cool :D

@rm-rf I have a color-cycling version of that, but thought I'd spare you :)

@acl Aha, thanks. That's what I was looking for (not that I know C or anything...)

@acl are you using Mark's code for plotting? mathematica.stackexchange.com/questions/20303/…

@hhh no. I am using the code I posted above
@hhh if you are just trying to learn about fractals and complex numbers, forget CUDA, opencl and compiling stuff to C like I did. just write it in straight mathematica

12:53 AM
this one? It does nothing for me yet...not yet sure where to put Monitor command to see its progress, wish some automatic running bar...

@hhh you have to plot it using ArrayPlot[lst] or so

@hhh as @Matariki wrote, this is an array of numbers
use ArrayPlot to visualise it.

I see -- I cannot yet undertsand the Compile command, CompilationTarget and Module etc -- reading manuals...have to begin somewhere :)

but please note, I wrote that code to win a bet for speed, not to be pretty or readable
then ignore compile. just write it in straight-up mathematica

How can I specify a complex number in Mathematica?
(apparently capital I preserved for imaginary part

1:05 AM
@hhh 1.+3.*I

I cannot understand yet why this outputs because the condition should not be accepted $n<1$.
It should output two different things but outputs the same thing, cannot yet understand.

@hhh the syntax is While[test,body] not While[test;body]
; is CompoundExpression, it's used to put lots of expressions in one expression and evaluate them in order, like a=1;b=2;c
and a==1 tests if a is 1, rather than setting it equal to 1
@hhh you probably want
z = 0; c = 1. + I; n = 1;
While[n < 1, z = z + c; Print[z]; n++]
but the body never executes because n<1 is never true (you set it to 1 just before)
@hhh how about looking at some basic tutorials in mathematica first? you're trying to learn mathematica and complex numbers at the same time, it's harder

1:26 AM
@acl and compile, openCL, cuda and mandelbrots :) I wish I could do that...

@rm-rf @hhh trying to do all this at once is just going to lead to frustration. when things don't work, what's wrong? the programming part or the mathematical part?

@acl Not to mention, creating Mandelbrots doesn't actually involve plotting complex numbers, which is what hhh says he wants to learn (I see above though that he needs to learn to work with complex numbers too)

@hhh you need to understand the difference between , and ;
you probably want to replace the first red comma with ; ( I haven't run your code). also, you're now multiplying While[] with l :)

I tried to return the list l...

1:35 AM
@hhh just take it one step at a time.
@hhh in that case you need a ; between the While[] and l

I thought you wrote that Mandelbrot code yourself in your question yesterday... I didn't know you blindly used acl's answer without understanding it. Had I known this I wouldn't have mentioned openCL.

Now trying to find a plotting command for complex numbers

@hhh You need to go through the docs in more detail... now it looks like you're just trying something at random — a Monte Carlo with System  functions, if you will — and seeing what works
When you get an error, click the >> for more details. It usually contains good info

Cool, did not know that...
I have tried to understand how to plot complex numbers on a plane when you have the set of points in $\mathbb C$ but this thread has over-complicated answers -- it has so much "extra things" without a small working example, anyone able to add it there would be greatly appreciated...

http://mathematica.stackexchange.com/questions/15637/plotting-an-argand-diagram

@hhh well, suppose I give you the complex number x+I*y with x and y real. you would like to plot a point at the cartesian point $(x,y)$, right?

1:50 AM
Yes

so, if z=x+I*y then Graphics[Point[Re@z,Im@z]] should do the job

Now I need to break the set such as {1+i,2+i} into Real={1,2} and Im={1,1}. And then Plot[Real,Im].

Plot doesn't work here
ok so, you have a list of complex numbers?

Yes

here you go
lst = RandomComplex[{-1 - I, 1 + I}, 20];
Graphics@Point[{Re@#, Im@#} & /@ lst]
there's other ways too

1:54 AM
Suppose I have a point (x,y)=(1,2). How can I get a plot with only this red point on the plot?

Graphics[Point[{x,y}]]
(you have no idea what all this means, do you?)
trust me, you will save yourself lots of frustration if you lay out what you need to learn, and do it systematically and one at a time

2:21 AM
z = 0; n = 0; l = {0};
While[n < 9, c = 1 + I; l = Join[l, {z}]; z = z^2 + c; n++];
l
Graphics@Point[{Re@#, Im@#} & /@ l]

They become extremely large points very fast causing overflow already with the condition n<100
...cannot yet see how to create the mandelbrot from this...but perhaps after I sleep over it...

lst = RandomComplex[{-1 - I, 1 + I}, 2000];
Graphics[{PointSize -> .00001, Point[{Re@#, Im@#} & /@ lst]}]
(use PointSize)
good luck!

3:04 AM
Text["\!(*SqrtBox[(x)])"] where can I find the tutorial/help page on these delimiters? I can F1 SqrtBox but I can't find info on the \!,\*,etc..

@AdamDreaver Why do you need them? You almost never have to ever deal with them. It's an internal representation, so not sure why you need it..

3:32 AM
@AdamDreaver \! is the marker for a string that contains boxes. Following is a RowBox delimited by $$ and $$. See e.g. tutorial/StringRepresentationOfBoxes

@rm-rf i got the code from a wolfram demo and it was written like that.
@OleksandrR. ty

3:54 AM
yup i'm able to emulate what the author did with just the math palette and the appropriate row/form functions.
no need for low level input.

@AdamDreaver That's what I was trying to say... it's quite easy to mess it up.

@rm-rf Don't know what the demo was coded like that, guess the author likes low level code...

Do you have a link to it?

ok it was user error
now looking at the code, I see it in the right form, but I did somethign when trying to look at it
where I was seeing the low level input code
DOH!
Oh i know what I did.
I copied as "input text"
Copying as cell expression fixed it.
Can I be passed the noob cap please?

Lol... I was just about to say that I don't see any such low level input in the code

2 hours later…
6:20 AM
Why does {-1,0} offset move my text to the right? I'm having trouble visualizing the coordinate system?

6:46 AM
@AdamDreaver the notation tells you which part of the text box gets put at the specified coordinate. you have to imagine the box is from {-1,-1} to {1,1}, so {-1,0} is the middle of the left edge
since the default is {0,0} (in the middle), moving to {-1,0} will shift relatively to the right

@Xerxes Enlightening!

7:09 AM
treating every text box like {-1,-1} to {1,1} does allow for some nice ideas. Like aligning all of your equals signs in the same column through splitting up your expressions strings and using the correct offsets. IT MAKES SENSE!

3 hours later…
10:20 AM
I cannot see how to create the Mandelbrot set

z = 0; n = 0; l = {0};
While[n < 9, c = 1 + I; l = Join[l, {z}]; z = z^2 + c; n++];

If n is very large, the numbers become too large -- impossible to calculate in practical time limits.

http://chat.stackexchange.com/transcript/message/8591306#8591306
It should be just $z=z^2+c$ where $z\in\mathbb C$.

11:08 AM
@hhh did you eg search on the internet for code that does this to see how that's dealt with?
did you even look at how my code you have been looking at deals with this?

11:22 AM
which code? The code with optimization for C? I am trying to learn things bottom up, one thing at a time... I can now understand the diverging/converging points: now have to store the speed of diverging with some radius for colors and find all C by which it does not diverge.

@hhh good tactic. but if you look at that, or any other code to construct mandelbrot sets, you'll see how your problem is dealt with

(yes but it takes so long time to dig into other people's writing...usually with much more extra...hence trying to keep things simple and stupid...)

8 hours later…
7:04 PM
> DSolve[\ddot\phi_2+\phi_2=-g_2p_1^2 \cos^2\tau+\omega_1p_1 cos\tau]

7:52 PM
Certainly every program understands Latex math

Please, can anyone help me with this... I'm trying to use @ to apply functions. I think sometimes it is visually cleaner this way. But how can I use @ with options? For example, what is the equivalent of Log[10,1] (the option here is the 10 bases) using @?

@rm-rf I had a chat with Todd yesterday and the distribution of the book is done via link that is published once Todd has added a copyright notice to the pages. I think that was one of the conditions MGH put on the 'deal'

@fcpenha The 10 is not an option, it is still an argument of the function
@fcpenha You can use Log @@ {10,1}, but that is silly. For two argument functions, using an infix notation might be cleaner. For instance, 10 ~Log~ 1. However, the simplest solution for this case would be to use the builtin Log10 and do Log10@1
@Matariki Excellent! Thanks to both of you!

Oh, thank you. And a function with options, what would be the syntax ?

@rm-rf No praise before the delivery ;-)

7:57 PM
@Matariki Haha, nevertheless, my thanks to your efforts, regardless of delivery status :)

For example, F[x, opt1] would be the same as F@x accompanied by what?

@fcpenha Options are entered as rules, so it would be F[x, opt1 -> value]
Certain named arguments can have default or optional values, but that is not the same as function options.

@rm-rf with opt1, I mean "option->choice of option". But ok, I think I understand it better now

@fcpenha nothing. This isn't possible to express in prefix form. Unless you want to put F[#,opts]&@x, but that gains you nothing

@fcpenha You can only enter 1 argument with F@x`

8:10 PM
@rm-rf Thank you a lot!

2 hours later…
9:59 PM
hhh
hahaha I just used hhh in an answer :) (function name)

10:17 PM
In the Doc I can see where I adjust a grid's item size, but how do I adjust the size of the grid and have each item automatically conform to the new cell size?
I want my grid to be the same width as the plot that's coupled with inside my parent grid.

3

This certainly doesn't provide an answer, but I thought it might prompt some more ideas. dotSizes = {20, 40, 20, 60, 30}; dots = Graphics[{Pink, Disk[]}, ImageSize -> #] & /@ dotSizes; dat = {{"Angel Falls", "17.7 m", "0.82", "9.2"}, {"Bridalveil Fall", "6.9 m", "0.94", "9.8"}, {"Ca...

@JacobAkkerboom Thanks jacob, I'll survey that for idears.

alright, good luck :)

10:52 PM
@AdamDreaver Hmm... is that a new Apple product for affection? ;)

11:26 PM
@rm-rf lol, you should get a job in iMarketing.

11:46 PM
Could someone explain the #...& notation?

NestWhile[#/2 &, 3*2*2^4*5, EvenQ]

Ah, look up Function
#/2& is the same as Function[#/2]

Verbeia, if you interested in functional programming, can I ask you what you think of mathematica.stackexchange.com/questions/21746/… ? I was so enthousiastic I can't sleep :P

No it is not -- & means assignment?!

@hhh huh? nono

11:50 PM
@hhh & means Function

Compare

#/2 &[1]
Function[#/2][1]

If you want

Assignment infers initialization...

haha what language are you talking about?
this evaluates as follows
(#+2#)&[1,100] ---- the slot (#) is replaced by the first argument provided (1)--->
(1+2*1)---->3

I cannot fully understand: what is f=(3+#);?

Hm note that f=3+# is very odd
I suppose you can give names to expressions with slots to later supply them to a function