## 13821 Reputation

14 years, 208 days

## You may...

be able to solve it numerically, provided

1. you supply numeric values for the parameters q1, q2, q3, q4
2. you supply three initial/boundary conditions for the ODE

In the attached, I just use some random values for thes quantities

 (1)

## Well...

You could start by typing

?How do I solve an ordinary differential equation

at the Maple prompt. If yoou need more info, check the Maple help for the command dsolve()

## Once you have assigned...

values for 'm' and 'l' (I just used 1 for both), then you could try DEplot3d() as shown in the attached. I just guessed a value for the range of the dependent variable p(t).

For some reason, this particular plot won't render on this site, by I can assure you that this code

VF.mw

```  restart;
with(DETools):
sys := { diff(r(t),t)=p(t)/m,
diff(p(t),t)=l^2/(m*r(t)^3)-n*k*r(t)^(n-1),
diff(phi(t),t)=l/(m*r(t)^2)
};
sys1:=subs({n=1,k=1, m=1, l=1},sys);
p1:=DEplot3d( sys1,
[r(t), p(t), phi(t)],
t=0..30,
r=0..10,
p=0..2*Pi,
phi=0..Pi,
arrows=cheap,
dirfield=[5,5,5]
);
```

will produce this plot

## No...

just your misunderstanding of how a plot command "works". When plotting some expression, the plot() command will evaluate the expression at ~200 points (by default), and then produce a "straight line" between adjacent points. The fact that you "see" this as a smooth "curve" is an optical illusion.

In your first example the points are only about 1.8 degrees apart (360/200) by default. In your second example, the points will be 3600000/200 degrees apart (by default) - so 18000degrees or about 50 complete revolutions. - so essentially you end up drawing a straight line from some point on the cicumference of a circle to some other (more or less random) point on the circumference. These lines will fill up the interior of the circle very quickly. You can get around this by increasing the option numpoints drastically and then wait a while for your plot to appear

## You appear to get the...

the styles you want using conventional 'labels' and 'labelfont' options, see the attached

NB the double square brackets around the unit only appear on this site - they do not occur in the original worksheet

 > restart:   with(Units):   plot( x,         x=0..1,         labels=[ typeset(foo*Unit(kg/m^3)),                  typeset(bar*Unit(m) )                ],         labelfont=[times, bold, 14]       );
 >
 >

## A couple of observations...

