Preben Alsholm

13743 Reputation

22 Badges

20 years, 338 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Iza If C11, C12, .. depend on x, the integration cannot be done before substituting values, so my last suggestion certainly won't work.

It could be that your whole problem should be done numerically. To get any further you need to give us all the details.

### To illustrate what I have in mind here is a third version of the present problem.
## This version still assumes that C11, etc. are constants.
restart;
z1:=H/mg*cosh(mg/H*(x+C11))-C21;
z2:=H/mg*cosh(mg/H*(x+C12))-C22;
tg_alpha1:=diff(z1,x);
tg_alpha2:=diff(z2,x);
r1:=H*subs(x=xP,tg_alpha2)-H*subs(x=xP,tg_alpha1)-P;
r2:=subs(x=0,z1);
r3:=subs(x=l,z2)-h;
r4:=subs(x=xP,z1)-subs(x=xP,z2);
mg:=2:l:=20:h:=5:xP:=l/5:P:=10:
##We make a numerical procedure for computing eq1:
eq1:=proc(H1) local C,s1,s2,s,L0;
  C:=fsolve(eval({r1,r2,r3,r4},H=H1),{C11, C12, C21, C22}); #fsolve, H1 concrete
  s1:=evalf(eval(Int(sqrt(1+tg_alpha1^2),x=0..xP),{H=H1} union C)); #Numerical integration
  s2:=evalf(eval(Int(sqrt(1+tg_alpha2^2),x=l..xP),{H=H1} union C)); #Ditto
  s:=s1-s2;
  L0:=40;
  L0-s
end proc;

   
eq1(10); #Test
plot(eq1,10..11,adaptive=false,numpoints=10);
fsolve(eq1,10..11);


@Iza The integration is not the problem at all as you will see more clearly if you do the integrals before evaluating the constants C11 etc. for the values found by solve.
I have put that at the bottom of my answer.

Using "hello there" or `hello there` works for me. (I just tried: I never use spreadsheets).

@Lulu I had success with the following (in Maple2015):

pf:=factor(g);
q:=op(-1,pf);
fsolve(q,p,complex);

Maybe the fact that p=0 is a root of order 5 gives some problems.

This works too:

q1:=pf/p;
fsolve(q1,p,complex);

and (less interesting):
fsolve(g+1,p,complex);





@torabi In approxsoln a comma is missing between the expressions for f4 and f5.

If you correct that you get quite a lot of successes:

indx;
    ((D@@2)(f3))(1), ((D@@3)(f3))(1), (D(f1))(1), ((D@@2)(f2))(0), ((D@@2)(f5))(0), (D(f6))(1), ((D@@2)(f2))(1), ((D@@3)(f3))(0), (D(f6))(0), ((D@@2)(f3))(0), ((D@@2)(f5))(1)

@Just_Some_Guy You are still not giving us f.

You ought to give us the whole code. What is f,  z_min ?

Could you explain in some other way what it is you want to do? I don't have a clue.

@torabi So what is the question?

@Markiyan Hirnyk Yes, making assumptions may help, but this version

value(I5) assuming x0>0;

produces the result I mentioned.

Your version most likely just evaluates the signum factor:
res:=evalc(value(I5)) assuming x0>0;
indets(res,name);
         {x0, infinity}
evalf(eval(res,x0=1));
         Float(infinity)+Float(infinity)*I
  

@torabi I see that you completely ignored my advice given above.

@torabi You have the following lines, but you don't look at the output. You should!

indets(sys,specfunc(diff)); #Semicolon
## and later
indets(newsys,specfunc(diff));

Notice that the order of the highest derivative of f6 in sys is 2, whereas it is 3 for newsys.
You should avoid differentiating any equation that will increase any of the highest orders of f1,f2, ..., f6.




Right click on the link you have to Steen Markvorsen's file. Choose save as. Open it from within Maple. That worked fine for me.

Let me add that you can solve numerically:

ode := diff(Y(x), x$4) = a^4*Y(x);
ics := Y(0) = 0, D(Y)(0) = 0, Y(l) = 0, (D@@2)(Y)(l) = 0;
ode4:=subs(a^4=a4,ode);
resnum:=dsolve(eval({ode4,ics,(D@@2)(Y)(0)=1},l=2),numeric);
resnum(0);
subs(resnum(0),a4);
%^(1/4); #Same as a2 in the symbolic version
plots:-odeplot(resnum,[x,Y(x)],0..2);
#You can get get the next one by giving an approximate solution:
resnum2:=dsolve(eval({ode4,ics,(D@@2)(Y)(0)=1},l=2),numeric,approxsoln=[a4=4^4,Y(x)=sin(Pi*x)]);
resnum2(0);
subs(resnum2(0),a4);
%^(1/4); #Same as a22
plots:-odeplot(resnum2,[x,Y(x)],0..2);

@patient Since your system is somewhat difficult to examine analytically it may be worthwhile to consider the following example, which can be analyzed analytically and which exhibits similar nonuniqueness features.

restart;
ode1:=diff(v(x),x)=-2*u(x)*sqrt(v(x));
ode2:=v(x)*diff(u(x),x)=0;
dsolve({ode1,ode2,v(0)=1,u(0)=1});
simplify([%]) assuming x<1;
odetest({v(x)=0,u(x)=u(x)},[ode1,ode2]);
#Now picking as an example u(x) as a polynomial or order three and making sure it meets u(x)=1 and u(x)=-1 differentiably at x=1 and 2, respectively:
f:=x->a*x^3+b*x^2+c*x+d;
solve({f(1)=1,D(f)(1)=0,f(2)=-1,D(f)(2)=0},{a,b,c,d});
U12:=eval(f(x),%);
##Piecing a solution together:
U:=piecewise(x<1,1,x<2,U12,-1);
V:=piecewise(x<1,(x-1)^2,x<2,0,(x-2)^2);
plot([V,U],x=0..3,thickness=3,legend=[v(x),u(x)]);

odetest({u(x)=U,v(x)=V},[ode1,ode2]);
#########
## The numerical solution must stop just before 1:
res:=dsolve({ode1,ode2,v(0)=1,u(0)=1},numeric);
plots:-odeplot(res,[[x,v(x)],[x,u(x)]],0..3);


First 101 102 103 104 105 106 107 Last Page 103 of 231