text:
Facilitating the spread of knowledge and innovation in professional software development

Contribute

### Topics

InfoQ Homepage Articles Amazing Charts In Rails

# Amazing Charts In Rails

Leia em Português

This item in japanese

Web applications often analyze data in the database by generating reports. Charts provide a visual representation of the reports, can be used for understanding trends and generally facilitate better synthesis of data. Ruby On Rails is one of the technologies that can be used to create these web applications with reports and charts. In this article, we will discuss how to create charts in Ruby on Rails.

For generating charts from reports or data in the database, we need a good charting product. Gruff, JFreeChart, XML/SWF charts, FusionCharts are few of the products available for Ruby on Rails. The following table gives a rough comparison of these charting products. Note that not all products have been tried and tested. Most of the analysis below is based on information gathered from the documentation of the products.
 Gruff JFreeChart XML/SWF FusionCharts Free FusionCharts v3 (Paid) Type Ruby classes Java Class files Flash charting component Flash Charting component Flash Charting component Operating System O/S Independent O/S Independent O/S Independent O/S Independent O/S Independent Adobe Flash Plug-in required No No Yes Yes Yes Suitable for Advanced Data Analysis No Yes Yes No Yes Any plug-ins or software to be installed Yes- RMagick, ImageMagick and Gruff Yes, JDK version 1.3 or later No No No Can the charts be animated? No Yes Yes Yes Yes Ability to save chart as image Yes Yes Yes No Yes UTF8 support Not Documented Yes Yes Yes Yes Ease Of Use In RoR Yes, but lot of coding involved. Not very easy to use. Not meant for end-user. Complex, too many xml tags for configuring the chart. Very easy to use. Developers and end-users can use it. Very easy to use. Developers and end-users can use it. Bar Charts 2D, 3D Yes Yes Yes Yes Yes Line Charts Yes Yes Yes Yes Yes Scatter Charts Yes Yes Yes Yes Yes Area Charts Yes Yes Yes Yes Yes Pie 2D, 3D Yes Yes Yes Yes Yes Doughnut 2D, 3D No Yes, Ring Chart Yes Yes Yes Gantt Charts No Yes No Yes Yes ( as part of FusionWidgets v3) Combination Charts No Yes Yes Yes Yes Gauge charts No Yes ( as part of XML/SWF Gauge) Yes No Yes ( as part of FusionWidgets v3) Real-time charts No No No No Yes ( as part of FusionWidgets v3) Data-driven Maps No No No No Yes ( as part of FusionWidgets v3)

In this article, we will explore charting in Rails using FusionCharts and MySQL database. FusionCharts is a flash-based charting component which can generate interactive and animated charts. FusionCharts can be used with any web scripting language, to deliver powerful charts with fairly minimal coding. FusionCharts comes with wrapper modules for use with RoR. Easy to use, variety of chart types, good documentation and great support is the motivation behind using FusionCharts for this article.

This article describes the mechanism of generating charts using FusionCharts in Ruby on Rails through a sample application. To run the sample application discussed in this article, the following would be needed:

•  FusionCharts Free/ v3:

Installation of FusionCharts merely involves copying and pasting the SWF and .rb files from the download package into appropriate application folder. The .rb files are present in Download Package > Code > RoR > Libraries folder.

•  Ruby 1.8.6 or above:

Available at http://www.rubyonrails.org/down

•  Rails gem 2.0.2 or above:

With RubyGems loaded, you can install all of Rails and its dependencies through the command line:

gem install rails

• MySQL 4.0 or above:

The sample application developed for this article is a basic time tracker application. This is a simple application where an employee fills out time for a week and views the chart based on the input hours. This article will discuss the sample application in two parts. The first part deals with the development of the basic application which includes list, edit, show and destroy for employees and timesheets. If you already have an application in which you have to integrate charts, then you can skip this part and go directly to the next part, which explains the integration of charts with the application. The article expects the reader to have a basic knowledge of Ruby on Rails.

Creating the Basic time tracker application

Using scaffold, the basic functionality of list, show, edit and delete for employees and timesheets can be generated. The commands to generate the basic employee and timesheet controllers are as follows: (run the last two commands from within the TimeTrackerApplication folder created with the first command)

rails –d mysql TimeTrackerApplication
ruby script/generate scaffold Employee name:text
ruby script/generate scaffold Timesheet log_date:datetime hours_spent:integer employee_id:integer

Next, you would modify the database.yml present in the config folder to point to “timetrackerdb” and the username and password entries corresponding to your database. Then, you would run the following rake commands to create the database,

rake db:create
rake db:migrate

In order to establish the foreign key relationship between employees and timesheets table, you would run the following query in your mysql instance:

alter table timesheets add constraint fk_employee_id foreign key fk_employee_id(employee_id) references employees(id) on delete cascade

Of course, there are other ways of creating foreign keys; the discussion of which is beyond the scope of this article. To represent the above foreign key relationship in Ruby on Rails, you will have to create an association between the models.

In Employee Model, after the class declaration statement, write the following statement:

has_many :timesheets

And in Timesheet Model you need to write:

belongs_to :employee

To insert the sample values into the database, you would need to run the sql script db/sampledata.sql. The basic application is now ready. You can add, view, edit or delete employees.

Integrating Charts In The Application

With the basic time tracker application in place, here is what it takes to generate the time tracker charts for an employee:

•  Copy the FusionCharts folder available in the download package of FusionCharts Free/Pro
(Download Package > Code > FusionCharts), to the public folder of TimeTrackerApplication.

•  Copy the file FusionCharts.js present in the Download Package > Code > FusionCharts folder

to the public/javascripts folder.

•  Copy the fusioncharts_helper.rb from the Download Package > Code > RoR > Libraries folder

That completes the FusionCharts setup.

From the list of employees page, a link to the Time Tracker Chart needs to be created. Thus, for every employee, there will be a link to view his time as a chart. The link to the time tracker chart is created in the app/views/employees/index.html.erb file. Listing 1 shows the details of the link added. Add this link after the other links in the page.

Listing 1

 <%= link_to 'Time Chart', {:action=>'view_timesheet_chart',:id=>employee.id} %>

Figure 1 illustrates the list of employees page from the application. The features seen in Figure 1 have been acheived easily via database setup and ruby scaffold as seen in the previous section. This page can be viewed by accessing the address "http://yourserver:port/employees". The relevant portion of this screen is shown in Figure 1.

Figure 1

The action invoked on clicking this "Time Chart" link is the view_timesheet_chart action of the employees controller. Listing 2 shows the code for this action. This action renders the chart for the selected employee. The action contacts the Employee model to find the timesheets for this employee in the date range "2008-12-01" to "2008-12-07" and then renders the "view_timelog_chart.html.erb". To keep things simple, the date range has been fixed in the controller. In real world applications, the date range for generating the report/ chart would be selected by the user.

Listing 2

EmployeesController

  def view_timesheet_chart
start_date= "2008-12-01"
end_date="2008-12-07"
@employee_id = params[:id]
employee_details_with_timesheets =  Employee.find_with_timesheets_in_date_range(@employee_id,start_date,end_date)
if(!employee_details_with_timesheets.nil?)
@employee_details_with_timesheets =employee_details_with_timesheets[0]
else
@employee_details_with_timesheets =nil;
end
end

Using the employee id as parameter, this action contacts the Employee model to find the timesheets for this employee within the specified period. The function to be added in the Employee model is shown in Listing 3 below:

Listing 3

Employee.rb

def self.find_with_timesheets_in_date_range(id, start_date, end_date)
conditions="employees.id =? and log_date between ? and ?"
employee_details_with_timesheets=self.find(:all, :include=>'timesheets', :conditions=> [conditions,id,start_date,end_date], :order=>'log_date asc')
return employee_details_with_timesheets
end

The action finally renders "view_time_chart.html.erb". The template "view_timelog_chart.html.erb" uses the layout "employees.html.erb" which is common to all views of employees controller. Hence, the code in the view is short and sweet as seen in Listing 4.

Listing 4

view_timesheet_chart.html.erb (in app/views/employees folder)

<%= javascript_include_tag "FusionCharts"%>
<%
# The xml is obtained as a string from builder template.
str_xml = render "employees/timesheet_data"
#Create the chart - Column 3D Chart with data from strXML
render_chart '/FusionCharts/Column3D.swf' , '' , str_xml , 'TimeChart' ,  650 ,  400 ,  false ,  false do -%>

<%  end -%>

From the above code, we understand the following as the steps involved to render the chart in the view page:

1. Include the FusionCharts.js file.
2. Obtain the xml data from the builder. ( The builder uses the data from the controller action to build the xml)
3. Render the chart by calling render_chart function with appropriate parameters

Usually, time is represented in a Gantt chart and this chart is also available in FusionCharts. Here, for the sake of simplicity, the Column chart has been used.

The second step involves the creation of xml. FusionCharts uses XML (eXtensible Markup Language) to create and manipulate charts. The entire FusionCharts chart is controlled by XML parameters i.e., you use XML to define the cosmetic as well as functional properties for the chart. There are a lot of properties that you can define for each chart type. FusionCharts has a specific XML structure for each chart. The chart under discussion is a single-series chart (having only one set of data), representing the day of the week and the number of hours spent by the employee on that day. A sample xml for this chart is shown in Listing 5.

Listing 5

Sample Single-Series Chart XML

<graph xAxisName="Day" showValues="1" caption="Time Tracker Chart" numberSuffix=" hrs." subcaption="For Employee John Wilson" yAxisName="Hours Spent">
<set name="Monday" value="8" color="AFD8F8"/>
<set name="Tuesday" value="6" color="F6BD0F"/>

<set name="Wednesday" value="5" color="8BBA00"/>
<set name="Thursday" value="9" color="A66EDD"/>
<set name="Friday" value="9" color="F984A1"/>
<set name="Saturday" value="8" color="CCCC00"/>
</graph>

To generate an xml similar to the one shown in Listing 5 but with the data present in the database, the builder file is used.

How does the builder build the chart xml? The builder builds the xml for the chart using the @employee_details_with_timesheets variable stored in the action. Listing 6 shows the contents of the builder file.

Listing 6

timesheet_data.builder (in app/views/employees folder)

