user29774: Regarding the following code:
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); 
ax = map(ax, -17000, 17000, -1500, 1500);

I know the reason for taking 17000 as value - that's 1g.  But I am not getting how and why 1500 value is taken.

user16085: The map() function is well explained here.
In short, it maps one range of numbers to another.  In this case it will map ax from the range (-17000:17000) into the range (-1500:1500).
Imagine a ruler with both inches and cm on.  If you have a measurement in inches, you can represent that same measurement (point on the ruler) in cm.  Your "ruler" here has one scale ranging from -17000 to 17000, and another scale ranging from -1500 to 1500.  You're finding the reading on the second side at the point ax on the first.
If you mean specifically why are those numbers used -- then I have no idea since you give no context.

29774: <p>Regarding the following code:</p>

<pre><code>mpu.getMotion6(&amp;ax, &amp;ay, &amp;az, &amp;gx, &amp;gy, &amp;gz); 
ax = map(ax, -17000, 17000, -1500, 1500);
</code></pre>

<p>I know the reason for taking 17000 as value - that's 1g.  But I am not getting how and why 1500 value is taken.</p>
 16085: <p>The <code>map()</code> function is well explained <a href="https://www.arduino.cc/en/Reference/Map" rel="nofollow noreferrer">here</a>.</p>

<p>In short, it maps one range of numbers to another.  In this case it will map <code>ax</code> from the range (-17000:17000) into the range (-1500:1500).</p>

<p>Imagine a ruler with both inches and cm on.  If you have a measurement in inches, you can represent that same measurement (point on the ruler) in cm.  Your "ruler" here has one scale ranging from -17000 to 17000, and another scale ranging from -1500 to 1500.  You're finding the reading on the second side at the point <code>ax</code> on the first.</p>

<p>If you mean specifically why are those numbers used -- then I have no idea since you give no context.</p>
