Hi Mat-Plotters,

I’m trying to modify the below code so that I can

set the initial conditions to (-1,0,0.5).

The code below randomly sets the initial conditions:

## ···

# I changed the equation – it’s not Lorenz.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, aa=1.1, yy=0.87):

“”“Compute the time-derivative of a Lorentz system.”""

return [y*(z-1+x*x)+yy*x, x*(3*z+1-x*x)+yy*y, -2*z*(aa+x*y)]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

**# Here’s the statement which assigns the initial conditions:**

x0 = -15 + 30 * np.random.random((N_trajectories, 3))

I tried simply doing this:

x0 = (-1,0,0.5)

but I get this error:

```
ValueError: need more than 1 value to unpack
```

```
```

```
What am I missing? What is the correct way to make the assignment?
```

```
```

```
Thanks!
```

```
```

```
--Prahas
```

```
```

Prahas,

You’re example is a little strange because when I set `x0 = (-1,0,0.5)`

, your function works fine on Python 2. Are you trying to set t0?

Note, your function does not compile on Python 3. You should try to be more explicit with that first argument in that function. For example, does the following do what you expect:

## ···

On Sun, Mar 29, 2015 at 1:07 PM, Prahas David Nafissian <prahas.music@…287…> wrote:

Hi Mat-Plotters,

I’m trying to modify the below code so that I can

set the initial conditions to (-1,0,0.5).

The code below randomly sets the initial conditions:

# I changed the equation – it’s not Lorenz.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, aa=1.1, yy=0.87):

“”“Compute the time-derivative of a Lorentz system.”""

return [y*(z-1+x*x)+yy*x, x*(3*z+1-x*x)+yy*y, -2*z*(aa+x*y)]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

**# Here’s the statement which assigns the initial conditions:**

x0 = -15 + 30 * np.random.random((N_trajectories, 3))

I tried simply doing this:

x0 = (-1,0,0.5)

but I get this error:

```
ValueError: need more than 1 value to unpack
```

```
```

```
What am I missing? What is the correct way to make the assignment?
```

```
```

```
Thanks!
```

```
```

```
--Prahas
```

```
```

Dive into the World of Parallel Programming The Go Parallel Website, sponsored

by Intel and developed in partnership with Slashdot Media, is your hub for all

things parallel software development, from weekly thought leadership blogs to

news, videos, case studies, tutorials and more. Take a look and join the

conversation now. http://goparallel.sourceforge.net/

Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hi,

For those of you following the trials and tribulations of moi,

I hacked the solution. The assignment is:

x0 = [ [-1.0,0.0,0.5] ]

I printed the orig x0. Printed mine. Noticed mine was missing

a set of brackets. Tried it. Success!

–Prahas

## ···

On Sun, Mar 29, 2015 at 10:07 AM, Prahas David Nafissian <prahas.music@…287…> wrote:

Hi Mat-Plotters,

I’m trying to modify the below code so that I can

set the initial conditions to (-1,0,0.5).

The code below randomly sets the initial conditions:

# I changed the equation – it’s not Lorenz.

N_trajectories = 1

def lorentz_deriv((x, y, z), t0, aa=1.1, yy=0.87):

“”“Compute the time-derivative of a Lorentz system.”""

return [y*(z-1+x*x)+yy*x, x*(3*z+1-x*x)+yy*y, -2*z*(aa+x*y)]

# Choose random starting points, uniformly distributed from -15 to 15

np.random.seed(1)

**# Here’s the statement which assigns the initial conditions:**

x0 = -15 + 30 * np.random.random((N_trajectories, 3))

I tried simply doing this:

x0 = (-1,0,0.5)

but I get this error:

```
ValueError: need more than 1 value to unpack
```

```
```

```
What am I missing? What is the correct way to make the assignment?
```

```
```

```
Thanks!
```

```
```

```
--Prahas
```

```
```