Computer Lab #1: Introduction To Wolfram Alpha

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Computer Lab

: Introduction to Wolfram Alpha

Introduction: Many of the techniques in calculus are based on rm rules. It is therefore possible to program a computer to perform such operations, and indeed the last decades have seen the arrival of many computer algebra systems, for example Maple, Matlab, Mathematica, MuPAD, Reduce or Derive (to just name a few prominent ones). ese systems provide complete programming environments. In this course we will use a web-based system, called Wolfram Alpha (we will use the abbreviation W from now on) which is based on the engine underlying Mathematica. e choice was chosen primarily as it is easily accessible and free to use. However it is more limited than the full-featured systems available commercially. e use of this computational tool will allow us to study phenomena without being hampered by the need to perform di cult calculations by hand, and this is what we will do in these labs. Each of the labs will introduce a few techniques and then ask you to use these techniques in your own investigation of given problems. You should follow through the lab description and issue the commands given to see the system behavior. e labs also serve as a practice on writing reports, something you will have to do in your job as mathematician, scientist or engineer. We will give you more information about this towards the end of this lab. Given the capabilities of such a system, you also might wonder why we (still) teach these techniques? ( ough you also still learn writing though there are computers and printers.) e reasons are that even the best programs still have bugs (and understanding of the concepts is necessary to realize that a bug happened), and they still are not as powerful as a human. e mastery of integration techniques also serves as a good training towards using higher level techniques that you will encounter in your subject courses in higher semesters. Weve also talked to faculty in many disciplines outside mathematics and again and again got the response that they felt integration techniques were a valuable tool to know and should be taught in a calculus course. We also understand that tools like W will be able to solve many of the homework problems you are given, but that is no reason why you should not do the homework by hand. (A er all a solution manual, found on some dodgy website, will serve the same purpose.) Cheating on the homework will only harm you in the exams. However we encourage you to use the computer to check your results (or even in some cases as guidance to problems you dont know how to do) just resist the temptation to copy the computers work as your own. Commands Reviewed: arithmetic,?,plot,limit,diff,integrate sum x, x=1..(number of american presidents)^2

e system interface