xml = Builder::XmlMarkup.new(:indent=>0)
options = {
:caption=>'Time Tracker Chart',
:subcaption=>'For Employee '+ @employee_details_with_timesheets.name   ,
:yAxisName=>'Hours Spent',
:xAxisName=>'Day',
:showValues=>'1',
:formatNumberScale=>'0',
:numberSuffix=>' hrs.'
}
xml.graph(options) do
for timesheet in @employee_details_with_timesheets.timesheets do
log_day = timesheet.log_date.strftime('%a')
xml.set(:name=>log_day,:value=>timesheet.hours_spent,:color=>''+get_FC_color)
end
end

In the builder, you would first create a new XMLMarkup object with the value for "indent" equal to zero and use this object for building the xml.

All the options required for configuring the chart is present in a hash named options, which is passed to the top-most (graph) tag. For details on the options that can be provided to the chart, please refer to the complete FusionCharts documentation. The xml root element is "graph". Within this, there is a "set" element corresponding to each timesheet of the selected employee. Each “set” element has name and value as attributes. The name would contain the day of the week and the value will contain the hours spent on that day by that employee. The builder uses the @employee_details_with_timesheets variable present in the controller action, to obtain these values.

Finally, in the view page, the chart is rendered using the function render_chart which takes the swf chart file name, url, xml, width, height, debugMode, registerWithJS as parameters. This function is available in the fusioncharts_helper module present in the lib folder. This can be made accessible to all the views by including it in the application_helper.rb as shown in Listing 7.

Listing 7

application_helper.rb

require 'fusioncharts_helper'
include FusionChartsHelper

The swf files required to show the charts are present in the public/FusionCharts folder. Here the Column3D.swf has been used but any other type of single-series chart could also be generated by just changing the swf filename. The data has been provided using dataXML method but the data could also be provided through a dataURL. Examples of this are present in FusionCharts documentation.

Now, on clicking the "Time Chart" link for an employee in the list of employees page, the time log entries for the week 01/12/2008 to 07/12/2008 are displayed in the form of a chart. The timesheet chart will be similar to Figure 2 shown below.

Figure 2

Summary of steps to generate chart:

After the setup of FusionCharts in the application and including FusionChartsHelper in the application_helper.rb, the following are the steps

1. In the controller action, find the data required for the chart from the database.
2. Write a builder to build the chart xml from this data.
3. In the view for the controller action in step 1, get the xml from the builder by either passing the data to it or letting the builder use the data from the controller action.
4. Next, call the function render_chart with appropriate parameters (including the xml obtained from step 3)

In this article, you have learnt how to create a simple chart using FusionCharts in Ruby on Rails through the time tracker application. With a few modifications to the sample application, you could create a chart with the overview of time log for all the employees. Probably, from this chart you could drill-down on a particular employee to get the time details for him. You could use Ajax for retrieving the chart. The possibilities are innumerable. FusionCharts download package itself contains a number of examples which can be explored. The entire sample application discussed in this article is available for download here.

The author is a Consultant with over 6 years of experience in the IT Industry and has interests in a wide range of web technologies involving the J2EE stack, Ruby On Rails & PHP.

Style

## Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

• ##### JS approach

by Anselmo da Silva,

• ##### Re: JS approach

by Werner Schuster,

• ##### Re: JS approach

by Anselmo da Silva,

• ##### Re: JS approach

by Jerven Bolleman,

• ##### Over OFC2?

by Jonathan Calvert,

• ##### Re: Over OFC2?

by Srividya Sharma,

• ##### Ezgraphix Plugin.

by Juan Esteban Pemberthy,

• ##### Gruff has no scatterplott-charts (but gnuplot)

by Oliver Haag,

• ##### JS approach

Your message is awaiting moderation. Thank you for participating in the discussion.

As you mentioned, there are several ways to create charts in rails, but each one has some terrible dependency (ie: rmagick == memory killer + server-work, swf==another client layer, plus the excess of animations).

The point is Data-Visualization, and here, you could include in your analyze, the "Javascript Canvas" approach.

As js engines getting faster, the use of this canvas element becomes even more interesting. The caveat is the no-direct-support in IE.

We use the approach in controlled client environments, and it results to be an elegant solution, with simple deploy and control.

Some references:
Protochart: www.deensoft.com/lab/protochart/
PlotKit: www.liquidx.net/plotkit/

Anselmo

• ##### Re: JS approach

Your message is awaiting moderation. Thank you for participating in the discussion.

Anselmo,
thanks for the links - definitely an approach to watch.

BTW we also featured an article on using Google Charts from Ruby:
which has neither client nor serverside dependencies, but of course you'll tie yourself to Google's servers.

• ##### Re: JS approach

Your message is awaiting moderation. Thank you for participating in the discussion.

• ##### Over OFC2?

Your message is awaiting moderation. Thank you for participating in the discussion.

What does this give me over OpenFlashChart2? I'm not so sure I see it. I would definitely agree that the charting solutions for Rails are generally less than satisfactory. OFC is free and with the JSON support is excellent. I've even been using that to 'store' charts in CouchDB.

But anyway, there is one real problem with Flash based charting as opposed to server side image compilation, and that's handling large data sets(10s or 100s of thousands of data points) for scatter plots.

• ##### Ezgraphix Plugin.

Your message is awaiting moderation. Thank you for participating in the discussion.

Hello there, I made this plugin for FusionCharts usage in Rails,

github.com/jpemberthy/ezgraphix/tree/master

Documentation and a live demo are listed in the project's readme, it's still a basic plugin but Im thinkin in making a second version supporting more charts.

Enjoy it.

• ##### Re: Over OFC2?

Your message is awaiting moderation. Thank you for participating in the discussion.

I would say, FusionCharts Free provides more chart types and better animation. Both are totally free - so one cannot complain much about free solutions - it is up to you what you choose.
Of course, upgrading to FusionCharts v3 opens a new set of benefits like more chart types, maps, power charts, visual debugger and not to mention the personal support.

• ##### Re: JS approach

Your message is awaiting moderation. Thank you for participating in the discussion.

There is the free java implementation of the google chart api.
www.jfree.org/eastwood/

• ##### Gruff has no scatterplott-charts (but gnuplot)

by Oliver Haag,

Your message is awaiting moderation. Thank you for participating in the discussion.

There is a mistake in this elsewise great overview, Gruff has no support for scattercharts.

Instead FusionCharts indeed is a good solution for simple scattercharts. For really komplex data I prefer something not on the list: gunplot with the rgplot ruby wrapper.

- gnuplot.sourceforge.net/
- rgplot.rubyforge.org/

Hope it helps.
Oliver

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


text:
# Objective

How to change the heading of landscaped pages from

to

?

# Minimal Code

\documentclass{book}
\usepackage[a5paper,hmargin=3cm,vmargin=5cm]{geometry}
\usepackage{lscape,lipsum}

\begin{document}
\chapter{One}
\lipsum[1]

\section{One One}
\lipsum[2]

\newgeometry{hmargin=5cm,vmargin=3cm}

\begin{landscape}
\lipsum[3-5]
\end{landscape}

\restoregeometry
\lipsum[6]

\end{document}

# Edit 1 (my real scenario layout)

In my real scenario, the left-right margins should not be occupied by headings.

The lscape package is not designed for this. It's designed for rotating wide figures or tables, for example. And the geometry package explicitly says that \newgeometry can't change the paper size or orientation. So I don't think there's a way to do this automatically.

You can include landscape oriented pdf pages using the pdfpages package. (Include them with the [landscape] option.)

## A new solution

You could also use the textpos package to place the headers. By combining this with the fancyhdr package, you can pretty much automate it.

\documentclass[twoside]{book}
\usepackage[a5paper,hmargin=3cm,vmargin=5cm]{geometry}
\usepackage{lscape,lipsum,graphicx}
\usepackage[absolute]{textpos}
\usepackage{fancyhdr}

\fancypagestyle{lscape}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[LE]{%
\begin{textblock}{20}(1,5){\rotatebox{90}{\leftmark}}\end{textblock}
\begin{textblock}{1}(13,10.5){\rotatebox{90}{\thepage}}\end{textblock}}
\fancyfoot[LO] {%
\begin{textblock}{1}(13,10.5){\rotatebox{90}{\thepage}}\end{textblock}
\begin{textblock}{20}(1,13.25){\rotatebox{90}{\rightmark}}\end{textblock}}
\renewcommand{\footrulewidth}{0pt}}

\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}

\begin{document}
\chapter{A chapter}
\section{A section}
\lipsum
\section{A section}
\lipsum

\newgeometry{hmargin=3cm,vmargin=5cm}
\thispagestyle{lscape}
\pagestyle{lscape}
\begin{landscape}
\lipsum[1-3]

\end{landscape}

\restoregeometry
\lipsum[6]

\end{document}

format: plain


text:
# What is the effect on matter of solidification? Thanks!

Aug 4, 2018

This question will have to be readdressed....

#### Explanation:

What do we mean by $\text{solidification}$...do we mean $\text{fusion}$, i.e. the transition solid to liquid, traditionally called $\text{melting}$? In many instances the SOLID phase is (and should be) MORE dense than the liquid phase. Mind you, this prediction fails completely for the water molecule, with the result that ice-cubes, and ice-bergs float...


text:
Department of

# Mathematics

Seminar Calendar
for events the day of Wednesday, September 18, 2019.

.
events for the
events containing

Questions regarding events or the calendar should be directed to Tori Corkery.
     August 2019           September 2019          October 2019
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
1  2  3    1  2  3  4  5  6  7          1  2  3  4  5
4  5  6  7  8  9 10    8  9 10 11 12 13 14    6  7  8  9 10 11 12
11 12 13 14 15 16 17   15 16 17 18 19 20 21   13 14 15 16 17 18 19
18 19 20 21 22 23 24   22 23 24 25 26 27 28   20 21 22 23 24 25 26
25 26 27 28 29 30 31   29 30                  27 28 29 30 31

Wednesday, September 18, 2019

3:00 pm in 241 Altgeld Hall,Wednesday, September 18, 2019

#### Polish groups whose measure preserving actions are whirly

###### Pavlos Motakis (UIUC Math)

Abstract: Let $\mathrm{MALG}(X)$ denote the measure algebra of a standard probability space $(X,\mu)$. A measure preserving action of a Polish group $G$ on $\mathrm{MALG}(X)$ is called whirly if for any $A, B$ in $\mathrm{MALG}(X)$ with positive measure and for any open neighborhood $U$ of the identity of $G$ there exists $g\in U$ so that $(gA)\cap B$ has positive measure. We follow two papers, one of Glasner–Tsirelson–Weiss and one of Glasner–Weiss, to prove two results. The first one is that if $G$ is certain type of Polish group, namely a Lévy group, then any non-trivial Borel action on $\mathrm{MALG}(X)$ is whirly. The second result is that for the generic automorphism $T\in\mathrm{MALG}(X)$, the closed subgroup of automorphisms generated by $T$ acts on $\mathrm{MALG}(X)$ whirlily.
This is a follow up to the lecture of D. Ihli on 09/11/2019.

