Preben Alsholm

13471 Reputation

22 Badges

20 years, 249 days

MaplePrimes Activity


These are answers submitted by Preben Alsholm

I guess instead of d = 1 you meant degree=1?

curvefit := Spline(roi, x, degree = 1):

#Then solve works:

solve(curvefit = .3, x);

# Since curvefit is not a polynomial only one solution is returned by fsolve at a time:

fsolve(curvefit = .3, x);


# but you can add a starting point to find the other solution:

fsolve(curvefit = .3, x = 740);

#You could also try
Student:-Calculus1:-Roots(curvefit = .3, x = 685 .. 761);

LinearAlgebra:-Norm(<-1,3>-<4,-2>,2);

I am assuming that you don't want to just plot the solutions to the equation, but rather e.g. the left and right hand sides:

eq:=x^4+x^2=3*x^2+8;
solve(eq,x);
plot([lhs(eq),rhs(eq)],x=-3..3,0..30);

#or you could plot the difference:

plot(lhs(eq)-rhs(eq),x=-3..3);
#Alternatively:
plot((lhs-rhs)(eq),x=-3..3);

You could write the points as lists (using square brackets [ ]) or as column vectors (using < >):

([0,2]+[1,3])/2;
(<0,2>+<1,3>)/2;
([a,b]+[c,d])/2;
(<a,b>+<c,d>)/2;

If you change

TransferFunction(linmod);

to

TransferFunction(linmod[1]);


things seem to work.


 

It makes a difference whether you use MultiSeries or not.

The limit is 0 if S > 1 and -Theta0*F/k if S < 1.

restart;

