rlopez

3020 Reputation

14 Badges

20 years, 236 days

Dr. Robert J. Lopez, Emeritus Professor of Mathematics at the Rose-Hulman Institute of Technology in Terre Haute, Indiana, USA, is an award winning educator in mathematics and is the author of several books including Advanced Engineering Mathematics (Addison-Wesley 2001). For over two decades, Dr. Lopez has also been a visionary figure in the introduction of Maplesoft technology into undergraduate education. Dr. Lopez earned his Ph.D. in mathematics from Purdue University, his MS from the University of Missouri - Rolla, and his BA from Marist College. He has held academic appointments at Rose-Hulman (1985-2003), Memorial University of Newfoundland (1973-1985), and the University of Nebraska - Lincoln (1970-1973). His publication and research history includes manuscripts and papers in a variety of pure and applied mathematics topics. He has received numerous awards for outstanding scholarship and teaching.

MaplePrimes Activity


These are answers submitted by rlopez

Sounds like you have one equation in one unknown that you want to solve numerically via fsolve. Sometimes, fsolve needs to know where to look for a solution, and in the case you describe, it should be possible to draw a graph that helps identify where the solution(s) might lie. It might take implicitplot from the plots package to get the graph.

Also, it would help if we could see the equations, especially the one you ended up with.

Finally, perhaps your question doesn't accurately describe what you really did?

Suppose the two equations are f(x,y)=0 and g(x,y)=0. Suppose further that the first equation is solved for y=y(x), and this is substituted into the second. The result is g(x,y(x))=0. Why do you then differentiate the first equation? Wouldn't it be that you differentiate the modified second equation?

RJL Maplesoft

After having struggled with this very same question for many years, I was amazed at the wonderfully simple solution posted by Robert Israel back on December 14. At least, that's what my notes (Red Book of Maple Magic) tell me.

His solution uses expressions for f and g, not functions.

plottools:-transform(unapply([x,y+g],x,y))(plot(f-g),x=2..7,filled=true));

 

If I remember correctly, I tried this approach with plots of surfaces, and found that it is robust enough to extend to that case, too.

 

RJL Maplesoft

With the Student Calculus1 package loaded, "Solve" in the Context Menu for an inert integral (integral sign will be gray, not black), will have the option "Show Solution Steps". The complete annotated solution that is printed will show what substitutions Maple made. However, the algorithm that generates this solution can be different from the path that the Tutor takes.

RJL Maplesoft

Call the original polynomial in the worksheet problem.mw by the name q. Execute the following.

p:=eval(expand(q),l2=x); #I find it easier to use x than to use l2

Q:=[allvalues(solve(p,x))]: #This generates 8 indexed RootOf structures, each representing a branch of x=x(v).

"Functionalize" each of the 8 solutions:

F1:=w->evalf(eval(Q[1],v=w)):

F2:=w->evalf(eval(Q[2],v=w)):

F3:=w->evalf(eval(Q[3],v=w)):

F4:=w->evalf(eval(Q[4],v=w)):

F5:=w->evalf(eval(Q[5],v=w)):

F6:=w->evalf(eval(Q[6],v=w)):

F7:=w->evalf(eval(Q[7],v=w)):

F8:=w->evalf(eval(Q[8],v=w)):

These are the eight functions that describe the eight solutions x=x(v). These functions evaluate to a floating-point number. That's the best one can hope for because mathematically, there is no formula for the solution of an eighth-degree polynomial.

The following code generates a set of "equispaced" points for each branch.

for j from 1 to 8 do

S||j:=[seq(F||j(k),k=v1..v2)]:

end do:

A composite of the curves in the complex plane:

C:=[red, blue, black,green,brown,cyan,orange,gold]:

for k from 1 to 8 do p||k:=plots[complexplot](S||k,style=point,color=C[k]);

end do:

plots[display](p||(1..8));

To obtain the graphs of x(v) as curves in the xv-plane, make a list of points, not just function values, and then remove any that have I=sqrt(-1).

for j from 1 to 8 do

SS||j:=remove(has,[seq([k,F||j(k)],k=v1..v2)],I):

end do:

Graph the real curves with something like

plot([SS1,SS2,SS4,SS5,SS6],style=point,color=[black,red,green,blue,orange], symbol=[point,circle,diamond,cross,box]);

The discontinuity in the first branch can be seen from the successive values F1(5054) and F1(5055). Somewhere between v=5054 and v=5055, this function, x(v), has a discontinuity in the real plane. The values become complex, and the root locus in the complex plane shows how x varies with v on this branch for those values of v that make x(v) complex. Three of the branches seem to be completely complex in the v-interval chosen.

I find that obtaining this information as the solution of a set of ODEs to be a more difficult task than working algebraically as I've done above.

RJL Maplesoft

Let's call the polynomial by the name P. I had to apply expand to P to make solve work. So, S:=[allvalues(solve(expand(P),l2))] gives a list of eight solutions in the form of eight separate RootOf structures. These can be sent to the plot command and graphed as functions of v. For some ranges of v, some of these solutions are strictly complex, but it appears from the worksheet "problem.mw" that you have a pretty good idea what to do with the complex issue.

RJL Maplesoft

One of the "tricks" for integration in Maple is evaluation via "simplify" since some consider the evaluated integral to be "simpler" than the unevaluated integral. With this in mind, and the hints provided by Markiyan, I found that the following provided the hypergeometric form of the antiderivative.

 

simplify(int(f,r)) assuming r>0

RJL Maplesoft

In Maple 16, you can get the result with int(simplify(BesselProblem), r=0..1). I don't know what happens in earlier versions.

RJL Maplesoft

Perhaps you need a piecewise function, defined either with the piecewise template in the Expression palette, or with the piecewise command whose help page is obtained with ?piecewise.

RJL Maplesoft

Primes_Homework_Prob.mw

 

The worksheet at the end of the given link provides a complete solution. I found the problem interesting enougn to warrant saving the details for eventual re-cycling into a Clickable Calculus format. (For the sake of brevity, the given worksheet uses commands.)

 

RJL Maplesoft

v(t):=x^2+1;

L:=h*u(t);

f:=subs(u(t)=v(t),L);

These three lines result in f:=h*(x^2+1). The one change made is the assignment of v(t) to x^2+1. It might be useful to know more about the connection between v(t) and x^2+1, and how this connection came about.

RJL Maplesoft

If you really want a data table from dsolve/numeric, then try the output=Array() option. For example, including a list of values as argument to Array will cause dsolve/numeric to return an Array in which one column lists the independent-variable values, and the other, the corresponding dependent-variable values.

RJL Maplesoft

The second solution found by Preben can also be found with the approxsoln option in dsolve. The trick is to guess at the right "approximate solution."

sol:=dsolve({eq1=0, f(0)=0, D(f)(0)=-1/2, D(f)(1)=1},  numeric, approxsoln=[f(x)=-4*x]):

 

RJL Maplesoft

q:= -2*Pi*sin(Pi*a)/(-1+cos(2*Pi*a)):

1/simplify(expand(1/q));

RJL Maplesoft

The 1-norm is the sum of the absolute values of the components of the vector. When the components are all nonnegative, the 1-norm will give the sum of the components.

 

To obtain the 1-norm, use the Context Menu option for Norm, or use the command LinearAlgebra:-Norm(A,1)

RJL Maplesoft

Also, consider working in the Student VectorCalculus package because it is very forgiving with respect to coordinates.

with(Student:-VectorCalculus):

F:=VectorField(<x,y>);

MapToBasis(F,polar[r,theta]);

RJL Maplesoft

First 22 23 24 25 26 27 Page 24 of 27