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

Since you want your answer in terms of h1 and h2, you want to solve for the other variables.

ans := solve({v1^2 = 2*g*(h-h1), (1/2)*g*t^2 = h2, v1*t+(1/2)*g*t^2 = h1}, {g, h, v1})

{g = 2*h2/t^2, h = (1/4)*(h1^2+2*h1*h2+h2^2)/h2, v1 = (h1-h2)/t}

simplify(ans)

{g = 2*h2/t^2, h = (1/4)*(h1+h2)^2/h2, v1 = (h1-h2)/t}

NULL

Download Expression_of_NLP_with_desired_parameters.mw

If you substitute the solve solutions back into the equation, you find that (except for the trivial solution), they are not actually solutions. On the other hand, fsolve gives an accurate solution for one range I tried (I was assuming you wanted a positive solution). Since you want a numerical solution, fsolve is preferred.

By the way, your second equation is c__3*(expression), so c__3 = 0 always works. If that is a solution you are not interested in, then I would change that to just (expression); then it may be easier to get a solution without c__3 = 0.

question11.mw

Aside from the 2I, there is a 6I (interpreted correctly anyway), and then missing spaces after a C1 and an h3 which makes them into unknown functions. Then since everything else is real you can use evalc() or evalc(Re())

real_and_imaginary_.mw

