dharr

Dr. David Harrington

8235 Reputation

22 Badges

20 years, 340 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

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

MaplePrimes Activity


These are answers submitted by dharr

...but to answer your original question, one way is to make a function (proc) that takes a Vector, and use seq

seq.mw

Profiling the code shows nearly all of the time is spent on the solve line, so changing to map or eval won't help you. I'm guessing changing to fsolve or something from the RootFinding package is the next step

Roots_with_map.mw

As @Preben Alsholm and others have shown, you can get numerical values of sigma as a function of lambda, k and Q.

But you can get an explicit formula for lambda in terms of sigma, which enables plotting sigma vs lambda for fixed k and Q, and may be useful for further manipulations. A lot depends on what you what to do and what are expected ranges of lambda, sigma, k and Q

Real_root.mw

evalc converts to real and imaginary part: evalc(exp(I*x))

It can execute in about a minute on my machine for n=25 if you compile it. You need to set up the Vector outside the procedure and then it will be updated on exit. I didn't check the output or try to follow the algorithm, so hope it has worked correctly.

Mobius.mw

[Edit: I got it further down from about a minute to 20 seconds by redoing the algorithm - the worksheet runs through my logic and several rounds of improvements and compares with the Matrix. Possibly could be improved slightly more.

Hadamard_and_BooleMobius_Transforms.mw

I still got sporadic integer overflow errors - maybe a memory or garbage collection from too many 2^25 x 2^25 matrices.

]

 

Interesting. Trying DEtools:-dalembertsol(ode,y(x)); returns the empty set, suggesting Maple doesn't really think it is d'Alembert. However, for other equations that odeadvisor doesn't classify as dalembert, such as ode2:=diff(y(x),x)=y(x)^2, dalembertsol(ode2,y(x)) does return a parametric solution.

Since there might be lots of ways to transform to dalembert, I'm guessing that odeadvisor's result is more of a hint, and it doesn't try that hard to check it, but dalembertsol does.

seq(fracdiff(v(t), t,alpha),alpha=-1..1.5,0.5);

gives (1/2)*t^2, .7522527780*t^(3/2), 0., 1.128379167*t^(1/2), 0., 0.

So the ones that are zero are just running along the x-axis and are hard to see.

Click on the plot, and then there will be some controls for the animaton - such as PLAY, Single/continuous cycle etc

Nice worksheet. Some initial thoughts. I guess that a tangent plane can be defined for a point on a surface, and the normal from a pedal point to that plane is well-defined, so the set of all such points where the normal meets the tangent plane can be a pedal surface. The sphere for a point at the centre would be the same sphere, and I think that for any solid of revolution, the pedal surface would be the solid of revolution generated by rotating the pedal curve.

If it is mainly for display then

lprint('fadc_vmon(vmon)'=fadc_vmon(vmon));

gives

fadc_vmon(vmon) = 1638.400000*vmon+200.

For digits to display see the tools -> options -> precision menu.

Note also Maple can convert to various computer languages - see the CodeGeneration package.

Like this? (Not sure what DeltaW is) [Edit: work calculated at end]
 

restart;

with(ThermophysicalData):with(CoolProp):

P__atm:=101325;

101325

T__boil:=Property(temperature, water, pressure = P__atm, Q = 0);
T__gas:=T__boil+0.0001;
T__liq:=T__boil-0.0001;

373.124295847687904

373.1243958

373.1241958

Property(PhaseString, water, pressure = P__atm, temperature = T__liq);
Property(PhaseString, water, pressure = P__atm, temperature = T__gas);

"liquid"

"gas"

Hgas:=Property(Hmolar, water, pressure = P__atm, temperature = T__gas);
Hliq:=Property(Hmolar, water, pressure = P__atm, temperature = T__liq);
Sgas:=Property(Smolar, water, pressure = P__atm, temperature = T__gas);
Sliq:=Property(Smolar, water, pressure = P__atm, temperature = T__liq);

48200.3815860304312

7549.42977094276921

132.491988478210232

23.5445083289082646

For gas -> liquid at the boiling point at 1 atm - delta G should be zero

dH:=Hliq-Hgas;
dS:=Sliq-Sgas;
dG:=dH-T__boil*dS;

-40650.95182

-108.9474802

0.1e-4

Work to compress 1 mol under constant 1 atm pressure until all liquid.

Dmolar is molar density (mol m^-3), so molar volume is the reciprocal of this

Vgas:=1/Property(Dmolar, water, pressure = P__atm, temperature = T__gas);
Vliq:=1/Property(Dmolar, water, pressure = P__atm, temperature = T__liq);

0.3014317605e-1

0.1879786899e-4

W:=-P__atm*(Vliq-Vgas);

3052.352619

Neglecting liquid volume and treating gas as ideal

Wideal:=Property(gasconstant,water)*T__boil;

3102.293958

 


 

Download Thermo.mw

The equation has only one solution:  x=1/e. Implicit plot expects an equation in two variables, such as x+y=3.

Edit: if you really wanted the whole vertical line you can get it, but I would usually use a parametric plot for this.
 

eq:=(1+ln(x))/x=0;

(1+ln(x))/x = 0