1. Two of your constraints are on the form s<p<q. Each of these has to be split into two simple inequalities, ie s<p, p<q. This fix is trivial
2. Both the expression you want to minimise and one of the constraints contain terms such as 91201.82720*(-0.05*i + 0.04)*sqrt(-i), - 912.0182718*i/sqrt(-i). Since 'i' is restricted to range 0..1, the sqrt(-i) factor in both of these terms is going to produce a complex value, which the optimizer cannot handle. ( All optimizers essentially work on the basis of determining whether an expression using the current variable values is greater than or less than the expression with the previous set of variables. However for complex values, the term "greater than or less than" has no meaning. So you have to ask, why do complex values occur?? Is this expected?
3. If the existence of complex values is unexpected then there must be an error in yur derivation somewhere. These complex valuesappear to arise from the evaluation of the quantities 'Q' and 'Qr'

## So many syntax errors...

I suggest you read the help page at ?pdsolve/numeric, very carefully

The attached at least executes, although I can't say I'm wildly convinced by the answer which Maple provides

Inline displlay of worksheets on this site appears to be broken - again!

## If you are running maple from...

the command line (which *seems* to be true), then you  can add

lprint(diff(ln(x),x));

to the end of your probem.mpl file. This will produce 1/x

If you don't need/want to show the steps, then you can just change the problem.mpl file to

`  diff(ln(x),x);`

which will also produce 1/x;

## What exactly is the problem...

Your integral can be solved without resdtriction(s)- see the attached

 > restart;   int(sin(m*Pi*y/a), y = 0 .. b);
 (1)
 >

## Use plots:-display()...

as in the attached ( a "toy" example)

 > restart;
 > with( DynamicSystems ): with(plots): sys1 := ZeroPoleGain([0,1],[2,4,6],1): p1:=NyquistPlot(sys1, color=blue); sys2 := ZeroPoleGain([0,1],[1,3,5],1): p2:= NyquistPlot(sys2, color=red); display([p1,p2]);
 >

## You need...

to set the x and y-ranges appropriately - yours are much too small.

See the attached

 > restart;   TW:=x^2/1350000000000000000-x*y/14580000000000000000000000000000000+y^2/5400000000000000-x/2250000000+y*173/5400000000-1; # # Plot with OP's original ranges for x and y, which are # waaaaaaay too small to see a complete ellipse #   plots:-implicitplot(TW, x=16666666..415000000,y=-333333..83000000); # # Plot withh appropriate ranges for x- and y. Note that x and y are scaled # differently on plot which *distorts* the shape #   plots:-implicitplot(TW, x=-2e9..3e9,y=-10e08..10e09, axes=boxed); # # Force the x- and y- scales to be the same #   plots:-implicitplot(TW, x=-2e9..3e9,y=-10e08..10e09, axes=boxed, scaling=constrained);
 >

## You could probably...

hack something in the Finance() package to produce what you want, but since there is a simple closed form expressionj for a standard mortgage (see about halfway down on  https://en.wikipedia.org/wiki/Mortgage_loan), it is pretty trivial to do in an explicit manner.

In the attached, there are two methods of doing this calculation, The first uses a recursive function call, basically keep adding interest and subtracting payments, until the duration is up, then solve for the payment which makes the outstanding loan zero at the end of the duration. The second just uses the formula from the above Wikipedia page - you can google for the derivation

You can give students extra points if they manage to get the output to appear (as in the attached), by using the  settings under the menu Format->NumericFormatting

 > restart;   Mortgage:= proc( p, r, Duration:=12*30)                    local Rate:=convert(r, float):                    if   Duration=0                    then return solve(p);                    else thisproc( p*(1+Rate/12/100)-Payment, Rate, Duration-1);                    fi;              end proc: # # Usage: # # Mortgage( AmountOfLoan, InterestRate, DurationInMonths) #   Mortgage(150000*0.8, 9, 12*30);
 (1)
 > # # Using a closed-form expression, rather than the above # (recursive) function call: see # #         https://en.wikipedia.org/wiki/Mortgage_loan #   mgage:=( P, r, n)-> evalf(r/100/12*P*(1+r/100/12)^n/((1+r/100/12)^n-1)):   mgage(150000*0.8, 9, 12*30);
 (2)
 >

## A third way...

is to use isolate() as in the attached

 > restart;   eq:=(3*y - 2)/3 + (2*y + 3)/3 = (y + 7)/6;   isolate(eq, y);
 (1)
 >

## In Maple...

the ratio of circumference to diameter is Pi not pi - so the attached will work

 >
 >
 (1)
 >
 >

## It is not...

completely clear to me what you want since you state that

i need the solution  for Y=0 and Y=1

but you also seem to require the integral expression

(int(U(Y)*Theta(Y), Y = 0 .. 1))/(int(U(Y), Y = 0 .. 1));

The attached covers both of these requirements.

 > restart:   kp := .3:   Pr := .3: N := .5: g := .5: A := 1: B := 0: M := .5: lambda := .5: Ec := .5:   rf := 997.1: kf := .613: cpf := 4179: `&sigma:f` := 0.5e-1:   p1 := 0.1e-1: sigma1 := 2380000: rs1 := 4250: ks1 := 8.9538: cps1 := 686.2:   p2 := 0.5e-1: sigma2 := 3500000: rs2 := 10500: ks2 := 429: cps2 := 235:   a1 := (1-p1)^2.5*(1-p2)^2.5:   a2 := (1-p2)*(1-p1+p1*rs1/rf)+p2*rs2/rf:   a3 := 1+3*((p1*sigma1+p2*sigma2)/`&sigma:f`-p1-p2)/(2+(p1*sigma1+p2*sigma2)/((p1+p2)*`&sigma:f`)-((p1*sigma1+p2*sigma2)/`&sigma:f`-p1-p2)):   a4 := (1-p2)*(1-p1+p1*rs1*cps1/(rf*cpf))+p2*rs2*cps2/(rf*cpf):   a5 := (ks1+2*kf-2*p1*(kf-ks1))*(ks2+2*kf*(ks1+2*kf-2*p1*(kf-ks1))/(ks1+2*kf+p1*(kf-ks1))-2*p2*(kf*(ks1+2*kf-2*p1*(kf-ks1))/(ks1+2*kf+p1*(kf-ks1))-ks2))/((ks1+2*kf+p1*(kf-ks1))*(ks2+2*kf*(ks1+2*kf-2*p1*(kf-ks1))/(ks1+2*kf+p1*(kf-ks1))+2*p2*(kf*(ks1+2*kf-2*p1*(kf-ks1))/(ks1+2*kf+p1*(kf-ks1))-ks2))):   OdeSys := (diff(U(Y), Y, Y))/(a1*a2)+Theta(Y)+N*(Theta(Y)*Theta(Y))-a3*(M*M)*U(Y)/a2-(kp*kp)*U(Y)/(a1*a2),           a5*(diff(Theta(Y), Y, Y))/a4+Pr*Ec*((diff(U(Y), Y))^2+U(Y)^2*(kp*kp))/(a1*a2):   Cond := U(0) = lambda*(D(U))(0), Theta(0) = A+g*(D(Theta))(0), U(1) = 0, Theta(1) = B:   Ans := dsolve([OdeSys, Cond], numeric, output = listprocedure): # # Get values for U(0), Theta(0), U(1), Theta(1) # Note that the BCS ought to guarantee that the latter # two are both equal to 1 #   Ans(0)[2];   Ans(0)[4];   Ans(1)[2];   Ans(1)[4]; # # Perfom the integral which the OP *appears* to want #   Int( eval(U(Y), Ans)(Y)*eval(Theta(Y), Ans)(Y), Y=0..1)   /   Int(eval(U(Y), Ans)(Y), Y=0..1);   evalf(%); # # Plot a few functions (just for illustration #   plots:-odeplot          ( Ans,            [ [Y, U(Y)],              [Y, Theta(Y)],              [Y, U(Y)*Theta(Y)]            ],            Y=0..1,            color=[red, blue, black],            legend=[typeset(U(Y)), typeset(Theta(Y)), typeset(U(Y)*Theta(Y))]          );
 >