2
$\begingroup$

Update

Solve[N[Table[BernoulliB[n, z], {n, 10, 10}] == 0]]
{{z -> -0.5841145496910024` - 0.435309007896589` I}, <<4>>}

I am then finding and replacing z -> with blank to get :

{{-0.5841145496910024` - 0.435309007896589` I}, <<4>>}

I am then finding and replacing ` I} with } to get :

{{-0.5841145496910024`-0.435309007896589}, <<4>>}

I am then finding and replacing ' with , to get :

{{-0.5841145496910024, -0.435309007896589}, <<4>>}

My question is, is there a way of doing this without all of the find & replace business?


Old

I am generating a list from :

Solve[N[Table[BernoulliB[n, z], {n, 100, 100}] == 0]]

And then manually finding and replacing elements in the generated list such as z -> with Blank, then finding and replacing , I} with }, and so on. I am then producing a list plot form the resultant array. Is there a way of automating this process and producing a list plot directly?

$\endgroup$
  • 2
    $\begingroup$ What do you mean by " replacing , I} with },"? $\endgroup$ – Kuba Oct 17 '13 at 7:06
  • 1
    $\begingroup$ ({Re@z, Im@z} /. sol) // ListPlot ? $\endgroup$ – Kuba Oct 17 '13 at 7:28
  • 1
    $\begingroup$ Am I missing something: what's the purpose of using Table here? Why not just Solve[N@BernoulliB[10, z] == 0, z]? $\endgroup$ – murray Oct 17 '13 at 14:33
4
$\begingroup$

First part of your question is answered in What are the most common pitfalls awaiting new users?.

How to plot complex points is described for example here.

What you need is what was my guess:

sol = Solve[N[Table[BernoulliB[n, z], {n, 10, 10}] == 0]];

{Re@z, Im@z} /. sol // ListPlot

enter image description here

$\endgroup$
  • $\begingroup$ @ Kuba Many thanks! This has saved me a great deal of time! $\endgroup$ – martin Oct 17 '13 at 7:53
  • $\begingroup$ And congratulations on 10k. Really fast! $\endgroup$ – cormullion Oct 17 '13 at 7:56
  • $\begingroup$ @cormullion Thank you, I enjoy being here :) Fast?, take a look at ybeltukov's rate :P $\endgroup$ – Kuba Oct 17 '13 at 8:00
1
$\begingroup$

If you use David Park's Presentations add-on (http://home.comcast.net/~djmpark/DrawGraphicsPage.html), then there's no need for the artificial pulling apart of the complex roots into their real and imaginary parts; you can just treat complex numbers as complex numbers:

<< Presentations`

pts = z /. Solve[N@BernoulliB[10, z] == 0, z]
Draw2D[{PointSize[Medium], ComplexPoint /@ pts}, Axes -> True]

enter image description here

$\endgroup$
  • $\begingroup$ @ Murray Many thanks for your comment - will look into it. $\endgroup$ – martin Oct 17 '13 at 17:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.