= You start W by pointing your web browser to www. wolframalpha.com. If you have a smartphone or tablet, We will not investigate this feature but stick to rather forthere also are dedicated apps available that provide a slicker malized input.) interface. e system then returns the output in a sequence of e system gives a box into which you type your quesboxes, separated in di erent categories. (For example for a tion or command: function it might give a plot, the derivative and other properties.) Typically these boxes have a widget in the lower le = corner that lets you save the result as a graphics le (needed and you hit the return button or click the equal sign. for the lab reports!). e upper right corner might contain W then evaluates the expression and tries to perform the interactive boxes, such as more digits, or show steps. task given. Some of the boxes might involve advanced material that Sometimes the meaning of the question is not clear and we will cover only later (or only in higher level courses). W will tell you so, or tell you what it understood. ( e manufacturer also proudly claims the availability of a large Basic Algebra data base and of language parsing, such as how much does a car weigh in ounces or = For a start, lets look at some basic algebra: 1/7+1/5 =

Note that you also can use variables, and the system will work symbolically: 1/7+1/a =

Graphing Symbolic Expressions

W has a variety of plotting capabilities and commands. command. Lets consider the plot of arcsin. e rst method is to try Note that you can consider this as an algebraic expression, as an equation + a = , or as a function of a, plot arcsin(x), x=-1..0 = and W will give you answers to many of these interpretations. is of course means that you need to understand what answer you should expect to a problem (which is not In this form, we have chosen the x -axis to go from - to just given as system input). and the y-axis chosen to make the graph t. If you also wanted to specify a particular y-axis you could use Using variables we can form and solve polynomials x^2+3*x+1=0 or even (this is something hard!) polynomial systems x*y+1=0, x^2+x*y=2 = = plot arcsin(x), x=-1..0, y=-2..2 =

or for example to plot over the x -interval [ , ] use plot arcsin(x), x=-1..1, y=-2..2 =

Similarly one can calculate intersection points of functions exp(x)=cos(x) W also knows about constants, such as Pi = and for many numerical results that cannot be expressed exactly o ers the ability to obtain more digits. Note that a command cos(Pi/2) gives an exact result, while something like cos(3.1415926/2) just returns an approximation. Lets examine one more example of W ability to manipulate symbolic expressions. Recall from class that we have the cancellation equations for sin and arcsin =

Sometimes you want to use a plot to compare several functions. You can do so by enclosing the functions in squiggly brackets plot arcsin(x),cos(1/x), x=-1..1, y=-2..2

Calculus Operations

e most important operations in calculus can be performed symbolically in W . Among these we review x = arcsin(sin(x )) for x [ , ] computing limits, derivatives, and integrals. x = sin(arcsin(x )) for x [ , ] sin(x ) To compute the limit of as x approaches , type x We want to verify if these identities really work in W . Using the well known fact that limit sin(x)/x, x=0 = sin( ) = Note that if we ask instead we will evaluate the right hand side of the identities given limit sin(x)/x^2, x=0 = above sin(arcsin(1/2*2^(1/2))) arcsin(sin(Pi/4)) = = W automatically indicates that right and le sided limits di er. Di erentiation works similar: =

We see that again W performs the operations using differentiate sin(x)/x basic operations and identities, instead of doing the computation numerically. W knows about domains of func- or tions as you can see with d/dx sin(x)/x arcsin(sin(5/6*Pi)) = which generalizes easily to higher order derivatives

d^3/dx^3 sin(x)/x Similarly, we can integrate both inde nite integrate 1/(1+4*x^2) or de nite integrate 1/(1+4*x^2), x=0..1/2

Note that the inde nite integral o ers a box show steps that lets you see the integration process. You should be aware that this is not always the easiest or shortest way to solve a particular integral, but in general it works pretty well. You also should notice W o en provides links explaining what a particular function (such as tan in the example) is. It should be made clear that we have just touched on some of the capabilities of W . e system can perform the full range of algebraic manipulations, such as solving equations, simplifying equations, expanding equations, etc.

Di erential Equations
Weve looked at some basic examples of di erential equations. For example, we have seen equations of the form y(x)=5*y(x) and initial value problems such as y(x)=5*y(x), y(0)=1 = =

Now assume there growth factor depends on the value of y(x ) (say, there is limited space or resources) so we get an equation such as y (x ) = ( y ) y

( is is called the logistic equation.) Look at the solutions for a few initial values and note how the solutions always converge to the same value . in this example. We You may hand in the reports in groups of at most three, wouldnt yet know how to solve this equation, though you all three people must be in the same section. (By handing will in a course on di erential equations. in the report you assert that all members of the group contributed about equally and all understand the whole sube Report mission.) e usual rules about copying and academic As insinuated in the preamble, your homework assign- honesty apply. ment for this lab is to write a lab report. is report should You are explicitly forbidden to hand in a report based look appropriate for the work of a college student who can on work that was not done by you or not done this read and write in English. at means, the report should semester. ( is means in particular that reports that were not only lists terse answers (or formula clips), but con- handed in before by other people, or handed in in a previsists of running text that can be read and understood by ous semester are not acceptable.)

a person who has taken Calculus . Imagine that you are working for a company and your supervisor gave you these problems as a task to return the answers in written form, or imagine the lab report was to be handed out in class. e appropriate look means that (unless you have a particularly neat handwriting and can write immediately in a nal form I yet have to meet such a person) the report should be typed up in a word processor and then be submitted on paper. Many people use the program Word by Microso , but you are welcome to use whatever word processor you like for example Abiword and OpenO ce are free alternatives. If you use Word, one tool that might help you is the Symbol window. By clicking Insert and then Symbol, you get a window that will allow you to insert an assortment of symbols in your document. You can also insert an assortment of mathematical expressions by clicking Insert, then Object, and then selecting the Equation Editor. Unless you have a specialized equation package, this is the only way that you can easily include mathematics in your document. You should indicate explicitly the command you gave to W and the relevant part of its answer. In some cases a plot or graphics is part of the answer and should be included. is inclusion should be at the place to which the graphic is referred, and not just in an obscure appendix. If the graphics le requires further labeling this should be added. Also parts irrelevant to the report should be trimmed o . (Being able to do some basic editing of graphics les is a very useful skill for your work beyond this course as well, which is the reason for asking you to do so.) When it is time to insert your plot in your Word document, you click on Insert/Picture/From File. Word will give you a browsing window that will let you nd your le. You click on the le that you want inserted and it appears in your Word document where your cursor was situated. And nally, you should understand that by clicking on the plot in your Word document, Word will allow you to move the plot around and to resize it.

If you save les on the computer, make sure all lenames are unique for example calling a le hw1YourName and not just hw1 as all users are using the same class account. Also copy all les you create on a memory stick or oppy that you brought with you, as any les on the departmental machines could get erased. Good luck!

. When plotting two functions, W also shows a parametric plot. Describe what this is. (You might want to try out some functions to see what happens.) Produce a parametric plot that is a perfect circle with radius . . Compute the limit lim sin(h + x ) sin(x ) h

e Problems
Give your answers in the form of a clearly written report. You should begin with some sort of Introduction which is not just copied from this handout and end with a summary that is more than I learned how to use W . Answer the questions with complete sentences. Include the W graphs into your text (not at the end in some obscure appendix) by exporting the picture as a .gif le and then pasting it into your word processor. You will be graded on the presentation as well as correctness. If you run into problems attend an o ce hour and get help. Dont just claim in your report that it did not work out! . Study the expressions sin(arcsin(x)); arcsin(sin(x)); Does W give correct results? Does W give the results that you would have guessed it should give given that you have studied these equations in the book? Why do you think W gives the answers that they give? . Let a be the current year minus , i.e. in we have a = . Let b be the number of the month (i.e. September= ). Plot the functions f = sin(x ) and f = a x + b x + on an interval that shows the two intersection points clearly and with y-range [ , ]. Label the intersection points with the approximate ( digits) (x , y )-values for their coordinates.

and interpret the result. . Compute the following derivatives

a) b)

dg ( ) dx d g ( ) dx

for for

g (x ) =

x x +

g (x ) = e x cos(x + )

. Compute the following integrals:

x e x dx ,

and

x sin( x )dx

. Consider the function f (x ) = e x x x . What is the (approximate) y-range of this function if x ? Now calculate is updating its output, note the intermediate parts.) You will get a negative value. Can you explain why? (Hint: Use the More digits button.) What does this mean for results obtained by the computer? . Determine a solution to the initial value problem y (x ) = x + x+ , (y ) y( ) =

f (x )dx . What happens? (W

Verify (using W for di erentiation if you want) that indeed the solution ful lls the equation.

You might also like