4:00 pm in 447 Altgeld Hall,Wednesday, September 18, 2019

#### Intro to the Gorsky-Negut wall-crossing conjecture

###### Josh Wen (Illinois Math)

Abstract: The Hilbert scheme of points on the plane is a space that by now has been connected to many areas outside of algebraic geometry: e.g. algebraic combinatorics, representation theory, knot theory, etc. The equivariant K-theory of these spaces have a few distinguished bases important to making some of these connections. A new entrant to this list of bases is the Maulik-Okounkov K-theoretic stable bases. They depend in a piece-wise constant manner by a real number called the slope, and the numbers where the bases differ are called the walls. Gorsky and Negut have a conjecture relating the transition between bases when the slope crosses a wall to the combinatorics of q-Fock spaces for quantum affine algebras. I'll try to introduce as many of the characters of this story as I can as well as discuss a larger picture wherein these stable bases are geometric shadows of things coming from deformation quantization.


text:
## Reversible/Irreversible Pathways

$\Delta S = \frac{q_{rev}}{T}$

Natassia Dunn 3G
Posts: 21
Joined: Wed Sep 21, 2016 2:59 pm

### Reversible/Irreversible Pathways

What makes a pathway reversible or irreversible and how does this relate to what we are learning? I'm kind of confused by what the graphs on page 33 of the course reader mean/signify. Thank you!

Edward_Lee_3C
Posts: 36
Joined: Wed Sep 21, 2016 2:58 pm

### Re: Reversible/Irreversible Pathways

Today he explained the graphs for the reversible and irreversible processes. For the reversible process, the external pressure is slowly reduced so that is why the line slopes downward. Because the pressure is changing the P* change in V cannot be used. For the irreversible process, the external pressure is kept constant which is indicated by the straight line. Because pressure is constant P* change in V can be used.


text:
# How many ways can we draw three balls such that at least two are red?

We have $$7$$ balls, three red, two white and two blue. How many ways can we select three of them such that at least two are red? So, my answer was: If the balls are identical, then there are $$3$$ ways: $$RRR$$, $$RRB$$ and $$RRW$$. If the balls are distinguishable, then there are $${7}\choose{3}$$=$$35$$ total possibilities, but there are $${4}\choose{3}$$=$$4$$ ways that have no red balls, and $$2 \cdot{4}\choose{2}$$=$$12$$ with only one ball so there are 19 with 2 red balls or more. But the answer given is 13. Could anyone explain this to me?

• There are $3\cdot\binom{4}{2} = 18$, not $12$, ways with exactly one red ball. Oct 11, 2021 at 21:02

You are correct that there are $$\binom{7}{3}$$ ways to select three of the seven balls and that there are $$\binom{4}{3}$$ ways to select none of the red balls. However, there are $$\binom{3}{1}\binom{4}{2}$$ ways to select exactly one of the three red balls and two of the remaining four balls, which yields $$\binom{7}{3} - \binom{4}{3} - \binom{3}{1}\binom{4}{2} = 13$$ ways to select at least two red balls.
Alternatively, we can select exactly two red balls in $$\binom{3}{2}\binom{4}{1}$$ ways since we must select two of the three red balls and one of the other four balls, and we can select all three red balls in $$\binom{3}{3}$$ ways. Since these cases are mutually exclusive, we obtain $$\binom{3}{2}\binom{4}{1} + \binom{3}{3} = 13$$ selections with at least two red balls.
• Why is this reasoning wrong? := There are $\binom{3}{2}$ ways to choose the two read balls. Then there are $\binom{5}{1}$ ways to choose 1 of the remaining balls. Together they make $\binom{3}{2} \times \binom{5}{1} =15$. Mar 25 at 14:01
• @user2277550 Suppose we number the three red balls $r_1, r_2, r_3$. Your method counts the case in which all three red balls are selected three times, once for each of the three ways you could designate one of the three red balls as the remaining ball: $(\{r_1, r_2\}, \{r_3\})$, $(\{r_1, r_3\}, \{r_2\})$, $(\{r_2, r_3\}, \{r_1\})$. That accounts for the two extra selections in your answer. Mar 25 at 16:09


text:
# Short-rate model

A short-rate model, in the context of interest rate derivatives, is a mathematical model that describes the future evolution of interest rates by describing the future evolution of the short rate, usually written ${\displaystyle r_{t}\,}$.

## The short rate

Under a short rate model, the stochastic state variable is taken to be the instantaneous spot rate.[1] The short rate, ${\displaystyle r_{t}\,}$, then, is the (continuously compounded, annualized) interest rate at which an entity can borrow money for an infinitesimally short period of time from time ${\displaystyle t}$. Specifying the current short rate does not specify the entire yield curve. However no-arbitrage arguments show that, under some fairly relaxed technical conditions, if we model the evolution of ${\displaystyle r_{t}\,}$ as a stochastic process under a risk-neutral measure ${\displaystyle Q}$ then the price at time ${\displaystyle t}$ of a zero-coupon bond maturing at time ${\displaystyle T}$ with a payoff of 1 is given by

${\displaystyle P(t,T)=\mathbb {E} ^{Q}\left[\left.\exp {\left(-\int _{t}^{T}r_{s}\,ds\right)}\right|{\mathcal {F}}_{t}\right]}$

where ${\displaystyle {\mathcal {F}}}$ is the natural filtration for the process. The interest rates implied by the zero coupon bonds form a yield curve or more precisely, a zero curve. Thus specifying a model for the short rate specifies future bond prices. This means that instantaneous forward rates are also specified by the usual formula

${\displaystyle f(t,T)=-{\frac {\partial }{\partial T}}\ln(P(t,T)).}$

## Particular short-rate models

Throughout this section ${\displaystyle W_{t}\,}$ represents a standard Brownian motion under a risk-neutral probability measure and ${\displaystyle dW_{t}\,}$ its differential. Where the model is lognormal, a variable ${\displaystyle X_{t}\,}$, is assumed to follow an Ornstein–Uhlenbeck process and ${\displaystyle r_{t}\,}$ is assumed to follow ${\displaystyle r_{t}=\exp {X_{t}}\,}$.

### One-factor short-rate models

Following are the one-factor models, where a single stochastic factor – the short rate – determines the future evolution of all interest rates. Other than Rendleman–Bartter and Ho–Lee, which do not capture the mean reversion of interest rates, these models can be thought of as specific cases of Ornstein–Uhlenbeck processes. The Vasicek, Rendleman–Bartter and CIR models have only a finite number of free parameters and so it is not possible to specify these parameter values in such a way that the model coincides with observed market prices ("calibration"). This problem is overcome by allowing the parameters to vary deterministically with time.[2][3] In this way, Ho-Lee and subsequent models can be calibrated to market data, meaning that these can exactly return the price of bonds comprising the yield curve. Here, the implementation is usually via a (binomial) short rate tree;[4] see Lattice model (finance)#Interest rate derivatives.