plots:-implicitplot(eq,x=0..5,y=0..5);

 


 

Download implicitplot.mw

You can use any font on your system. I don't really understand all the different Computer Modern fonts, but they seem to work. [Edit: Thanks to @acer the update. Image below is from export as .pdf ]

P1 := plot(x^2):
P2 := plot(x^2,
           axesfont=[cmr12,roman,16],
           labelfont=[cmr16,roman,24]):

plots:-display(Array([ P1, P2 ]));

 

 

 

 

Download Latexfonts.mw


 

restart;

with(plots):local D;

Choose four points. We want a family of conics tangent to lines passing through these four points. First generate the lines, using y=m*(x-x0)+y0

pts:=[[1,3/2],[-1/2,1],[-1,-1],[4/3,-3/4]]; #pts in quadrants 1,2,3,4
slopes:=[seq(((dx,dy)->dy/dx)((pts[i]-pts[(i mod 4)+1])[]),i=1..4)]:
lines:=zip((pt,slope)->y=slope*(x-pt[1])+pt[2],pts,slopes);
plotpts:=plot(pts,style=point,colour=red,symbol=solidcircle,symbolsize=15):
plotlines:=plot(rhs~(lines),style=line,colour=blue):
display(plotpts,plotlines,view=[-2..2,-2..2]);

[[1, 3/2], [-1/2, 1], [-1, -1], [4/3, -3/4]]

[y = (1/3)*x+7/6, y = 4*x+3, y = (3/28)*x-25/28, y = -(27/4)*x+33/4]

General conic

gen:=A*x^2+B*x*y+C*y^2+D*x+E*y+1=0;

A*x^2+B*x*y+C*y^2+D*x+E*y+1 = 0

Slope dy/dx at an arbitrary point x,y on the conic.

conslope:=implicitdiff(gen,y,x);

-(2*A*x+B*y+D)/(B*x+2*C*y+E)

So for a point (x[i],y[i]) on a conic to be tangent to line i we require the following three equations to hold for (x,y)=(x[i],y[i]): the eqn of lines[i], conic eqn, slope of tangent = slope of line

eqns:={seq(eval({lines[i],gen,slopes[i]=conslope},{x=x[i],y=y[i]})[],i=1..4)};

{4 = -(2*A*x[2]+B*y[2]+D)/(B*x[2]+2*C*y[2]+E), -27/4 = -(2*A*x[4]+B*y[4]+D)/(B*x[4]+2*C*y[4]+E), 1/3 = -(2*A*x[1]+B*y[1]+D)/(B*x[1]+2*C*y[1]+E), 3/28 = -(2*A*x[3]+B*y[3]+D)/(B*x[3]+2*C*y[3]+E), y[1] = (1/3)*x[1]+7/6, y[2] = 4*x[2]+3, y[3] = (3/28)*x[3]-25/28, y[4] = -(27/4)*x[4]+33/4, A*x[1]^2+B*x[1]*y[1]+C*y[1]^2+D*x[1]+E*y[1]+1 = 0, A*x[2]^2+B*x[2]*y[2]+C*y[2]^2+D*x[2]+E*y[2]+1 = 0, A*x[3]^2+B*x[3]*y[3]+C*y[3]^2+D*x[3]+E*y[3]+1 = 0, A*x[4]^2+B*x[4]*y[4]+C*y[4]^2+D*x[4]+E*y[4]+1 = 0}

So we have 12 equations and 13 variables: 8 for the coordinates of the four points and the 5 conic parameters. We choose x[1], the x coordinate of the tangent point on line 1 as the control point, and solve for the others in terms of it. Then substitute the parameters ino the general eqn to find the conic for this x[1]

params:=solve(eqns,{y[1],x[2],y[2],x[3],y[3],x[4],y[4],A,B,C,D,E}):
con:=eval(gen,params);

-(-105664*x[1]^2-710752*x[1]-809209)*x^2/(1487929*x[1]^2-796628*x[1]-626276)-(349744*x[1]^2+2229952*x[1]+21304)*x*y/(1487929*x[1]^2-796628*x[1]-626276)-(-98256*x[1]^2-293088*x[1]-649056)*y^2/(1487929*x[1]^2-796628*x[1]-626276)+2*(272584*x[1]^2+255787*x[1]-203246)*x/(1487929*x[1]^2-796628*x[1]-626276)-8*(80083*x[1]^2-42611*x[1]+27553)*y/(1487929*x[1]^2-796628*x[1]-626276)+1 = 0

display(seq(implicitplot(con,x=-4..4,y=-4..4,colour=black,gridrefine=2),x[1]=-2..2,0.3),plotpts,plotlines,axes=none,view=[-4..4,-4..4]);

 


 

Download Pencil3.mw

With some values of M and R and selected initial condition you can get a numeric solution with

dsolve(eval(sys,{M=2,R=1}) union {y(0)=2},y(r),numeric);

If you try the intial condition y(0)=1, you get the message that there is a singularity and it will work only with two initial values. This is probably why you can't get a series solution about r=0. But perhaps that's not what you want? it should be a start

First 52 53 54 55 56 57 58 Last Page 54 of 81