2
$\begingroup$

I'm brand new to Mathematica and struggling figure this all out.

I made an interpolating function with the following (year, population) data. I'm trying to figure out what year the population reached certain amounts. I've Feel like I've tried just about everything except the right thing. I would appreciate any help.

PopData = {{1790, 3929214}, {1800, 5536631}, {1810, 7239881}, {1820, 9638453}, {1830, 12866020}, {1840, 17069453}, {1850, 23191876}, {1860, 31443321}, {1870, 38558371}, {1880, 49371340}, {1890, 62979766}, {1900, 76212168}, {1910, 92228496}, {1920, 106021537}, {1930, 123202624}, {1940, 132164569}, {1950, 151325798}, {1960, 179323175}, {1970, 203211926}, {1980, 226545805}, {1990, 248709873}, {2000, 281421906}, {2010, 309162581}, {2020, 331449281}};

ListPlot[PopData, PlotStyle -> Directive[Red, PointSize[0.02]], AxesLabel -> {Year, U . S . Population}, LabelStyle -> Directive[Black, Bold]]popfxn = Interpolation[PopData]

Plot[popfxn[x], {x, 1790, 2020}, AxesLabel -> {Year, U . S . Population}, LabelStyle -> Directive[Black, Bold]]

Show[ListPlot[PopData, PlotStyle -> Directive[Red, PointSize[0.02]]], Plot[popfxn[x], {x, 1790, 2020}], AxesLabel -> {Year, U . S . Population}, LabelStyle -> Directive[Black, Bold]]
$\endgroup$
3
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – LouisB
    Oct 15 at 8:50
  • $\begingroup$ You need to solve the equation popfxn[x]==pop0, try NSolve. $\endgroup$
    – Harry
    Oct 15 at 8:51
  • $\begingroup$ This question has answers here and here $\endgroup$
    – LouisB
    Oct 15 at 8:52
5
$\begingroup$

Simply reverse your data:

dat = {{1790, 3929214}, {1800, 5536631}, {1810, 7239881}, {1820, 
    9638453}, {1830, 12866020}, {1840, 17069453}, {1850, 
    23191876}, {1860, 31443321}, {1870, 38558371}, {1880, 
    49371340}, {1890, 62979766}, {1900, 76212168}, {1910, 
    92228496}, {1920, 106021537}, {1930, 123202624}, {1940, 
    132164569}, {1950, 151325798}, {1960, 179323175}, {1970, 
    203211926}, {1980, 226545805}, {1990, 248709873}, {2000, 
    281421906}, {2010, 309162581}, {2020, 331449281}};
int = Interpolation[Reverse /@ dat];

ListLinePlot[int]

enter image description here

$\endgroup$

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