Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6358

Questions on the manipulation of List objects in Mathematica, and the functions used for these manipulations.

4 votes

I wanna get a result of i/j . Like 1/3, 1/5, 1/7, 3/5, 3, 5/3... Something like that. But no...

How's this? range = {1, 3, 5, 7, 9}; DeleteCases[Flatten[Table[i/j, {i, range}, {j, range}]], 1] (* {1/3, 1/5, 1/7, 1/9, 3, 3/5, 3/7, 1/3, 5, 5/3, 5/7, 5/9, 7, 7/3, 7/5, 7/9, 9, 3, 9/5, 9/7} *)
Chris K's user avatar
  • 20.4k
7 votes
Accepted

Using lists for creating a bifurcation diagram of an iterative map

Here's one way, using Replace to wrap your points x with {r,x} and Table to iterate over r. res = Flatten[Table[ list = RecurrenceTable[{x[n] == r (x[n - 1] - x[n - 1]^3), x[1] == 0.5}, x, {n, 1, 2 …
Chris K's user avatar
  • 20.4k
1 vote

List positions without brackets

I think Sequence does the job for you: a[[Sequence @@ l[[1]]]] (* a11 *) Equivalently, without (most) brackets, call it Part: Part[a, Sequence @@ l[[1]]] (* a11 *)
Chris K's user avatar
  • 20.4k
1 vote
0 answers
70 views

Problem using ConstantArray in FindRoot

I ran into a strange problem, where using ConstantArray inside FindRoot results in a FindRoot::jsing error. Here's a minimal example, with the first instance working and the second failing: FindRoot …
Chris K's user avatar
  • 20.4k
17 votes
Accepted

Can't make more than 249 Internal`Bags in a Table

Seems to be the same underlying issue as here: by default, Table compiles its argument when the number of values is 250 or more. Evidently Internal`Bag doesn't like this! If all Internal`Bags are th …
Chris K's user avatar
  • 20.4k
13 votes
1 answer
197 views

Can't make more than 249 Internal`Bags in a Table

I need a lot of Internal`Bags so I made them with Table. It works fine for 249 or fewer Bags but goes horribly wrong for 250 or more: Table[Internal`Bag[0], {i, 249}] (* {Internal`Bag["<" 1 ">"], .. …
Chris K's user avatar
  • 20.4k
0 votes

ListLogPlot for positive and negative values

This could be made nicer, but how about something like this? GraphicsColumn[{ ListLogPlot[Select[xp, #[[2]] > 0 &], PlotRange -> {{0, 10}, All}, PlotRangePadding -> Scaled[.05]], ListLogPlot[A …
Chris K's user avatar
  • 20.4k
1 vote
Accepted

Table with the logarithmic step

Something like this? f[x_] := x^2; With[{x := 10^xp}, Table[{x, f[x]}, {xp, 0, 5}]] {{1, 1}, {10, 100}, {100, 10000}, {1000, 1000000}, {10000, 100000000}, {100000, 10000000000}}
Chris K's user avatar
  • 20.4k
1 vote

Incorrect results from simple `Plot`?

Another solution: increase the PlotPoints in testPlot2: testPlot1 = Plot[Log[HarmonicNumber[n]], {n, 1, 5}]; testPlot2 = Plot[Log[HarmonicNumber[n]], {n, 1, 43}, PlotPoints -> 100]; Show[testPlot1 …
Chris K's user avatar
  • 20.4k
2 votes

How to create a version of FixedPointList for asymptotically periodic functions?

My idea is to make a new function g that builds up a list of values, then use FixedPoint on g with a SameTest that looks for repeat values. First, a helper (since MemberQ wasn't checking for numerica …
Chris K's user avatar
  • 20.4k
7 votes

Plotting the number of fixed points of a system of two nonlinear differential equations

For this particular example you can find the bifurcations analytically by also setting the slopes of the isoclines to be equal. eq1 := x^2 + y + b; eq2 := x + y^2 - a; bif = Solve[{eq1 == 0, eq2 == 0 …
Chris K's user avatar
  • 20.4k
6 votes
4 answers
712 views

MaxDetect speed

What's the fastest way to find the local maxima of a 2D list? E.g. nx = ny = 100; dat = Table[Sin[2. \[Pi] x/nx] (0.1 + Cos[2. \[Pi] y/ny]), {y, 0, ny}, {x, 0, nx}]; ListPlot3D[dat] This (updat …
Chris K's user avatar
  • 20.4k
5 votes
Accepted

Using Manipulate to plot a function's time evolution

Not sure you know this, but if you use Plot you don't need to manually define the x-coordinates. Plot[Evaluate[Table[f[x, t], {t, 0, 0.9, 0.1}]], {x, -1, 1}] The Evaluate is only necessary to get …
Chris K's user avatar
  • 20.4k
2 votes
Accepted

ParametricNDSolve with a delay differential equation

I think the easiest way to get what you want is with Table: z0 = 1; ta = 0.01; ytotal[ta] = Table[z0 = y[z0, ta][T] /. sol, {i, 100}]; For those parameter values, it looks like the population quick …
Chris K's user avatar
  • 20.4k
9 votes

Sensitivity analysis of parameter on eigenvalues of predator-prey model

Here's a solution using my EcoEvo package, which is designed for just this kind of problem. First, install the package (only need to do this once): PacletInstall["EcoEvo", "Site" -> "http://raw.githu …
Chris K's user avatar
  • 20.4k

15 30 50 per page