Hi can u explain to me what "350/100, 348/100, 352/100" are for ? what do they do ?From http://reference.wolfram.com/mathematica/ref/FindRoot.html
click on "Details and Options" to see hidden under that it says
FindRoot[lhs==rhs {x,xstart, xmin, xmax}]
searches for a solution, stopping the search if x ever gets outside the range xmin to xmax.
Suggestion: Perhaps that line should be moved above Details and Options to be more visible because it is very often not found by users and is commonly needed.
When I look at the plot I see your function is smooth between 3.48 and 3.52 with a root between those.
This should only be used when you can see your function is well behaved between xmin and xmax and a solution will be simply found.
I use this to force FindRoot to only search very near to 3.5 and not accidentally begin looking for roots beyond 3.6 where it would become hopelessly confused and take forever.
If you replace 348/100 and 352/100 by 3.48 and 3.52 you will see Findroot begins with much less than 100 digits of precision.
348/100 and 352/100 have infinite precision. You could also use 3.48`100 and 3.52`100 to give 100 digits of precision.
Its getting stuck and not able to plot the function
Is the function too big for Mathematica to handle ?Perhaps it is busy calculating g. Perhaps it is busy calculating the plot.
Try this and see if it helps you determine where the time is being spent.
x = 1/2;
f = k*x*(1 - x);
For[i = 1, i < 2^4, i++, g = k*f*(1 - f); f = g];
Print["Finished calculating g, starting plot"];
Plot[g - 1/2, {k, 3.3, 3.7}, WorkingPrecision -> 100, PlotRange -> All]
Print["Finished plot, starting findroot"];
FindRoot[g - 1/2 == 0, {k, 350/100, 348/100, 352/100}, WorkingPrecision -> 100, StepMonitor :> Print[k]]
How fast is your computer? How much memory does your computer have? What version of Mathematica do you have?
If the time is taken by the plot then try reducing WorkingPrecision to 50 or even 20.
Very near 3.5, less than 3.6 this will not change the Plot substantially.
Beyond 3.6 more precision is required to see more accurate results.
If the Plot is still very slow try Plot from 0 to 3.55 and see if the plot above 3.6 is taking the time.
If the time is taken in FindRoot then again try reducing WorkingPrecision to 50 or even 20.
Then increase the WorkingPrecision gradually and see if the answer stays the same or if it changes.
If the answer changes then that is a warning for you to spend more time working on an accurate solution.