1. Merton's model (1973) explains the short rate as ${\displaystyle r_{t}=r_{0}+at+\sigma W_{t}^{*}}$: where ${\displaystyle W_{t}^{*}}$ is a one-dimensional Brownian motion under the spot martingale measure.[5]
2. The Vasicek model (1977) models the short rate as ${\displaystyle dr_{t}=(\theta -\alpha r_{t})\,dt+\sigma \,dW_{t}}$; it is often written ${\displaystyle dr_{t}=a(b-r_{t})\,dt+\sigma \,dW_{t}}$.[6]
3. The Rendleman–Bartter model (1980) explains the short rate as ${\displaystyle dr_{t}=\theta r_{t}\,dt+\sigma r_{t}\,dW_{t}}$.[7]
4. The Cox–Ingersoll–Ross model (1985) supposes ${\displaystyle dr_{t}=(\theta -\alpha r_{t})\,dt+{\sqrt {r_{t}}}\,\sigma \,dW_{t}}$, it is often written ${\displaystyle dr_{t}=a(b-r_{t})\,dt+{\sqrt {r_{t}}}\,\sigma \,dW_{t}}$. The ${\displaystyle \sigma {\sqrt {r_{t}}}}$ factor precludes (generally) the possibility of negative interest rates.[8]
5. The Ho–Lee model (1986) models the short rate as ${\displaystyle dr_{t}=\theta _{t}\,dt+\sigma \,dW_{t}}$.[9]
6. The Hull–White model (1990)—also called the extended Vasicek model—posits ${\displaystyle dr_{t}=(\theta _{t}-\alpha r_{t})\,dt+\sigma _{t}\,dW_{t}}$. In many presentations one or more of the parameters ${\displaystyle \theta ,\alpha }$ and ${\displaystyle \sigma }$ are not time-dependent. The model may also be applied as lognormal. Lattice-based implementation is usually trinomial.[10][11]
7. The Black–Derman–Toy model (1990) has ${\displaystyle d\ln(r)=[\theta _{t}+{\frac {\sigma '_{t}}{\sigma _{t}}}\ln(r)]dt+\sigma _{t}\,dW_{t}}$ for time-dependent short rate volatility and ${\displaystyle d\ln(r)=\theta _{t}\,dt+\sigma \,dW_{t}}$ otherwise; the model is lognormal.[12]
8. The Black–Karasinski model (1991), which is lognormal, has ${\displaystyle d\ln(r)=[\theta _{t}-\phi _{t}\ln(r)]\,dt+\sigma _{t}\,dW_{t}}$.[13] The model may be seen as the lognormal application of Hull–White;[14] its lattice-based implementation is similarly trinomial (binomial requiring varying time-steps).[4]
9. The Kalotay–Williams–Fabozzi model (1993) has the short rate as ${\displaystyle d\ln(r_{t})=\theta _{t}\,dt+\sigma \,dW_{t}}$, a lognormal analogue to the Ho–Lee model, and a special case of the Black–Derman–Toy model.[15] This approach is effectively similar to “the original Salomon Brothers model" (1987),[16] also a lognormal variant on Ho-Lee.[17]

### Multi-factor short-rate models

Besides the above one-factor models, there are also multi-factor models of the short rate, among them the best known are the Longstaff and Schwartz two factor model and the Chen three factor model (also called "stochastic mean and stochastic volatility model"). Note that for the purposes of risk management, "to create realistic interest rate simulations," these Multi-factor short-rate models are sometimes preferred over One-factor models, as they produce scenarios which are, in general, better "consistent with actual yield curve movements".[18]

1. The Longstaff–Schwartz model (1992) supposes the short rate dynamics are given by: ${\displaystyle dX_{t}=(a_{t}-bX_{t})\,dt+{\sqrt {X_{t}}}\,c_{t}\,dW_{1t}}$, ${\displaystyle dY_{t}=(d_{t}-eY_{t})\,dt+{\sqrt {Y_{t}}}\,f_{t}\,dW_{2t}}$, where the short rate is defined as ${\displaystyle dr_{t}=(\mu X+\theta Y)dt+\sigma _{t}{\sqrt {Y}}dW_{3t}}$.[19]
2. The Chen model (1996) which has a stochastic mean and volatility of the short rate, is given by : ${\displaystyle dr_{t}=(\theta _{t}-\alpha _{t})\,dt+{\sqrt {r_{t}}}\,\sigma _{t}\,dW_{t}}$, ${\displaystyle d\alpha _{t}=(\zeta _{t}-\alpha _{t})\,dt+{\sqrt {\alpha _{t}}}\,\sigma _{t}\,dW_{t}}$, ${\displaystyle d\sigma _{t}=(\beta _{t}-\sigma _{t})\,dt+{\sqrt {\sigma _{t}}}\,\eta _{t}\,dW_{t}}$.[20]

## Other interest rate models

The other major framework for interest rate modelling is the Heath–Jarrow–Morton framework (HJM). Unlike the short rate models described above, this class of models is generally non-Markovian. This makes general HJM models computationally intractable for most purposes. The great advantage of HJM models is that they give an analytical description of the entire yield curve, rather than just the short rate. For some purposes (e.g., valuation of mortgage backed securities), this can be a big simplification. The Cox–Ingersoll–Ross and Hull–White models in one or more dimensions can both be straightforwardly expressed in the HJM framework. Other short rate models do not have any simple dual HJM representation.

The HJM framework with multiple sources of randomness, including as it does the Brace–Gatarek–Musiela model and market models, is often preferred for models of higher dimension.

## References

1. ^ Short rate models, Prof. Andrew Lesniewski, NYU
2. ^
3. ^ Continuous-Time Short Rate Models, Prof Martin Haugh, Columbia University
4. ^ a b Binomial Term Structure Models, Mathematica in Education and Research, Vol. 7 No. 3 1998. Simon Benninga and Zvi Wiener.
5. ^ Merton, Robert C. (1973). "Theory of Rational Option Pricing". Bell Journal of Economics and Management Science 4 (1): 141–183. doi:10.2307/3003143.
6. ^ Vasicek, Oldrich (1977). "An Equilibrium Characterisation of the Term Structure". Journal of Financial Economics 5 (2): 177–188. doi:10.1016/0304-405X(77)90016-2.
7. ^ Rendleman, R.; Bartter, B. (1980). "The Pricing of Options on Debt Securities". Journal of Financial and Quantitative Analysis 15: 11–24. doi:10.2307/2979016.
8. ^ Cox, J.C., J.E. Ingersoll and S.A. Ross (1985). "A Theory of the Term Structure of Interest Rates". Econometrica 53: 385–407. doi:10.2307/1911242.
9. ^ T.S.Y. Ho and S.B. Lee (1986). "Term structure movements and pricing interest rate contingent claims". Journal of Finance 41. doi:10.2307/2328161.
10. ^ John Hull and Alan White (1990). "Pricing interest-rate derivative securities". Review of Financial Studies 3 (4): 573–592. doi:10.1093/rfs/3.4.573.
11. ^ Markus Leippold and Zvi Wiener (2004). "Efficient Calibration of Trinomial Trees for One-Factor Short Rate Models" (PDF). Review of Derivatives Research 7 (3): 213–239. doi:10.1007/s11147-004-4810-8.
12. ^ Black, F.; Derman, E.; Toy, W. (1990). "A One-Factor Model of Interest Rates and Its Application to Treasury Bond Options" (PDF). Financial Analysts Journal: 24–32.
13. ^ Black, F.; Karasinski, P. (1991). "Bond and Option pricing when Short rates are Lognormal". Financial Analysts Journal: 52–59.
14. ^ Short Rate Models, Professor Ser-Huang Poon, Manchester Business School
15. ^ Kalotay, Andrew J.; Williams, George O.; Fabozzi, Frank J. (1993). "A Model for Valuing Bonds and Embedded Options". Financial Analysts Journal (CFA Institute Publications) 49 (3): 35–46. doi:10.2469/faj.v49.n3.35.
16. ^ Kopprasch, Robert (1987). "Effective duration of callable bonds: the Salomon Brothers term structure-based option pricing model". Salomon Bros.
17. ^ See pg 218 in Tuckman, Bruce & Angel Serrat (2011). Fixed Income Securities: Tools for Today's Markets. Hoboken, NJ: Wiley. ISBN 0470891696.
18. ^ Pitfalls in Asset and Liability Management: One Factor Term Structure Models, Dr. Donald R. van Deventer, Kamakura Corporation
19. ^ Longstaff, F.A. and Schwartz, E.S. (1992). "Interest Rate Volatility and the Term Structure: A Two-Factor General Equilibrium Model" (PDF). Journal of Finance 47 (4): 1259–82. doi:10.1111/j.1540-6261.1992.tb04657.x.
20. ^ Lin Chen (1996). "Stochastic Mean and Stochastic Volatility — A Three-Factor Model of the Term Structure of Interest Rates and Its Application to the Pricing of Interest Rate Derivatives". Financial Markets, Institutions & Instruments 5: 1–88.


text:
# The Seattle Public Library

 Hot Topics For Seniors: The Importance and Improvement of Creativity Wednesday, Sep. 4, 2019, 12 – 1:30 p.m.
Where Southwest Branch Adults English A brown bag lunch discussion group committed to understanding issues of importance to current and future seniors. Join Puget Sound Advocates for Retirement Action (PSARA) and the Southwest Branch as we create a place for the discussion of current national, state and local issues. "BOOK TITLE" by AUTHOR NAME Library events and programs are free and everyone is welcome. Registration is not required. Ask Us 206-684-7455 Southwest Branch Space is limited at library events. Please come early to make sure you get a seat. Due to the fire code, we can’t exceed the maximum capacity for our rooms.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 Printed: Sunday, February 23, 2020 at 6:31 AM PST


text:
# Separable First Order ODE

1. Jun 19, 2011

### shelovesmath

2r(s^2+1)dr + (r^4 + 1)ds = 0

2.book answer different than mine...book's answer: r^2 + s = c(1 -r^2 s)

3. 2r(s^2+1)dr =- (r^4 + 1)ds
-2r/r^4+1 dr = 1/s^2+1 ds
int -2r/r^4+1 dr = int 1/s^2+1 ds
with u substitution on left we have u = -2r, etc.
tan^-1 r^2 = - tan^ -1 s + c
tan^-1 r^2 + tan^-1 s = c

Last edited: Jun 19, 2011
2. Jun 19, 2011

### grey_earl

Don't forget brackets in writing, it may confuse people.
We have ∫ -2r/(r⁴+1) dr = ∫ 1/(s²+1) ds. The left integral gives -arctan(r²), the right arctan(s), so c - arctan(r²) = arctan(s). (You forgot the minus sign from the variable change). Taking the tangens on both sides and using the addition theorem we have
s = tan [ c - arctan(r²) ] = ( tan c - r² )/( 1 + r² tan c ), so that with c' = tan c we get
( 1 + r² c' ) s = c' - r² which is exactly what your book gave you.

3. Jun 19, 2011

### shelovesmath

I, uh, don't remember the tangents theorem. Calculus topic? Precalc? I'll go google I guess. Thanks for the feedback.

4. Jun 20, 2011

### jonspalding

The derivative of the answer should then match the initial problem; however, this did not work out for me. Does it check out for you?

5. Jun 20, 2011

### hunt_mat

It doesn't look as you have completed the calculation. Take tan of both sides and use the trig expression for tan(A+B)

6. Jun 20, 2011

### grey_earl

We have tan(a+b) = [ tan a + tan b ]/[ 1 - tan a tan b ], which can be derived using the addition theorems for sine and cosine.

And, if you derive r² + s = c(1 - r² s), you should get 2 r dr + ds = - c (2 r dr s) - c (r² ds), so ( 1 + c s ) 2 r dr + ( 1 + c r² ) ds = 0, which after substituting c from the result and multiplying by (1- r² s) simplifies to ( 1 + s² ) 2 r dr + ( 1 + r⁴ ) ds = 0, which is the original equation.

Last edited: Jun 20, 2011


text:
# Riemann Sum-esque limit involving Radicals

Me and my friend were trying to evaluate the following limit: $$I\equiv\lim_{N\to\infty}\sum_{k=0}^N\sqrt{\frac{1}{N^2}+\left(f\left(\frac{k+1}{N}\right)-f\left(\frac{k}{N}\right)\right)^2}$$ it was the last step in a problem we were trying to solve. It looks a lot like the formula for a Riemann sum mixed with the formula for the differential of arclength: $$\int_0^1f(x)\text{d}x = \lim_{N\to\infty}\frac{1}{N}\sum_{k=0}^Nf\left(\frac kN\right) \\ \text{d}s = \sqrt{1+(f'(x))^2}\text{d}x$$ but we're not sure what the connection is (if there is one). Any ideas on how to evaluate $I$?

Hint: Write $~\dfrac1N~=~\sqrt{\dfrac1{N^2}}\quad$ and $\quad f\bigg(\dfrac{k+1}N\bigg)-f\bigg(\dfrac kN\bigg)~=~\dfrac{f\bigg(\dfrac{k+1}N\bigg)-f\bigg(\dfrac kN\bigg)}1~=~$
$~=~\dfrac{f\bigg(\dfrac{k+1}N\bigg)-f\bigg(\dfrac kN\bigg)}{(k+1)-k}~=~\dfrac1N\cdot\dfrac{f\bigg(\dfrac{k+1}N\bigg)-f\bigg(\dfrac kN\bigg)}{\dfrac{k+1}N-\dfrac kN},~$ where the last expression, for
$N\to\infty,$ looks suspiciously close to the definition of the derivative...


text:
# Calculating your own GPS accuracy

In my post on GPS accuracy I made some claims about the accuracy of GPS devices and used a graphic that was created by a third party that may have confused the issue for some people, as it appeared to show a different level of accuracy that I was writing about.

Here is how to determine the accuracy of your own GPS, based on an experiment I did last week on two of my own units.

### Set up the GPS

The GPS I am using is the Garmin GPSMAP 62st (pictured right).

Turn on the GPS and let it “settle” or calculate your position. If it hasn’t been on in a while this might take as long as 15 minutes. While you’re at it, configure the GPS to record the position regardless of how far it believes it has moves since the last calculation. Some GPS units “filter” positions so they don’t introduce distances that haven’t been travelled. This is important to athletes who are using it to track how far they run. If you don’t do this step, the results are going to be very strange, as the GPS will only record wide swings in position.

It’s probably a good idea to make sure the batteries are fresh.

Choose a location where the GPS can be put, safely, for several hours and where it has a reasonable view of the sky, similar to what you might expect under the conditions you regularly use it.

### Start gathering data

Delete the current track. This important step “zeros” the current recording of the track file so we start with data that’s current, and “stable” — the GPS has had the time to refine the position. We’re only interested in the current position as long as the GPS is not moving.

Let the GPS gather data for several hours. Do not move it. This is where we let the little unit do it’s work gathering data.

### Retrieve data

Save the track, and download it to your computer. In my case the data is in a GPX file. I took the file and converted the latitude/longitude into UTM, because I want to express the position and error in terms of meters. I then import the data into a spreadsheet.

### Analyse the data

Find the mean of the UTM coordinates (which is in meters), and use that to calculate the “delta X” and “delta Y” positions by subtracting the mean X and mean Y to create two new columns in the spreadsheet.

Calculate the standard deviation of the delta X and Y columns.

$latex \sigma=\sqrt{\frac{1}{N}\sum_{i=1}^N(x_i-\mu)^2}$

Use the standard deviation to calculate the CEP ( 50%) radius using the following formula:

$latex CEP=0.59(\sigma_x+\sigma_y)$

where $latex \sigma_x$ is the standard deviation of the easting value, and $latex \sigma_y$ is the standard deviation of the northing. In this case, the radius is 6.06 meters.

Then calculate the 2DRMS (95%) radius using the formula:

$latex 2DRMS=2\sqrt{\sigma_x^2+\sigma_y^2}$

Finally, plot the delta X and delta Y columns, and the CEP and 2DRMS rings to help you visualize the accuracy. I present the results of my experiment, ebedded below.

The spreadsheet of the data that produced this chart is available here.

Code to create the chart is available here.

Read about a comparison between a wilderness GPS and a Smartphone GPS

Anyone having trouble reproducing these results feel free to email me a GPX file and I’ll send you a quick analysis of the accuracy using this method.

For those interested, the image of the above chart is inserted here, it can be used under Creative Commons license as long as you credit the source (me).

1. Leo says:

Dear Sir,

I would like to ask some questions and please kindly show me how to reach it:
1. The workflow to calculate GPS accuracy is: Get LAT/LONG -> Translate to UTM -> Calculate DeltaX and DeltaY -> Get Sigma (Standard Deviation) -> Get CEP(50%) -> Get 2DRMS(95%) -> Draw Scatter diagram. May I correct?
2. I do not know how to translate to UTM coordinates, even from your spreedsheet. It seems a lot of math in the translation. I found some pages and studying now (http://www.uwgb.edu/dutchs/UsefulData/UTMFormulas.htm). This page provided a spreedsheet to translate LAT/LONG to UTM, but when I input your data, I cannot get the same UTM coordinates. Could you show me how to use it, or do you know any library could reach it (Java / JavaScript / Python / etc.)?
3. Could I use the JavaScript you provided in the link to create the Scatter diagram?

Thx & B.R
Leo

• Leo,

Yes, your step 1 is correct except I calculate the average position and use that to get the DeltaX and DeltaY. If you are near a ground control point with a known position you could use that as a known position and calculate the deltaX and Y from there, and plot it instead.

I actually wrote my own software to convert from GPX to a CSV with UTM converted.
Someone else contacted me and I advised him to use this online batch converter http://www.earthpoint.us/BatchConvert.aspx
This presupposes you have edited the GPX file into a CSV already.

The coordinates in my spreadsheet are actually Transverse Mercator (not “Universal”), or more specifically they are the “Popular Mercator Transform” as used by Google, Bing and other online mapping platforms. You should be able to get the same results with UTM as long as you are not near a zone boundary.

Feel free to use the javascript I have on the page.

I would be interested to see your results if you have time to email or post them?

Also, do you think this is something that I should write into a web page so people can upload their own GPS files and I would produce the scatterplot?

• Leo says:

Dear Sir,

Sorry for late reply. I do not think CEP is familar to end-user. We are the manufactoring company so we need to learn it. But if you could provide an on-line service, I think it will be very popular in this industry…ccc

Do you know Garmin’s DNRGPS tool? It could calcuate CEP / 2DRMS too. But I use it to verify with your result, it’s a little big variance. But personal I think your formula is correct.

I also have a GPX for comparison. Are you interesting to compare this GPX file with Garmin tool and yours?

Thx & B.R
Leo

• Leo;

Thanks for the tip on the DNRGPS tool, I had heard of it but did not know it tried to calculate CEP. I will give it a try with my data and see what it says.

It’s very nice to have readers like you.

• Leo says:

Dear Michael,

It’s great to learn this topic from your blog. I am the newer of this field and have no common sense of GPS, map and cooridations. What I do is to record latitude / longitude on an Android device, then translate to UTM easting / northing (WGS84 – http://www.ibm.com/developerworks/cn/java/j-coordconvert/), then got CEP / 2DRMS. The result is different with Garin DNRGPS tool, so I would like to check with your expert experiecne:)

2. amir says:

Dear Michael,

I have a question regard to the data file. I did not get the point for the numbers below delta x and delta Y. thanks

3. amir says:

Dear Sir,

It was so interesting method, I would like to use it for my master thesis, but I have problem to plot the diagram, I could not get it, well I tried to share my spreadsheet but gave me error. could you please guide me in this case.

• Amir; I’m not sure what you mean by “the numbers below delta x and delta y”.
As for plotting the coordinates, the easiest way is to project them into a “Web Mercator” projection which is the number of meters in the X and Y from the equator. This lets you plot the position in meters and measure the error in those same units.

4. Nick Saunders says:

Hi Michael
Thank you for your interesting posts. I must admit, i thought the error shown on my GPS would be at the 95% level (+_ 1.96 sd), so it’s interesting to find out it is not so.
I have a question though. I live in the UK and have a second hand GPSMAP 60Cx with Topo UK installed. I use it for conservation work, to help locate the nest boxes we use for the hazel dormouse, and recently used it to take locations of radio tagged adders (our only venomous snake) on our local hills. I take average readings (button on mark Waypoint page) of the grid ref and the it usually shows about 3-6m accuracy within a couple of minutes, depending on how clear the view of the sky is. I also use it to help find new walks.
I plot all of these using Mapyx Quo software on the 1:25000 UK maps.

My query is about your method of measuring accuracy of a GPS, as I always thought that to get an accurate grid ref you had to at least have walked enough to allow the device to triangulate it’s position with the satellites, and that if you just keep it stationary the accuracy will deteriorate. Does this mean that when you are moving, you get a smaller CEP than when stationary or is this wrong?

I have done a short trial of taking readings when keeping my GPS stationary, and the plot of the static ‘track’ is a random wandering over about 20+m over about 4 hours, when in fact it is just on a table in the garden. I can see that you could use statistics (as you show) with a large number of measurements over time to get a good estimate of the position this way, but does the lack of movement reduce the accuracy of the calculation of the CEP?

Many thanks.

• Nick;

As far as I can tell moving the GPS receiver is not required to get a fix.

The GPS calculation can very roughly be described as “triangulation” but the math is much more involved, and too long to go into here. Suffice it to say that there must be a minimum of two, preferably three GPS satellites in view (receiving a strong signal) to achieve “triangulation” and that is all that is required. Moving the receiver does not help.

Interestingly, there is something you can do if you know your receiver will normally be moving, as is the case for automobile GPS units. It’s “expensive” to perform the calculations to derive a solution, or a “fix”. If you’re a developer of a GPS unit that you kno is normally going to me moving, you can discard calculations early on when you know the solution is going to be low quality, either because of a bad signal or some other test for the amount of error in the solution.

For example, there’s a “multipath” effect when the GPS signal bounces off an object (building, mountain etc) that will introduce error into the calculation. If you are moving, you can simply discard the calculation and take another sample in a few microseconds, when hopefully the multipath effect is gone because the receiver moved.

There are many other “hacks” that a moving GPS unit can use to make it look like the accuracy is higher than it is. By using a Kallman filter, the unit can attempt to predict the next position based on the previous positions. Automobile GPS units can also “snap” to a road, making it appear that it is very accurate when in fact it’s guessing the location based on the highest likelihood.

In summary, lack of movement does not decrease Accuracy. The 20m drift you are observing is normal, and is very similar to what I observe here. In fact you should also notice that the error skews slightly more in the north/south orientation as the accuracy is slightly lower for latitude.

5. colin says:

Was WAAS enabled? (It looks like it is by default)

The manual for this device says that with WAAS the device should have a 95% confidence interval to 3-5 meters.

That seems pretty far off from what is shown here.

6. Albert says:

Hi Michael, excellent post. I ask you, how can you calculate the altitude’s accuracy?

Thank you very much

• There’s two ways
1) compare the GPS accuracy with a standard (barometric, or LIDAR)
2) do what I did with the position and record the values over a period of time and use the variance estimate the error in the calculation.

That’s the best I can do.

7. Richard Hall says:

2 quick questions.
1) Are you calculating GPS precision, not GPS accuracy, because you calculate the CEP etc. with regard to the mean (centroid) of the points, as opposed to the true position?
2) Where did you get the 0.59 from in the CEP formula? The wiki https://en.wikipedia.org/wiki/Circular_error_probable says that CEP = 0.4163 * 2DRMS, and there seem to be other definitions out there
https://www.novatel.com/assets/Documents/Bulletins/apn029.pdf

• Thanks for the question, you made me go back and look. Also noticed the latex isn’t processing any more.

1) Yes, it’s precision as a proxy for accuracy. We’re assuming that since there’s no longer any selective availability that recorded positions are in a gaussian distribution around the “actual” position. We make this assumption for the purposes of the demo and to show how the device behaves, and to give users a better insight into what the displayed confidence means.

2) The link you provided shows the formula as
CEP = 0.62 sigmaX + 0.56 sigmaY

Where sigmaX and sigmaY are the standard deviations of the X and Y components of the GPS signal. I think that there are different values for X and Y because the GPS is slightly more accurate on one axis over the other, and the charts should actually be ellipses.

if you average the two values (0.62+0.56)/2 = 0.59
CEP = 0.59 (sigmaX + sigmaY)

I don’t recall where I found this originally, even some of this links in this post are broken now. I should go back and change the formula, but it seems like a lot of work to dig up all the code and data now. I may revisit this at a future date at which point I’ll update the formulas.

• Richard says:

Hi Michael,

Thanks for the quick reply! I am trying to reproduce these results and images using R (trying to learn R for research purposes to look at GPS on a UAV).

Sadly I spent all yesterday but have been unable to figure out how to get from Lat/Long to UTM Easting/UTM Northing in your spreadsheet. I tried the batch converter http://www.earthpoint.us/BatchConvert.aspx (set to ALL) but that didn’t work.

Here is my working R code. Note I tried all zones from 1-60 but no joy!
—-
library(rgdal)

LatLong <- data.frame(X = c(49.28805728, 49.2880727), Y = c(-122.9803498, -122.9803267))
names(LatLong) <- c("X","Y")

# Convert it to a sp object
coordinates(LatLong) <- ~ Y + X # longitude first

# Add a coordinate reference system
proj4string(LatLong) <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")

LatLong

# Project using spTransform
Utm Utm
#SpatialPoints:
# Y X
#[1,] 501429.0 5459479
#[2,] 501430.6 5459480
#Coordinate Reference System (CRS) arguments: +proj=utm +zone=10
#ellps=WGS84 +ellps=WGS84

#——————For finding the zone

long2UTM <- function(long) {
(floor((long + 180)/6) %% 60) + 1
}
x<-long2UTM(-122.9803498)
x

Thankyou so much for providing this informative page and responding!

8. Niranj says:

Hey Michael,

Do you happen to have a method, formula or code to calculate the HDOP, VDOP and PDOP when the cartesian coordinates of a location and that of the satellites are known. It would be of great help.

Thanks,

• I do not have such a formula.

The HDOP, VDOP and PDOP are calculated from the satellite positions and the signal timing, and no consumer grade GPS unit gives you access to that data.

i want my GPS data to be plotted on chart as you have done above but i don’t know what edit in my html file code. Can you please help me plotting my data if i share my spreadsheets with you ?

• If you convert your coordinates to UTM or Web Mercator this gives you the position in meters. Take the average of all of the points and use that as the “zero”, calculating the offsets from that point. Then you can plot the distribution around that point.

10. Alaeddine says:

Hi Michael,

Can I calculate CEP using HDOP , VDOP and PDOP ?

Thanks

Alaeddine

11. Hello Michael,

I looked at your excel table and there is something i dont get. By using the first Lat-Lon pair on your excel (Lat:49.28805728 & Long:-122.9803498), i get other Easting & Northing results by using some UTM conversion sites.. You have: UTM Easting:-13690109.91, UTM Northing:6323880.783 but i get: UTM Easting:501428.94 & UTM Northing:5459478.70. Am i doing something wrong? Did you use WGS84 for your calculations? Please help me out.

• Good eye!

Those are in fact spherical Mercator coordinates, not Universal Transverse Mercator. UTM divides the Mercator projection into zones, so to simplify the calculations I used Spherical Mercator so I didn’t have to account for zone boundaries.

12. Ekta Patel says:

Hi Micheal,
This is really good article and helped me alot, but when I tried to convert latitude/longitude into UTM it says Heading row not found

13. Josh Lockerby says:

I recently did some of my own evaluations on a Garmin 66SR and began to troll the Internet to see if anyone else had done anything similar and I came across your site. I am not an expert with statistics, but I was glad to see someone else took a similar approach to analyzing the data (I took a 12 hour sample at 3 second interval and imported to QGIS only to export the track points to CSV with UTM coordinate and did the standard deviation calculations in LibreOffice). The 66SR had a single standard deviation of ~1.1m (I live in Portland, OR, USA and tested in a location with mostly open skies) – so I was kind of surprised you had a ~7.4m standard deviation because my 66SR had a standard deviation of ~1.8m in GPS only mode. I have done other tests of less sampling that indicated a standard deviation of ~4m under dense tree cover in a shallow canyon. One other comment, I think it to be good practice to multiply the standard deviation distance by 1.37 (or round to 1.4) in circumstances where the location you are looking for is marked previously by your device (if I took a waypoint with a 95% and wanted to return to it by GPS, wouldn’t that mean you had a 95% chance of 95% chance (or ~91% chance)?

• Thanks for commenting.

The newer GPS units have GLONASS and some have GALILEO which gives more satellites to perform the calculation. For my tests I live near a huge rock cliff which likely made the accuracy lower.

14. Mary says:

Hi Michael,

It is very interesting to have the calculation of CEP . I have been searching for it for a month. Thanks that you have figured it out step by step. In what software did you use these codes. I have a short period of time hence can you send the software so that I can credit your name .

15. Clem F. says:

Would be interesting to see an update to this post with modern smartphone that have GLONASS, GALILEO and BeiDou on top of GPS.


text:
# Combinations of a jigsaw

I'm just asking myself of how many combinations you would have to go through to solve a jigsaw puzzle by "brute force" if you have $n = (p \times q)$ pieces. To simplify that, I assume that there are no jigsaw pieces with flat edges so that every piece can be at every position.

I've came up with this for the number of combinations $C$: $$C(n) = n! * 4^n$$ $n!$ would be the number of options to arrange the pieces and for each of these options there should be $4^n$ possibilities to rotate them.

Can anyone verify that? Or am I doing a mistake?

Thank you very much in advance

-

Yes, that's right.

But it assumes that you can only detect that you have something wrong once you put down the last piece. Usually one can notice that without all pieces placed that the ones that are placed yet don't match up. Doing so leads to a branch-and-bound search which can be quite a bit faster if you're good at detecting wrong branches early.

-
Thank you for the quick response. Yes, I'm aware of that limitation but I just wanted to knew how mouch steps it's going to take in the worst case. –  George Jan 5 '13 at 11:45
One of all these combinations will solve your puzzle, only upside-down :) –  Hendrik Jan Jan 5 '13 at 14:11
How do you mean that? –  George Jan 5 '13 at 15:20
One of your many combinations $C(n)$ is also a solution of the puzzle, but upside down, i.e., rotated 180 degrees. Would that also solve your puzzle? I was (jokingly) suggesting that the worst case scenario would be one step faster. –  Hendrik Jan Jan 6 '13 at 11:14


text:
# Divergence Free Vector Fields that are undefined at the origin

I am aware of vector fields which are undefined at the origin but whose divergence everywhere else is 0. In particular, my students have already seen the inverse square vector field, i.e. $\vec{F}=\frac{\vec{r}}{||\vec{r}||^3}$ where $\vec{r}=\langle x,y,z \rangle$ and the vector field for an ideal electric dipole $\vec{E}=\nabla \left(\frac{z}{||r||^3} \right)$.

Are there still other examples of divergence free vector fields that blow up at the origin? I want to hammer the concept of computing the flux of these vector fields across solids which enclose the origin by constructing a smaller solid inside (whose flux we can easily compute) and applying the divergence theorem to the solid sandwiched in between.

Thanks!

• Hmm, you could look into the magnetic vector potential $\vec{A}$. – WalyKu Apr 30 '14 at 17:40

Since divergence $\nabla$ is linear operator, the simplest way to construct another examples of such an field from the known example would be simply adding adding well-behaved divergence-free field to this one.
Another way would be directed derivative of this field. This works, because if $\nabla \cdot \vec F = 0$, then
$$\nabla \cdot [(\vec a \cdot \nabla) \vec F] = (\vec a \cdot \nabla) \nabla \cdot \vec F = 0$$
so, if $\vec F$ is divergence-free, then $(\vec a \cdot \nabla) \vec F$ is also divergence-free for some constant vector $\vec a$, but it still blows up at origin if $\vec F$ blows up at origin. Needless to say, one can repeat this arbitrarily many times, so
$$(\vec a_1 \cdot \nabla)(\vec a_2 \cdot \nabla)...(\vec a_n \cdot \nabla) \vec F$$


text:
Courses
Courses for Kids
Free study material
Free LIVE classes
More

# NCERT Solutions for Class 12 Maths Chapter 8 Application of Integrals (Ex 8.2) Exercise 8.2

## NCERT Solutions for Class 12 Maths Chapter 8 Application of Integrals (Ex 8.2) Exercise 8.2

Last updated date: 25th Jan 2023
Total views: 441.3k
Views today: 8.35k

Free PDF download of NCERT Solutions for Class 12 Maths Chapter 8 Exercise 8.2 (Ex 8.2) and all chapter exercises at one place prepared by expert teacher as per NCERT (CBSE) books guidelines. Class 12 Maths Chapter 8 Application of Integrals Exercise 8.2 Questions with Solutions to help you to revise complete Syllabus and Score More marks. Register and get all exercise solutions in your emails.

Competitive Exams after 12th Science
Do you need help with your Homework? Are you preparing for Exams?
Study without Internet (Offline)

## Access NCERT Solution for Class 12 Maths Chapter 8 – Application of Integrals

Exercise 8.2

1. Find the area of the circle$4{x^2} + 4{y^2} = 9$ which is interior to the parabola${x^2} = 4y$.

Ans:

Solving the given equation of circle, $4{x^2} + 4{y^2} = 9$and the parabola ${x^2} = 4y$

$4\left( {4y} \right) + 4{y^2} = 9$

$4{y^2} + 16y - 9 = 0$

$y = \dfrac{{ - 16 \pm \sqrt {{{16}^2} - 4 \times 4 \times \left( { - 9} \right)} }}{{2 \times 4}}$

$y = \dfrac{1}{2}{\text{ or }} - 4.5$

The value of $y$ cannot be negative as ${x^2} = 4y$

We obtain the point of intersection as $B\left( {\sqrt 2 ,\dfrac{1}{2}} \right)$ and$D\left( { - \sqrt 2 ,\dfrac{1}{2}} \right)$

It can be observed that the required area is symmetrical about y-axis.

$\therefore {\text{Area OBCDO = 2 . Area OBCO}}$

We draw ${\text{BM}}$ perpendicular to ${\text{OA}}$.

Therefore, the coordinates of ${\text{M}}$are $\left( {\sqrt 2 ,0} \right)$,

Therefore, ${\text{Area OBCO = Area OMBCO -- Area OMBO}}$

${\text{Area OMBCO}} =$Area under the circle $4{x^2} + 4{y^2} = 9$ between $x = 0$and $x = \sqrt 2$

${\text{Area OMBCO}}$= $\int\limits_0^{\sqrt 2 } {\sqrt {\dfrac{{9 - 4{x^2}}}{4}} dx}$

$= \int\limits_0^{\sqrt 2 } {\sqrt {\dfrac{{9 - 4{x^2}}}{4}} dx}$

Substitute $x = \dfrac{3}{2}\sin \theta$,$dx = \dfrac{3}{2}\cos \theta d\theta$

then,

$\int {\sqrt {\dfrac{9}{4} - \dfrac{9}{4}{{\sin }^2}\theta } \dfrac{3}{2}\cos \theta d\theta }$

$= \dfrac{9}{4}\int {\sqrt {1 - {{\sin }^2}\theta } \cos \theta d\theta }$

$= \dfrac{9}{4}\int {{{\cos }^2}\theta d\theta }$

$= \dfrac{9}{4}\int {\dfrac{{1 + \cos 2\theta }}{2}d\theta }$

$= \dfrac{9}{4}\int {\dfrac{1}{2} + \dfrac{{\cos 2\theta }}{2}d\theta }$

$= \dfrac{9}{8}\left[ {\theta + \dfrac{{\sin 2\theta }}{2}} \right]$

$= \dfrac{9}{8}\left[ {\theta + \dfrac{{2\sin \theta \cos \theta }}{2}} \right]$

$= \dfrac{9}{8}\left[ {{{\sin }^{ - 1}}\dfrac{{2x}}{3} + \dfrac{{2x}}{3}\sqrt {1 - \dfrac{{4{x^2}}}{9}} } \right]$

Applying the limits, then

$= \dfrac{9}{8}\left[ {{{\sin }^{ - 1}}\dfrac{{2x}}{3} + \dfrac{{2x}}{9}\sqrt {4{x^2} - 9} } \right]_0^{\sqrt 2 }$

$= \dfrac{9}{8}\left[ {{{\sin }^{ - 1}}\dfrac{{2\sqrt 2 }}{3} + \dfrac{{2\sqrt 2 }}{9}\sqrt {4 \times 2 - 9} - 0} \right]$

${\text{Area OMBCO}}$$= \dfrac{1}{4}\left[ {\sqrt 2 + \dfrac{9}{2}{{\sin }^{ - 1}}\dfrac{{2\sqrt 2 }}{3}} \right]$…………….. (1)

${\text{Area OMBCO}}$${\text{ = }}$Area under between${x^2} = 4y$and$x = 0$and$x = \sqrt 2$

${\text{Area OMBO}}$$= \int\limits_0^{\sqrt 2 } {\dfrac{{{x^2}}}{4}}$

$= \dfrac{1}{4}\left[ {\dfrac{{{x^3}}}{3}} \right]_0^{\sqrt 2 }$

${\text{Area OMBO}}$$= \dfrac{1}{{12}}\left[ {2\sqrt 2 } \right] = \dfrac{{\sqrt 2 }}{6}$…………… (2)

From (1) and (2)

${\text{Area OBCO }}$$= \dfrac{{\sqrt 2 }}{2} + \dfrac{9}{8}{\sin ^{ - 1}}\dfrac{{2\sqrt 2 }}{3} - \dfrac{{\sqrt 2 }}{6}$

$= \dfrac{{\sqrt 2 }}{{12}} + \dfrac{9}{8}{\sin ^{ - 1}}\dfrac{{2\sqrt 2 }}{3}$

$= \dfrac{1}{2}\left( {\dfrac{{\sqrt 2 }}{6} + \dfrac{9}{4}{{\sin }^{ - 1}}\dfrac{{2\sqrt 2 }}{3}} \right)$

Then the required area ${\text{ OBCDO}}$ is$= 2 \times \dfrac{1}{2}\left( {\dfrac{{\sqrt 2 }}{6} + \dfrac{9}{4}{{\sin }^{ - 1}}\dfrac{{2\sqrt 2 }}{3}} \right)$

$= \dfrac{{\sqrt 2 }}{6} + \dfrac{9}{4}{\sin ^{ - 1}}\dfrac{{2\sqrt 2 }}{3}sq.units$

2. Find the area bounded by curves ${\left( {x - 1} \right)^2} + {y^2} = 1$and ${x^2} + {y^2} = 1$

Ans: The are bounded by the curves, ${\left( {x - 1} \right)^2} + {y^2} = 1$and${x^2} + {y^2} = 1$, is represented by the shaded area as

On solving the equations,${\left( {x - 1} \right)^2} + {y^2} = 1$ and ${x^2} + {y^2} = 1$

${\left( {x - 1} \right)^2} + 1 - {x^2} = 1$

$- 2x + 1 = 0$

$x = \dfrac{1}{2}$

${y^2} = 1 - {x^2}$

$= 1 - \dfrac{1}{4} = \dfrac{3}{4}$

we obtain the point of intersection as $A\left( {\dfrac{1}{2},\dfrac{{\sqrt 3 }}{2}} \right)$and$B\left( {\dfrac{1}{2}, - \dfrac{{\sqrt 3 }}{2}} \right)$

It can be observed that the required area is symmetrical about x-axis.

$\therefore {\text{ Area OBCAO = }}2 \times {\text{Area OCAO}}$

We join ${\text{AB}}$ which intersects ${\text{OC}}$at ${\text{M}}$, such that ${\text{AM}}$ is perpendicular to ${\text{OC}}$.

The coordinates of M are$\left( {\dfrac{1}{2},0} \right)$.

$\Rightarrow {\text{ Area OCAO = Area OMAO}} + {\text{Area MCAM}}$

$= \int\limits_0^{\dfrac{1}{2}} {\sqrt {1 - {{\left( {x - 1} \right)}^2}} dx + } \int\limits_{\dfrac{1}{2}}^1 {\sqrt {1 - {x^2}} dx}$

$= \left[ {\dfrac{{x - 1}}{2}\sqrt {1 - {{\left( {x - 1} \right)}^2}} + \dfrac{1}{2}{{\sin }^{ - 1}}\left( {x - 1} \right)} \right]_0^{\dfrac{1}{2}} + \left[ {\dfrac{x}{2}\sqrt {1 - {x^2}} + \dfrac{1}{2}{{\sin }^{ - 1}}x} \right]_{\dfrac{1}{2}}^1$

$= \left[ {\dfrac{{ - 1}}{4}\sqrt {1 - {{\left( { - \dfrac{1}{2}} \right)}^2}} + \dfrac{1}{2}{{\sin }^{ - 1}}\left( {\dfrac{1}{2} - 1} \right) - \dfrac{1}{2}{{\sin }^{ - 1}}\left( { - 1} \right)} \right]_0^{\dfrac{1}{2}} + \left[ {\dfrac{1}{2}{{\sin }^{ - 1}}\left( 1 \right) - \dfrac{1}{4}\sqrt {1 - {{\left( {\dfrac{1}{2}} \right)}^2}} - \dfrac{1}{2}{{\sin }^{ - 1}}\left( {\dfrac{1}{2}} \right)} \right]_{\dfrac{1}{2}}^1$

$= \left[ { - \dfrac{{\sqrt 3 }}{8} + \dfrac{1}{2}\left( { - \dfrac{\pi }{6}} \right) - \dfrac{1}{2}\left( { - \dfrac{\pi }{2}} \right)} \right] + \left[ {\dfrac{1}{2}\left( {\dfrac{\pi }{2}} \right) - \dfrac{{\sqrt 3 }}{8} - \dfrac{1}{2}\left( {\dfrac{\pi }{6}} \right)} \right]$

$= - \dfrac{{\sqrt 3 }}{4} - \dfrac{\pi }{{12}} + \dfrac{\pi }{4} + \dfrac{\pi }{4} - \dfrac{\pi }{{12}}$

$= - \dfrac{{\sqrt 3 }}{4} + \dfrac{{2\pi }}{6}$

Therefore, required area ${\text{OBCAO}}$$= 2 \times \left( {\dfrac{{2\pi }}{6} - \dfrac{{\sqrt 3 }}{4}} \right)$

$= \left( {\dfrac{{2\pi }}{3} - \dfrac{{\sqrt 3 }}{2}} \right)sq.units$

3. Find the area of the region bounded by the curves$y = {x^2} + 2$,$y = x$,$x = 0$ and$x = 3$.

Ans: The area bounded by the curves,$y = {x^2} + 2$,$y = x$,$x = 0$ and $x = 3$, is represented by the area ${\text{OCBAO}}$as

Then, ${\text{Area OCBAO = Area ODBAO -- Area ODCO}}$

$= \int\limits_0^3 {\left( {{x^2} + 2} \right)dx} - \int\limits_0^3 {xdx}$

$= \left[ {\dfrac{{{x^3}}}{3} + 2x} \right]_0^3 - \left[ {\dfrac{{{x^2}}}{2}} \right]_0^3$

$= \left[ {9 + 6} \right] - \left[ {\dfrac{9}{2}} \right]$

$= 15 - \dfrac{9}{2}$

Therefore, required area$= \dfrac{{21}}{2}sq.units$

4. Using integration find the area of the region bounded by the triangle whose vertices are$\left( { - 1,0} \right)$,$\left( {1,3} \right)$ and$\left( {3,2} \right)$.

Ans: BL and CM are drawn perpendicular to x-axis.

It can be observed in the following figure that,

${\text{Area}}\left( {\Delta {\text{ACB}}} \right) = {\text{Area}}\left( {{\text{ALBA}}} \right) + {\text{Area}}\left( {{\text{BLMCB}}} \right){\text{ - Area}}\left( {{\text{AMCA}}} \right)$………

Equation of line segment ${\text{AB}}$is

${\text{y - 0 = }}\dfrac{{3 - 0}}{{1 + 1}}\left( {x + 1} \right)$

$y = \dfrac{3}{2}\left( {x + 1} \right)$

$\therefore {\text{Area}}\left( {{\text{ALBA}}} \right) = \int\limits_{ - 1}^1 {\dfrac{3}{2}\left( {x + 1} \right)dx} = \dfrac{3}{2}\left[ {\dfrac{{{x^2}}}{2} + x} \right]_{ - 1}^1$

$= \dfrac{3}{2}\left[ {\dfrac{1}{2} + 1 - \dfrac{1}{2} + 1} \right] = 3{\text{ }}sq.units$

Equation of line segment ${\text{BC}}$ is

${\text{y - 3 = }}\dfrac{{2 - 3}}{{3 - 1}}\left( {x - 1} \right)$

$y = \dfrac{1}{2}\left( { - x + 7} \right)$

$\therefore {\text{Area}}\left( {{\text{BLMCB}}} \right) = \int\limits_1^3 {\dfrac{1}{2}\left( { - x + 7} \right)dx} = \dfrac{1}{2}\left[ { - \dfrac{{{x^2}}}{2} + 7x} \right]_1^3$

$= \dfrac{1}{2}\left[ { - \dfrac{9}{2} + 21 + \dfrac{1}{2} - 7} \right] = 5{\text{ }}sq.units$

Equation of line segment ${\text{AC}}$is

${\text{y - 0 = }}\dfrac{{2 - 0}}{{3 + 1}}\left( {x + 1} \right)$

$y = \dfrac{1}{2}\left( {x + 1} \right)$

$\therefore {\text{Area}}\left( {{\text{AMCA}}} \right) = \int\limits_{ - 1}^3 {\dfrac{1}{2}\left( {x + 1} \right)dx} = \dfrac{1}{2}\left[ {\dfrac{{{x^2}}}{2} + x} \right]_{ - 1}^3$

$= \dfrac{1}{2}\left[ {\dfrac{9}{2} + 3 - \dfrac{1}{2} + 1} \right] = 4{\text{ }}sq.units$

Therefore, From equation,we obtain

${\text{Area}}\left( {\Delta {\text{ACB}}} \right) = 3 + 5 - 4 = 4{\text{ }}sq.units$

5. Using integration find the area of the triangular region whose sides have the equations $y = 2x + 1$,$y = 3x + 1$and$x = 4$.

Ans:The equations of sides of the triangle are $y = 2x + 1$,$y = 3x + 1$and $x = 4$.

On solving these equations, we obtain the vertices of triangle as ${\text{A}}\left( {0,1} \right)$,${\text{B}}\left( {4,13} \right)$and ${\text{C}}\left( {4,9} \right)$.

It can be observed that,

${\text{Area }}\left( {\Delta {\text{ACB}}} \right) = {\text{Area }}\left( {{\text{OLBAO}}} \right) - {\text{Area}}\left( {{\text{OLCAO}}} \right)$

$= \int\limits_0^4 {\left( {3x + 1} \right)dx} - \int\limits_0^4 {\left( {2x + 1} \right)dx}$

$= \left[ {\dfrac{{3{x^2}}}{2} + x} \right]_0^4 - \left[ {\dfrac{{2{x^2}}}{2} + x} \right]_0^4$

$= \left( {24 + 4} \right) - \left( {16 + 4} \right)$

$= 28 - 20$

Therefore, required area $= 8{\text{ }}sq.units$

6. Smaller area enclosed by the circle ${x^2} + {y^2} = 4$and the line $x + y = 2$is

(A)  $2\left( {\pi - 2} \right)$(B)$\pi - 2$   (C) $2\pi - 1$  (D)$2\left( {\pi + 2} \right)$

Ans: The smaller area enclosed by the circle${x^2} + {y^2} = 4$ and the line$x + y = 2$, is represented by the area ${\text{ACBA}}$ as

It can be observed that

${\text{Area }}\left( {{\text{ACBA}}} \right) = {\text{Area }}\left( {{\text{OACBO}}} \right) - {\text{Area}}\left( {\Delta {\text{OAB}}} \right)$

$= \int\limits_0^2 {\sqrt {4 - {x^2}} dx} - \int\limits_0^2 {\left( {2 - x} \right)dx}$

$= \left[ {\dfrac{x}{2}\sqrt {4 - {x^2}} + \dfrac{4}{2}{{\sin }^{ - 1}}\dfrac{x}{2}} \right]_0^2 - \left[ {2x - \dfrac{{{x^2}}}{2}} \right]_0^2$

$= \left[ {2\dfrac{\pi }{2}} \right] - \left[ {4 - 2} \right]$

$= \left( {\pi - 2} \right){\text{ }}sq.units$

Thus, the correct answer is ${\text{B}}$.

7. Area lying between the curves ${y^2} = 4x$and$y = 2x$ is

(A)$\dfrac{2}{3}$  (B)  $\dfrac{1}{3}$ (C) $\dfrac{1}{4}$  (D)$\dfrac{3}{4}$

Ans:The area lying between the curves${y^2} = 4x$and $y = 2x$, is represented by the shaded area ${\text{OABO}}$ as

The points of intersection of these curves are ${\text{O}}\left( {0,0} \right)$ and ${\text{A}}\left( {1,2} \right)$

We draw ${\text{AC}}$ perpendicular to $x{\text{ - axis}}$ such that the coordinates of ${\text{C}}$ are $\left( {1,0} \right)$

${\text{Area }}\left( {{\text{OBAO}}} \right) = {\text{Area }}\left( {\Delta {\text{OCA}}} \right) - {\text{Area}}\left( {{\text{OCABO}}} \right)$

$= \int\limits_0^1 {2xdx} - \int\limits_0^1 {2\sqrt x dx}$

$= 2\left[ {\dfrac{{{x^2}}}{2}} \right]_0^1 - 2\left[ {\dfrac{{{x^{\dfrac{3}{2}}}}}{{\dfrac{3}{2}}}} \right]_0^1$

$= \left| {1 - \dfrac{4}{3}} \right|$

$= \left| { - \dfrac{1}{3}} \right|$

$= \dfrac{1}{3}{\text{ }}$sq.units

Thus, the correct answer is ${\text{B}}$.

### NCERT Solution Class 12 Maths of Chapter 8 All Exercises

 Chapter 8 - Application of Integrals Exercises in PDF Format Exercise 8.1 13 Questions & Solutions (11 Short Answers, 2 MCQs) 7 Questions & Solutions (5 Short Answers, 2 MCQs)

## NCERT Solutions for Class 12 Maths Chapter 8 Application of Integrals Exercise 8.2

Opting for the NCERT solutions for Ex 8.2 Class 12 Maths is considered as the best option for the CBSE students when it comes to exam preparation. This chapter consists of many exercises. Out of which we have provided the Exercise 8.2 Class 12 Maths NCERT solutions on this page in PDF format. You can download this solution as per your convenience or you can study it directly from our website/ app online.

Vedantu in-house subject matter experts have solved the problems/ questions from the exercise with the utmost care and by following all the guidelines by CBSE. Class 12 students who are thorough with all the concepts from the Maths textbook and quite well-versed with all the problems from the exercises given in it, then any student can easily score the highest possible marks in the final exam. With the help of this Class 12 Maths Chapter 8 Exercise 8.2 solutions, students can easily understand the pattern of questions that can be asked in the exam from this chapter and also learn the marks weightage of the chapter. So that they can prepare themselves accordingly for the final exam.

Besides these NCERT solutions for Class 12 Maths Chapter 8 Exercise 8.2, there are plenty of exercises in this chapter which contain innumerable questions as well. All these questions are solved/answered by our in-house subject experts as mentioned earlier. Hence all of these are bound to be of superior quality and anyone can refer to these during the time of exam preparation. In order to score the best possible marks in the class, it is really important to understand all the concepts of the textbooks and solve the problems from the exercises given next to it.

Do not delay any more. Download the NCERT solutions for Class 12 Maths Chapter 8 Exercise 8.2 from Vedantu website now for better exam preparation. If you have the Vedantu app in your phone, you can download the same through the app as well. The best part of these solutions is these can be accessed both online and offline as well.

## FAQs on NCERT Solutions for Class 12 Maths Chapter 8 Application of Integrals (Ex 8.2) Exercise 8.2

1. Which formula to use to calculate the region with curve y = f (x), where x-axis and the lines x = a and x = b (b > a) ?

In order to calculate the region which is bounded by the curve y = f (x), where x-axis and the lines x = a and x = b (b > a), you will use the formula ∫ba ydx =  ∫ba f (x)dx. To have a better comprehension of the exercise, use Vedantu’s NCERT Solutions Class 12 Maths Chapter 8 Exercise 8.2. It is comprehensive as it touches each and every important aspect of the questions - from stepwise solutions to the application of formulas.

2. How many questions are there in Exercise 8.2 of Chapter 8 of Class 12 Maths?

There are seven important questions in total in Exercise 8.2 of Chapter 8 of Class 12 Maths. The questions are essentially based on the area between two curves. To solve this exercise smoothly, you must consider referring to NCERT Solutions of  Exercise 8.2 of Chapter 8 of Class 12 Maths crafted by the experts at Vedantu. These expert solutions are simplified making them easy to perceive. Using this solution will help you in overcoming all the difficulties that you are facing in this exercise.

3. Is Exercise 8.2 of Chapter 8 of Class 12 Maths optional?

No, NCERT Exercise 8.2 of Chapter 8 of Class 12 Maths is not optional in nature. It is very important from the examination perspective. It is, therefore, essential that you solve the full exercise. For the smooth practice of this chapter, you can make use of the NCERT Solutions of Exercise 8.2 of Chapter 8 of Class 12 Maths from Vedantu. Vedantu’s solutions are easy to understand. Every solution is described in a way to teach students how to get full marks from this exercise.

4. How to solve Exercise 8.2 of Chapter 8 of Class 12 Maths?

In order to solve Exercise 8.2 of Chapter 8 of Class 12 Maths, you can start with practising examples 6 to 10 and then start solving Exercise 8.2. In case you need some assistance in solving these questions, you can refer to the best NCERT Solutions for Exercise 8.2 of Chapter 8 of Class 12 Maths that you will be able to find only on Vedantu. Download the NCERT Solutions for Class 12 Maths and use them at your ease.

5. Is Chapter 8 of Class 12 Maths very hard?

No, Chapter 8 of Class 12 Maths is not at all difficult for those who solve and practice the chapter rigorously. Thorough practice of the chapter will help you in getting a better grasp of the topics that have been touched on in the chapter. NCERT Solutions of Exercise 8.2 of Chapter 8 of Class 12 Maths on Vedantu is the best companion for you - you can take clues from the NCERT Solutions PDF and try solving the sums. The solutions are free of cost and also available on Vedantu Mobile app.