Carl Love

Carl Love

28070 Reputation

25 Badges

13 years, 27 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@samiyare Amir, with your permission I'd like to rename this thread to "BVP with constraining integrals" so that it will be easier to find in the future. I'm open to suggestions for a better name.

@samiyare Amir, with your permission I'd like to rename this thread to "BVP with constraining integrals" so that it will be easier to find in the future. I'm open to suggestions for a better name.

@Preben Alsholm Excellent solution, Preben! But how did you choose the weights? Why not put both solutions on the same scale? And did it seem like fsolve cared?

@Preben Alsholm Excellent solution, Preben! But how did you choose the weights? Why not put both solutions on the same scale? And did it seem like fsolve cared?

@erik10

Just guessing here. Try a compiled but non-parallelized version: the one that Acer posted.

@erik10

Just guessing here. Try a compiled but non-parallelized version: the one that Acer posted.

I just uploaded the worksheet for my numeric solution and put it as a Reply to my numeric Answer below. There is a disturbing difference in the plot of V(t). The symbolic solution is more believable: Since L(t) is nearly linear, ode1 implies that V(t) is nearly constant.

I am going to try adjusting error parameters on the numeric solution.

I just uploaded the worksheet for my numeric solution and put it as a Reply to my numeric Answer below. There is a disturbing difference in the plot of V(t). The symbolic solution is more believable: Since L(t) is nearly linear, ode1 implies that V(t) is nearly constant.

I am going to try adjusting error parameters on the numeric solution.

 



restart:

ode1:=diff(L(t),t)*(V(t))=0.682*10^(-7):

ode2:=137*10^6*diff(V(t),t)*V(t)=(1/(4*3.14))*1.66*10^(-10)*L(t)^2*(3.5*10^3-V(t))^2:

ic1:=V(0)=0.01:

ic2:=L(0)=0:

sys:= {ode1,ode2,ic1,ic2}, {V(t),L(t)}, numeric:

Sol:= dsolve(sys):

plots:-odeplot(Sol, [t,L(t)], t= 0..100);

plots:-odeplot(Sol, [t,V(t)], t= 0..100);

The plot for V(t) is not believable. I expect something nearly constant. But if I narrow the range:

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Ah ha.

 

Try an implict numeric solver.

Sol:= dsolve(sys, method= mebdfi):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Sol:= dsolve(sys, method= lsode):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Sol:= dsolve(sys, method= rosenbrock, range= 0..15):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

 



Download moji_numeric.mw

 



restart:

ode1:=diff(L(t),t)*(V(t))=0.682*10^(-7):

ode2:=137*10^6*diff(V(t),t)*V(t)=(1/(4*3.14))*1.66*10^(-10)*L(t)^2*(3.5*10^3-V(t))^2:

ic1:=V(0)=0.01:

ic2:=L(0)=0:

sys:= {ode1,ode2,ic1,ic2}, {V(t),L(t)}, numeric:

Sol:= dsolve(sys):

plots:-odeplot(Sol, [t,L(t)], t= 0..100);

plots:-odeplot(Sol, [t,V(t)], t= 0..100);

The plot for V(t) is not believable. I expect something nearly constant. But if I narrow the range:

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Ah ha.

 

Try an implict numeric solver.

Sol:= dsolve(sys, method= mebdfi):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Sol:= dsolve(sys, method= lsode):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

Sol:= dsolve(sys, method= rosenbrock, range= 0..15):

plots:-odeplot(Sol, [t,V(t)], t= 0..15);

 



Download moji_numeric.mw

@N00bstyle 

I'm sorry, I led you astray with SUBS (3). The `if` command has very special evaluation rules that I don't fully understand. Consequently, the subs needs to be done twice. Below, I make the "substituter" a local procedure so that the whole subs command does not need to entered twice.

modalmasspedestriansfail:= proc(_h)
local Ev:= x-> subs(height= _h, x);
     Ev(
           `if`(
                 Ev(qpercentagedifference) >= 5/100
,
              modalmasswithpedestrians,
                 modalmasswithoutpedestrians
           )
     )
end proc:

or

modalmasspedestriansfail:= proc(_h)
local Ev:= x-> subs(height= _h, x);
     `if`(
            Ev(qpercentagedifference) >= 5/100
,
          Ev(modalmasswithpedestrians),
            Ev(modalmasswithoutpedestrians)
     )
end proc:

@N00bstyle 

I'm sorry, I led you astray with SUBS (3). The `if` command has very special evaluation rules that I don't fully understand. Consequently, the subs needs to be done twice. Below, I make the "substituter" a local procedure so that the whole subs command does not need to entered twice.

modalmasspedestriansfail:= proc(_h)
local Ev:= x-> subs(height= _h, x);
     Ev(
           `if`(
                 Ev(qpercentagedifference) >= 5/100
,
              modalmasswithpedestrians,
                 modalmasswithoutpedestrians
           )
     )
end proc:

or

modalmasspedestriansfail:= proc(_h)
local Ev:= x-> subs(height= _h, x);
     `if`(
            Ev(qpercentagedifference) >= 5/100
,
          Ev(modalmasswithpedestrians),
            Ev(modalmasswithoutpedestrians)
     )
end proc:

@N00bstyle 

In method (2), you have the [] inside the parentheses; it needs to go outside, as in this skeleton:

A,B,C:= subs(...= ..., [..., ..., ...] ) []

This says "Make the substitutions in the list [..., ..., ...], THEN turn the list into a sequence (of three items) to match with A,B,C." With the [] inside the parentheses, it says "Turn the list into a sequence, THEN pass that to subs," which subs interprets as nonsense because you are trying to pass it four arguments.

 

In method (3), you used the wrong type of quote marks. It's `if`, not 'if'. On a standard US keyboard, the single back quote is in the upper left corner, under ESC, on the same key as ~.

@N00bstyle 

In method (2), you have the [] inside the parentheses; it needs to go outside, as in this skeleton:

A,B,C:= subs(...= ..., [..., ..., ...] ) []

This says "Make the substitutions in the list [..., ..., ...], THEN turn the list into a sequence (of three items) to match with A,B,C." With the [] inside the parentheses, it says "Turn the list into a sequence, THEN pass that to subs," which subs interprets as nonsense because you are trying to pass it four arguments.

 

In method (3), you used the wrong type of quote marks. It's `if`, not 'if'. On a standard US keyboard, the single back quote is in the upper left corner, under ESC, on the same key as ~.

@erik10 The () makes the procedure immediately above it execute; it's like the () in f(). Without the () it would just be a procedure definition.

First 642 643 644 645 646 647 648 Last Page 644 of 709