dharr

Dr. David Harrington

6337 Reputation

19 years, 352 days
University of Victoria
Professor or university staff

Social Networks and Content at Maplesoft.com

I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

or export as HTML...

A less flexible option (because you don't get to choose the filenames) is just to export the worksheet to HTML, choosing the GIF option and images directory "images". Then all your plots are in the images directory as gifs; you just have to find which is which.

can solve with a procedure using fsolve...

The numeric form of dsolve gets stuck on the RootOf also. You can get round this by providing a procedure to solve for dVdt that uses fsolve. See the worksheet View 127_non-linear ODE.mw on MapleNet or Download 127_non-linear ODE.mw
View file details

Needs more conditions...

In general you need as many initial/boundary conditions as the order of the highest derivative, e.g., if n+B=3 (and n is less than or equal to 3) then you need 3 conditions and you only have one, V(0)=0. What happens if n and n+B are not integers is not clear to me.

matrix accuracy...

You can control the number of digits displayed in floating point calculations with, e.g., interface(displayprecision=5); This example doesn't seem to have too much loss of significance, but you can always carry your results through with rationals, and then at the end use evalf(M) to see the floating point form.

Units in a list...

To multiply the list elements by x and have the units in the list, you can use map(`*`,u,x);

Use the order in display...

Using a set within display means you can't determine the order. If you just have the two plots as arguments, then the second one is on top of the first: xp:=[1,0.5,0.4,1.5];yp:=[2.1,3,3,1];a:=2;h:=1;w:=1;p:=0; with(plots): points:=Statistics[ScatterPlot](xp,yp,symbol=box): curve:=plot(h + a*cos(w*x+p),x=0..2,title="Function and Data Plot",thickness=2): display(curve, points); display(points, curve);

Help pages in Help browser...

Thanks to JacquesC I can create help pages for my package and make an examples worksheet in the help database appear as a worksheet. Now I have some problems making these to appear correctly in the help browser table of contents. I can get my list of pages in the browser TOC, but: 1. They are always in alphabetical order. How can I change this, in particular my overview page should appear first. 2. ?packname,topic2 does not work if topic2 is an alias. 3. After selecting the examples worksheet, exiting that worksheet deletes all the entries in the table of contents for the session (this one seems more like a bug). Suggestions, Thanks, David.

more details on calculations...

The infolevel function is used for this purpose. See the help for the Student package and infolevel. At the simplest it is just with(Student): infolevel[Student]:=1; Your example is too simple to have additional information provided. If you were integrating, or doing something more complicated, you would get information about the method being used.

need to know i...

I think you can only use a given integer for i, e.g., i=2 will work, but the general formula for arbitrary i is too hard.

DEplot...

look at the help page for DEplot; it has a Lotka-Volterra example. odeplot can also be used for plotting solutions to DEs. If you need more than just plot output, take a look at dsolve.

dsolve needs a bit more...

The following works: de:=v(x)*(diff(v(x), x)) = -k/x^2; ini:=v(a)=v0; dsolve({de,ini},{v(x)}) assuming positive;

numerical values with fsolve...

I gave up waiting before I got the error message; not sure specifically why it occurs. As a general comment, RoofOf is not much use unless you are going to further manipulate the analytical solution. Allvalues is best for polynomial solutions. Since there is unlikely to be an analytical solution here, just use fsolve instead of solve (the second solution is just the negative of the one provided).

multiple assignments...

Note that a:=2*a; gives a recursion error, and so it will also with multiple assignments. But if you have expressions or values you want to double, try a,b,c := op(map(x->2*x,[5,7,8])); The op() just removes the square brackets around the list.

coupled DEs...

If your left hand sides are meant to be second derivatives then you can do it like: eqn1 := (D@@2)(x)(t) = -a*sqrt(D(x)(t)^2+D(y)(t)^2)*D(x)(t); eqn2 := (D@@2)(y)(t) = g-a*sqrt(D(x)(t)^2+D(y)(t)^2)*D(y)(t); dsolve({eqn1,eqn2},{x(t),y(t)}); If you add some initial conditions within the {} with eqn1 and eqn 2 you can get a nicer expression.

solve first...

These equations have an (ugly) solution, so I would first solve analytically and then substitute in the numerical values. restart: Digits := 16: with(plots): params:={Is = 10^(-14),Vt = 0.026,M = 10,Rl = 10e3,R1 = 600,R2 = 3e3}; eq1:=0 = -I1 + Is*exp((Vin - (I1*R1 + (I1 + I2)*R2))/Vt); eq2:=0 = -I2 + Is*exp((Vin - (I1 + I2)*R2)/Vt); ans:=solve({eq1,eq2},{I1,I2}): plot(rhs(subs(params,ans[2])),Vin=1..2);
 First 62 63 64 65 66 Page 64 of 66
﻿