## dharr

Dr. David Harrington

## 6416 Reputation

20 years, 23 days
University of Victoria
Professor or university staff

## Social Networks and Content at Maplesoft.com

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.

## 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);

## functional form workaround...

Not sure entirely why it doesn't work - somehow the plot must try values outside the valid range. The following seems to work: plot(f1,1..5);

## output from solve...

One simple way to get b1 out is just to do subs(sols,b1) and so on.

## view option works with odeplot...

Use the view option; see ?plot,options for details.

## indexing solutions...

In general, when solving polynomials, the index= mechanism of RootOf is meant to solve this problem. So ans2:=RootOf(E1*_Z^4 - _Z^2*(2*E1^2) + E1^3 - E1*E2^2,index=2); evalf(subs(E1=5,E2=3,ans2)); should always give the second root (whatever that means). Actually in your case you could just solve the quartic once and for all and then substitute in the E1 and E2 values afterwards because the solutions are very simple: eqn:=E1*NZ^4 - NZ^2*(2*E1^2) + E1^3 - E1*E2^2=0: solve(eqn,NZ); gives (E1-E2)^(1/2), -(E1-E2)^(1/2), (E1+E2)^(1/2), -(E1+E2)^(1/2)

## solve/eval works...

There are three solutions for x, found by ans:=solve(t*x^3-q*x-2*q^2=0,x): Then to evaluate your second expression at the first of these: y:=eval(-x/2 -(x+2*q)^2/(8*t*x^2),x=ans[1]); and likewise for the second and third. (You were missing some multiplication signs).

In general, getting things in the form you want can be difficult. If I need to verify a solution, or check two things equal, rather than manipulating one into the other, I simplify(a-b) and see if it is zer. You may have to use the assume facility to get it to work.

## Output with '...

To get the output written with primes, try with(PDEtools): declare(y(t), prime=t); diff(y(t),t)+3*y(t);

## mtaylor...

The mtaylor commnad can probably do what you want, but you want to be careful about what you mean by nonlinear terms.

## 8th order derivative...

f:=sin(x^2/(x^10+2))*exp(2*x); eval(diff(f,x\$8),x=0); Note that you need exp(2*x) instead of e^(2*x).

Not quite clear what you want here; an example of your equation would help. What do you mean by an equation that is a function of x,y,t - because f(x,y,t) requires a 4-D plot. Or is it f(x,y,t)=0, or y=f(x,t)? The last ones can be done with a series of spacecurves, if I understand correctly what you want, e.g., with(plots):spacecurve({[cos(t),sin(t),0],[2*cos(t),2*sin(t),1],[3*cos(t),3*sin(t),3]},t=0..8*Pi,axes=boxed);

## Lagrange multiplier...

I think you don't want to differentiate with respect to the Lagrange multiplier. Also, you want things in terms of x, so solve for lambda, y, z rather than x, y, z. Then you get your hand calculated answer: > L:= x*y*z + lambda* (U - (10-x)*(10-y)*(10-z)): > solve( {diff(L, x)=0, diff(L,y)=0, diff(L,z)=0},{lambda,y,z} ); gives {lambda = 0, y = 0, z = 0}, {y = x, lambda = -x^2/(100-20*x+x^2), z = x} Cheers, David.

## arrows='LARGE' does something....

The DEplot command has arrows=arrowtype with arrowtype equal to 'SMALL', 'MEDIUM', 'LARGE', 'LINE', or 'NONE'. I tried this with fieldplot and it can do at least the 'LARGE' ones, though they are kind of clunky. Cheers, David.

## combining implicit plots...

Not sure which equations you want to solve here, but x*y*z gives empty plot for me (v 9.5)(presumably meaning x*y*z=0). For x*y*z=1 it works and two plots can be combined: implicitplot3d({x*y*z=1,(10-x)*(10-y)*(10-z)^2=1}, x=0..10,y=0..10,z=0..10);
 First 64 65 66 67 Page 66 of 67
﻿