As the others have pointed out the sum involves roots of a degree 4 polynomial. If you put some values in, then this will give you directly what you want. (I used some random values so didn't get realistic output.)

Download RootOf.mw

Not sure what happened. Here's a way to get around that. Probably simpler to combine all constants into A and B at the beginning.

Download odes.mw

Something like this? (The matrices don't show on Mapleprimes; download the worksheet and run to see them.)

restart

with(LinearAlgebra)

A := `<,>`(`<|>`(2*x, z), `<|>`(-2*x-2, x-2)); B := `<,>`(`<|>`(4*y, 2*y), `<|>`(w, 3))

Matrix(2, 2, {(1, 1) = 2*x, (1, 2) = z, (2, 1) = -2*x-2, (2, 2) = x-2})

Matrix(%id = 36893490406780077108)

Meqns := A-B-IdentityMatrix(2)

Matrix(%id = 36893490406780082884)

By default solve assumes =0

eqns := convert(Meqns, set); solve(eqns)

{x-6, z-2*y, -2*x-2-w, 2*x-4*y-1}

{w = -14, x = 6, y = 11/4, z = 11/2}

 

 

Download eqns.mw

(For the more usual A.x = b with A a matrix of constants, x a vector of variables and b a vector of constants, use LinearSolve)

For future reference, please upload your worksheet with the green up-arrow in the Mapleprimes editor.
Your nested piecewise expression can be changed to a regular piecewise by simplify(..., piecewise).
You need to solve for y not y_.
Since you want a numerical solution, use fsolve, not solve.
Then it solves and gives the solution 0. You are asking when your piecewise expression 2*AA_=A_, but one of the conditions on each side is that it is 0 for y<=0, and so y=0 is a correct solution.

fsolve.mw

restart;

f:=(deltab*(-2*ub^2*mu*M^2*deltab*((-2+deltab)*(3/4+(phi0-1/2)*kappa)*(kappa-1/2)*M^4-(5*((alpha^2-6/5)*phi0*(kappa-1/2)*deltab+((-9/5*phi0-1/5)*alpha^2+13/5*phi0)*kappa+(11/10*phi0+3/10)*alpha^2-13/10*phi0))*(3/2+phi0-kappa)*M^2-2*alpha^2*phi0*(3/2+phi0-kappa)^2)*(3/2+phi0-kappa)*sqrt(1/(mu*ub^2))+sqrt(2)*(((3*(((mu*ub^2+2/3)*kappa^2+(-(2/3*mu)*ub^2-1)*kappa+(1/12)*mu*ub^2)*deltab^2-4*ub^2*mu*(kappa-1/6)*(kappa-1/2)*deltab+4*ub^2*mu*(kappa-1/6)*(kappa-1/2)))*(kappa-1/2)*M^6+(10*((alpha^2-6/5)*((mu*ub^2+1)*kappa-(1/2)*mu*ub^2-3/2)*deltab^2-(14/5*(ub^2))*mu*((alpha^2-12/7)*kappa-13/14*(alpha^2)+1)*deltab+(8/5*((alpha^2-3)*kappa-2*alpha^2+2))*ub^2*mu))*(kappa-3/2)*(kappa-1/2)*M^4-8*ub^2*mu*(alpha^2*(kappa-1/2)*deltab-3*alpha^2*kappa-(1/2)*kappa+1/4)*(kappa-3/2)^2*M^2-8*ub^2*mu*alpha^2*(kappa-3/2)^3)*(-phi0)^(3/2)+(2*kappa^2*deltab^2*(kappa-1/2)*M^6+(10*((alpha^2-6/5)*(2*kappa^2+(mu*ub^2-2)*kappa-(1/2)*mu*ub^2-3/2)*deltab^2-(14/5*(ub^2))*((alpha^2-12/7)*kappa-6/7*(alpha^2)+15/14)*mu*deltab+(8/5*(ub^2))*((alpha^2-3)*kappa-7/4*(alpha^2)+9/4)*mu))*(kappa-1/2)*M^4-(16*(-(1/8)*alpha^2*(kappa-3/2)*(kappa-1/2)*deltab^2+mu*ub^2*alpha^2*(kappa-1/2)*deltab-3*ub^2*mu*((alpha^2+1/6)*kappa-(1/4)*alpha^2-1/12)))*(kappa-3/2)*M^2-24*ub^2*mu*alpha^2*(kappa-3/2)^2)*(-phi0)^(5/2)+(20*kappa*(alpha^2-6/5)*deltab^2*(kappa-1/2)*M^4+(4*alpha^2*(kappa-3/2)*(kappa-1/2)*deltab^2-8*mu*ub^2*alpha^2*(kappa-1/2)*deltab+24*ub^2*((alpha^2+1/6)*kappa-(1/3)*alpha^2-1/12)*mu)*M^2-24*ub^2*mu*alpha^2*(kappa-3/2))*(-phi0)^(7/2)+(2*(deltab^2*(kappa-1/2)*M^2-4*mu*ub^2))*alpha^2*(-phi0)^(9/2)+((((mu*ub^2+1/2)*kappa-(1/2)*mu*ub^2-3/4)*deltab^2-4*ub^2*mu*(kappa-1/2)*deltab+4*ub^2*mu*(kappa-1/2))*(kappa-1/2)*M^4+2*ub^2*mu*(alpha^2+1)*(-2+deltab)*(kappa-3/2)*(kappa-1/2)*M^2+4*ub^2*mu*alpha^2*(kappa-3/2)^2)*M^2*sqrt(-phi0)*(kappa-3/2)))*sqrt(-phi0/(mu*ub^2))+(1/2*((((mu*phi0*ub^2-2*(phi0-1/2)^2)*kappa^2+(3/2-3*phi0-mu*phi0*ub^2)*kappa-9/8+(1/4)*mu*phi0*ub^2)*deltab^2-4*ub^2*mu*phi0*(kappa-1/2)^2*deltab+4*ub^2*mu*phi0*(kappa-1/2)^2)*M^4-(2*(-(10*(alpha^2-6/5))*(3/4+(phi0-1/2)*kappa)*deltab^2+ub^2*mu*(alpha^2+1)*(kappa-1/2)*deltab-2*ub^2*mu*(alpha^2+1)*(kappa-1/2)))*phi0*(3/2+phi0-kappa)*M^2+4*alpha^2*(mu*ub^2-(1/2)*deltab^2*phi0)*phi0*(3/2+phi0-kappa)^2))*M^2*deltab*sqrt(2)*(3/2+phi0-kappa)*sqrt(1/(mu*ub^2))+(-(((mu*ub^2+4)*kappa^2+(-mu*ub^2-7)*kappa+(1/4)*mu*ub^2+3/2)*deltab^2-4*ub^2*mu*(kappa-1/2)^2*deltab+4*ub^2*mu*(kappa-1/2)^2)*(-2+deltab)*(kappa-1/2)*M^6-(2*((5*(alpha^2-6/5))*(kappa-3/2)*(kappa-1/2)*deltab^3+((ub^2*(alpha^2+2)*mu-8*alpha^2+14)*kappa^2+(-ub^2*(alpha^2+2)*mu-53/2+16*alpha^2)*kappa+(1/4)*ub^2*(alpha^2+2)*mu-6*alpha^2+33/4)*deltab^2-4*ub^2*mu*(alpha^2+2)*(kappa-1/2)^2*deltab+4*ub^2*mu*(alpha^2+2)*(kappa-1/2)^2))*(kappa-3/2)*M^4-(8*(-(1/2)*alpha^2*(kappa-3/2)*deltab^2+ub^2*(alpha^2+1/2)*mu*(kappa-1/2)*deltab-2*ub^2*(alpha^2+1/2)*mu*(kappa-1/2)))*(kappa-3/2)^2*M^2-8*ub^2*mu*alpha^2*(kappa-3/2)^3)*(-phi0)^(3/2)+(-6*kappa*(-2+deltab)*deltab^2*(kappa-1/3)*(kappa-1/2)*M^6+(-40*kappa*(alpha^2-6/5)*(kappa-3/2)*(kappa-1/2)*deltab^3+((60*alpha^2-88)*kappa^3+(-2*ub^2*(alpha^2+2)*mu-134*alpha^2+180)*kappa^2+(2*ub^2*(alpha^2+2)*mu+73*alpha^2-77)*kappa-(1/2)*ub^2*(alpha^2+2)*mu-21/2*(alpha^2)+15/2)*deltab^2+8*ub^2*mu*(alpha^2+2)*(kappa-1/2)^2*deltab-8*ub^2*mu*(alpha^2+2)*(kappa-1/2)^2)*M^4-(16*(kappa-3/2))*((1/8)*alpha^2*(kappa-3/2)*(kappa-1/2)*deltab^3-(5/4*(alpha^2))*(kappa+1/10)*(kappa-3/2)*deltab^2+ub^2*(alpha^2+1/2)*mu*(kappa-1/2)*deltab-2*ub^2*(alpha^2+1/2)*mu*(kappa-1/2))*M^2-24*alpha^2*(((1/6)*kappa-1/4)*deltab^2+mu*ub^2)*(kappa-3/2)^2)*(-phi0)^(5/2)+(-40*deltab^2*((alpha^2-6/5)*(kappa-1/4)*(kappa-1/2)*deltab+(-3/2*(alpha^2)+11/5)*kappa^2+(3/2*(alpha^2)-19/10)*kappa-3/8*(alpha^2)+17/40)*M^4+(-4*alpha^2*(kappa-3/2)*(kappa-1/2)*deltab^3+40*alpha^2*(kappa-1/5)*(kappa-3/2)*deltab^2-8*ub^2*(alpha^2+1/2)*mu*(kappa-1/2)*deltab+16*ub^2*(alpha^2+1/2)*mu*(kappa-1/2))*M^2-24*alpha^2*(kappa-3/2)*(((1/2)*kappa-3/4)*deltab^2+mu*ub^2))*(-phi0)^(7/2)-2*alpha^2*(((kappa-1/2)*deltab-10*kappa+3)*deltab^2*M^2+(-9+6*kappa)*deltab^2+4*mu*ub^2)*(-phi0)^(9/2)-(1/2)*deltab^2*(8*alpha^2*(-phi0)^(11/2)+((-2+deltab)*(kappa-1/2)*M^2-3+2*kappa)*M^4*sqrt(-phi0)*(kappa-3/2)^2))*sqrt(-phi0/(mu*ub^2))*sqrt(-phi0^3)*Omega^2/(sqrt(-phi0)*sqrt(-phi0^3/(mu^3*ub^6))*ub^4*mu^2*(M^2*sqrt(-phi0)*deltab*sqrt(2)*(kappa-1/2)*sqrt(-phi0/(mu*ub^2))-(1/2)*M^2*deltab*sqrt(2)*(3/2+phi0-kappa)*sqrt(1/(mu*ub^2))-2*(-phi0)^(3/2)+(((-kappa+1/2)*deltab+2*kappa-1)*M^2+3-2*kappa)*sqrt(-phi0))^3*M^2):

Required form

f1:=(M^2-M1^2)/(M^2*(M^2-M0^2));

(M^2-M1^2)/(M^2*(M^2-M0^2))

limit(f1*M^2, M=infinity);

1

Find numerator and denominator high and low degrees. Could be (M^6-const)/(M^2*(M^6-const)) perhaps (but no, see below), but can't be of the expected form

f:=normal(f):
nf:=collect(numer(f),M):
degree(nf,M),ldegree(nf,M);
df:=collect(denom(f),M):
degree(df,M),ldegree(df,M);

6, 0

8, 2

Nonzero powers of M in the numerator and denominator for all even powers. We could factor the denominator into M^2(M^6 + ...) but that's about it.

seq([i,evalb(coeff(nf, M, i) <>0)], i = 6..0,-1);
seq([i,evalb(coeff(df, M, i) <>0)], i = 8..0,-1);

[6, true], [5, false], [4, true], [3, false], [2, true], [1, false], [0, true]

[8, true], [7, false], [6, true], [5, false], [4, true], [3, false], [2, true], [1, false], [0, false]

NULL

 

NULL

Download f1.mw

restart

Equation recast in form for ThueSolve

eq := -N*x*y+x^2+y^2 = N

-N*x*y+x^2+y^2 = N

Try for N=9;

eqN := eval(eq, N = 9)

x^2-9*x*y+y^2 = 9

Finds no solutions - for the quadratic case just passes to isolve, which is not up to the task.

NumberTheory:-ThueSolve(eqN)

[]

isolve(eqN)

Solve just solves the quadratic for arbirary y. But it is clear that if the discriminant were a square and y were even, then x would be integer.

ans := [solve(eqN)]

[{x = (9/2)*y+(1/2)*(77*y^2+36)^(1/2), y = y}, {x = (9/2)*y-(1/2)*(77*y^2+36)^(1/2), y = y}]

Want discriminant a square

deq2 := discrim((lhs-rhs)(eqN), x) = z^2

77*y^2+36 = z^2

This time we get 12 solutions, each in terms of an arbitrary integer variable _Z1

sols := [isolve(deq2)]; nops(%)

12

Look at the first solution, for say _Z1=1

test := simplify(eval(sols[1], _Z1 = 1))

{y = -240, z = -2106}

Find the corresponding x value

test2 := simplify(eval(ans[1], test))

{-240 = -240, x = -27}

And check it is a solution for the original equation

eval(eqN, `union`(test, test2))

9 = 9

From the form of the equation, changing the signs of x and y gives a positive solution.

soln := `~`[`=`]({x, y}, eval({-x, -y}, `union`(test, test2))); eval(eqN, %)

{x = 27, y = 240}

9 = 9

Check that the original form of the equation returns N

eval((x^2+y^2)/(x*y+1), soln)

9

For N=49

eqN := eval(eq, N = 49); ans := `~`[`=`]([x, x], [solve(eqN, x)]); deq2 := discrim((lhs-rhs)(eqN), x) = z^2; sols := [isolve(deq2)]; nops(%); test := simplify(eval(sols[1], _Z1 = 1)); test2 := {simplify(eval(ans[1], test))}; soln := `~`[`=`]({x, y}, eval({-x, -y}, `union`(test, test2))); eval(eqN, soln)

x^2-49*x*y+y^2 = 49

[x = (49/2)*y+(1/2)*(2397*y^2+196)^(1/2), x = (49/2)*y-(1/2)*(2397*y^2+196)^(1/2)]

2397*y^2+196 = z^2

12

{y = -16800, z = -822514}

{x = -343}

{x = 343, y = 16800}

49 = 49

For N=729

eqN := eval(eq, N = 729); ans := `~`[`=`]([x, x], [solve(eqN, x)]); deq2 := discrim((lhs-rhs)(eqN), x) = z^2; sols := [isolve(deq2)]; nops(%); test := simplify(eval(sols[1], _Z1 = 1)); test2 := {simplify(eval(ans[1], test))}; soln := `~`[`=`]({x, y}, eval({-x, -y}, `union`(test, test2))); eval(eqN, soln)

x^2-729*x*y+y^2 = 729

[x = (729/2)*y+(1/2)*(531437*y^2+2916)^(1/2), x = (729/2)*y-(1/2)*(531437*y^2+2916)^(1/2)]

531437*y^2+2916 = z^2

12

{y = -14348880, z = -10460294154}

{x = -19683}

{x = 19683, y = 14348880}

729 = 729

NULL

NULL

Download Thu.mw

For Var__phi you have Omega^2[  ... ] (The ] is at the end of the expression). What do the square brackets mean?

Is this supposed to be Omega^2*( ... ) or some unspecified function Omega( ... )^2 or something else.

Your second case can be done by

display(p2, pointplot(eval([x, y], sol[]), symbol = circle, symbolsize = 12, color = black))

Linear_System.mw

You are confused about the worksheet (*.mw) in which Maple runs, and the external text file of Maple commands that are read in to the worksheet (*.txt). Download the following two files to the same directory. Open the EKHAD.mw file by double-clicking (NOT the one you made) and follow the instructions (it has a bit more explanation). Hope this is clear.

EKHAD.mw

EKHAD.txt

(normally I would call the last one EKHAD.mpl, but the Mapleprimes site won't let me upload that, so EKHAD.txt will do.)

 

If you are willing to center the cube, then you can use scaling to do this. I used geom3d to easily get the vertices, but you could use cuboid. You can reorder lbls to get the order you need.

restart

with(geom3d); _local(D)

cube(poly, point(cen, [0, 0, 0]), side = 2); vs := vertices(poly); lbls := [A, B, C, D, A[1], B[1], C[1], D[1]]

poly

[[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]

[A, B, C, D, A[1], B[1], C[1], D[1]]

Scale coords by 110% and combine with labels.

tplot := zip(proc (coords, lbl) options operator, arrow; [(1.1*coords)[], lbl] end proc, vs, lbls)

[[1.1, 1.1, 1.1, A], [1.1, 1.1, -1.1, B], [1.1, -1.1, 1.1, C], [1.1, -1.1, -1.1, D], [-1.1, 1.1, 1.1, A[1]], [-1.1, 1.1, -1.1, B[1]], [-1.1, -1.1, 1.1, C[1]], [-1.1, -1.1, -1.1, D[1]]]

pcube := draw(poly); ptxt := plots:-textplot3d(tplot, 'font' = ["times", "bold", 20]); plots:-display(pcube, ptxt)

NULL

Download cube.mw

The standard way of numerically solving second or higher order diiferential equations or systems is to convert them to an equivalent system of first order equations. For example

{diff(y(x), x, x) = -y(x), y(0) = 1, D(y)(0) = 0};

becomes

{diff(w(x), x) = -y(x), w(x) = diff(y(x), x), y(0) = 1, w(0) = 0};

They both have the solution y(x) = cos(x), and the second also has the "intermediate" solution w(x) = -sin(x). This way, the numerical solvers only need to be able to solve first order odes. In fact convertsys is mainly intended as an internal routine used by dsolve; normally you would just pass the higher order odes to dsolve

Your E2 is too complicated, so I'm not sure exactly what is going on. But in principle, I think you want to do something like this:

restart;

eq:=add(a[i]/r^i,i=1..4)=add(rand(1..10)()*x^i/r^i,i=1..4)

a[1]/r+a[2]/r^2+a[3]/r^3+a[4]/r^4 = 7*x/r+10*x^2/r^2+6*x^3/r^3+2*x^4/r^4

solve(identity(eq,r),{seq(a[i],i=1..4)});

{a[1] = 7*x, a[2] = 10*x^2, a[3] = 6*x^3, a[4] = 2*x^4}

NULL

Download solve.mw

First 12 13 14 15 16 17 18 Last Page 14 of 81