A1:=-1*C/k*F*exp(-Pec_i*C/k*F*S)/(-1+exp(-Pec_i*C/k*F*S))+Theta0/k*F*exp(-Pec_i*F*S)/(exp(-Pec_i*F)-exp(-Pec_i*F*S));
limit(A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S>1;
limit(A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S<1;

#Now with MultiSeries, where it seems to be necessary to take limits of each term. Multiseries has its own version of limit

restart;
with(MultiSeries);
1:=-1*C/k*F*exp(-Pec_i*C/k*F*S)/(-1+exp(-Pec_i*C/k*F*S))+Theta0/k*F*exp(-Pec_i*F*S)/(exp(-Pec_i*F)-exp(-Pec_i*F*S));
limit(A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S>1;
limit(A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S<1;
map(limit,A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S>1;
map(limit,A1,Pec_i=infinity) assuming C>0,F>0,k>0,H>0,Theta0>0,S>0,S<1;

You could use algsubs:

algsubs(a*c='F',K);

But as soon as a new evaluation takes place, e.g. just by doing %; you are back where you started.

0^k simplies automatically to 0, which can be seen by placing unevaluation quotes aound it

'0^k';

Thus

sum(0^k,k=0..0);

and also

add(0^k, k=0..0);

evaluate to 0.

My Maple 14 (with worksheet interface and 1D-input) doesn't complain about the assignment you mention, and it ought not.

However, it is a bad idea in general to do like that. You may think that you defined a function, but all you did was to tell Maple that the literal input (x,0) should result in 'piecewise(x < -h, 0, -h <x and x <h, 1, h<x, 0)'. Maple wouldn't know what to do with the input 7.1234 for example.

Remember that my comment relates to worksheet interface and 1D-input, which I use exclusively.

I recommend doing like this instead:

restart;

u:=x->piecewise(x < -h, 0, x<h, 1,0);
#See the result of the assignment:
u(x);
#In order to plot, h needs to have a value other than its name:
h:=2:
plot(u(x),x=-3..3,thickness=3);

Also note that your piecewise can be simplied as shown.

You could take a look at

?assign

Personally, I usually don't assign values to unknowns, which is inconvenient if you like to keep using them as variables. Instead I do something like the following, where I have used the syntax with curly brackets around the variables.

res:=solve([eq1(x,y,z) , eq2 (x,y,z) , eq3(x,y,z)] , {x , y , z});

When you need to insert values into an expression E you could say

res2:=eval(E, res);


You have picked infinity = 25. Could it be that you should have chosen infinity = 15.6?

Something seems to be going on around there.

restart;
Eqs:= {diff(f(eta),eta,eta,eta)+3*f(eta)*diff(f(eta),eta,eta)-2*diff(f(eta), eta)^2+g(eta)=0,
diff(g(eta),eta,eta)/Pr+3*f(eta)*diff(g(eta), eta)=0}:
inf:=15.6:
BCs := {f(0)=0, D(f)(0)=0, D(f)(inf)=0, g(0)=1, g(inf)=0};
eqs:=eval(Eqs,Pr=1e-2):
sol := dsolve(BCs union eqs, {f(eta), g(eta)}, numeric, output = array([seq(i, i = 0 .. inf),inf]));
sol2 := dsolve(BCs union eqs, {f(eta), g(eta)}, numeric):
plots:-odeplot(sol2,[[eta,f(eta)],[eta,g(eta)]],0..inf);

It appears that the answer can be expressed in terms of BesselI:

Start by replacing btp*s by s (for convenience).

fc := exp(s*cos(2*Pi*x/a))*exp(-(I*2)*Pi*n*x/a);
F:=Int(fc,x=0..a);
#By making a change of variable
IntegrationTools:-Change(F,x=a*y/2/Pi,[y]);

#we see that we need only consider

f:=eval(fc,a=2*Pi);

#Maple doesn't find an answer here

int(f, x = 0 .. 2*Pi)  assuming s> 0, n::integer;

#However, the following numerical evidence suggests that the answer to the integral K is 2*Pi*BesselI(n,s)
K:=Int(f,x=0..2*Pi);
seq(evalf(eval(K-2*Pi*BesselI(n,s),s=1.234)),n=0..30):
simplify(fnormal([%]));
#which results in {0.}

I don't use MapleSim, but tried it in Maple itself.

Not knowing the values of m, k, or Fc, I justed picked some.

eq:=m*diff(x(t),t,t)+k*x(t)+Fc*signum(diff(x(t),t))=0:
eq2:=eval(eq,{m=1,k=1,Fc=.1}):
res:=dsolve({eq2,x(0)=1,D(x)(0)=0},numeric,maxfun=0):
plots:-odeplot(res,[t,x(t)],0..16);

The curve looks rather smooth. It appears that the solutions actually joins the zero solution, at about t = 15.71.

Without maxfun = 0, you get a warning saying


"Warning, cannot evaluate the solution further right of 15.713408, maxfun limit exceeded (see ?dsolve,maxfun for details)"

If I understand you correctly, then the command

interface(displayprecision=5);

does the job.

As it says in the help page for interface, it

"Controls the number of decimal places to be displayed. .... . This allows simplification of display without introducing round-off error."

Another way to do it is to go to "Tools/Options/Precision/Round screen display to".

Since the rewriting as an explicit first order system is ambiguous in this case, you can do as follows.

The second equation doesn't contain diff(theta(rho,rho) and is only of 4th order in diff(r(ho),rho). The two first roots are real at start, the next two imaginary. I selected the first.

I also made some unimportant syntactic changes

restart;
Eq[1] := .1*(diff(r(rho), rho))^5*r(rho)^4*sin(theta(rho))+(diff(r(rho), rho))^3*cos(theta(rho))^2*sin(theta(rho))*(r(rho)^4-.1*rho^4)+(diff(r(rho), rho))*rho^4*cos(theta(rho))^4*sin(theta(rho))+(r(rho)^2*rho^2*(diff(r(rho), rho))^4*cos(theta(rho))-rho^4*cos(theta(rho))^5+.1*r(rho)^4*(diff(r(rho), rho))^4-.1*r(rho)^2*rho^2*cos(theta(rho))^5)*(diff(theta(rho), rho))*r(rho):
Eq[2] := p*(diff(r(rho), rho))*cos(theta(rho))^3*rho-(diff(r(rho), rho))^4*r(rho)^2*sin(theta(rho))+rho^2*cos(theta(rho))^4*sin(theta(rho))-.1*r(rho)^4*(diff(r(rho), rho))^4*sin(theta(rho))+.1*cos(theta(rho))^4*sin(theta(rho))*r(rho)^2:
ICs := {r(1) = 1., theta(1) = 1.4}:
eqs:=eval([Eq[1],Eq[2]],{p=4}):
S2:=solve(eqs[2],diff(r(rho),rho),explicit):
eval(S2,{rho=1,theta=1.4,r=1.});
Ldiff2:=diff(r(rho),rho)=S2[1]:
vars := {r(rho), theta(rho)}:
sol := dsolve({eqs[1],Ldiff2} union ICs, vars, numeric, output = array([seq((1/20)*i, i = 20 .. 40)]));

First 146 147 148 149 150 151 152 Last Page 148 of 158