# NestList with lower and upper limit

I'm creating a series of centered lines in {0,0} tilted from a set of angles.

The first angle is $30°$ and the last one is $110°$.

I want to control the number of lines between these two angles, but I can not use Subdivide because the angles are not evenly spaced.

The idea is that each angle has a relative proportion to the previous angle.

I did a test with $quant=20$:

ClearAll["Global*"]
quant = 20;
ang = NestList[#*1.067121 &, 30, quant]
p = FromPolarCoordinates[{5, # Degree}] &/@ ang // N;
Graphics[{Line[{{0, 0}, #}] & /@ p}]


And another test with $quant=10$:

ClearAll["Global*"]
quant = 10;
ang = NestList[#*1.138747 &, 30, quant]
p = FromPolarCoordinates[{5, # Degree}] &/@ ang // N;
Graphics[{Line[{{0, 0}, #}] & /@ p}]


In both codes I had to test the values $1.067121$ (First code) and $1.138747$ (Second code) to reach the last angle of $110°$.

Is there something in "NestList" that I can increase?

If you have another idea outside of that, it is also an option.

EDIT

I tried this and almost got it:

Solve[Last[NestList[#*coeff &,30,20]]==110,{coeff}]//N

• with Solve you should give the Reals domain argument, then select the positive result: Select[v /. Solve[Nest[#*v &, 30, 20] == 110, {v}, Reals], # > 0 &][[1]] // N – george2079 May 24 '17 at 20:17
• you can readily do this by hand though, with v = Exp[Log[110/30]/20] or even use ang = #1 Exp[Subdivide[#3] Log[#2/#1]] &[30, 110, 20] – george2079 May 24 '17 at 20:31

ClearAll[fun] ;
{ang, poi, lin},
ang = N[Map[Function[Rescale[Slot[1],{1,num},{30,110}]]][Range[num]]] ;
lin = Map[Function[Line[{{0.,0.},Slot[1]}]],poi]
] ;
Graphics[{Red,fun[2,1],Blue,fun[5,0.8],Green,fun[7,0.6]}]


• Image of output? – Michael E2 May 25 '17 at 11:00
• @MichaelE2, Done. Just noticed, this doesn't answer original question, sorry. Guess, this answer can be deleted. – I.M. May 25 '17 at 11:12
• Yeah, I was wondering if you got that. It's what I got, but sometimes there's an accidental mistake in the posted code. – Michael E2 May 25 '17 at 11:24

ClearAll["Global*"]
quant = 20;
ang = NestList[#*Exp[Log[110/30]/quant] &, 30, quant]
p = FromPolarCoordinates[{5, # Degree}] &/@ ang // N;
Graphics[{Line[{{0, 0}, #}] & /@ p}]

• @MichaelE2 I already did that, but I posted it wrong at the moment – LCarvalho May 25 '17 at 11:11

Another way:

Block[{quant = 20, a = 30., b = 110.},
ang = Exp[Log[a] + Log[b/a] Range[0., quant]/quant];
p = 5 Transpose@Through[{Cos, Sin}[ang Degree]];
lines = Transpose@ArrayReshape[p, Prepend[Dimensions@p, 2], 0.];
Graphics@Line@lines
]


Alternatives for ang and lines:

ang = Exp[Log[a] + Log[b/a] Range[0., quant]/quant]
ang = a (b/a)^(Range[0., quant]/quant)
ang = Array[Exp, quant + 1, Log@{a, b}]

lines = Transpose@ArrayReshape[p, Prepend[Dimensions@p, 2], 0.]
lines = Transpose[{ConstantArray[0., Dimensions@p], p}]
lines = Transpose[{0. p, p}]
`