Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@tira

Are you claiming that the plots produced by pdsolve in your most recently posted worksheet are wrong---that they don't match some exact solution that you have? Please post a worksheet with that exact solution and the corresponding plots.

@tira Okay, I got the worksheet file. Thanks. I ask again What do you need? I see no error in your worksheet.

I suppose that you want a solution with the integer part and the fractional part juxtaposed, i.e., without any intervening symbols. So solutions that use a plus sign are no good, right?

@Markiyan Hirnyk The cfrac prettyprint machinery can be successfully employed like this:

Mixed:= r-> CFRAC([trunc(r), [op(r-trunc(r))]]):
Mixed(17/6);

Note the use of capital letters: CFRAC. Also note that it is necessary to use trunc instead of floor so that negative numbers are handled correctly.

The original number can be retrieved via

numtheory:-cfrac(%);

The InertForm prettyprint machinery can be successfully employed like this:

Mixed:= r-> InertForm:-Display(`%+`(trunc(r), r-trunc(r))):
Mixed(17/6);

I don't think that there's an easy way to retrieve the original from that.

I think that mixed numbers are immensely practical, not "art for art's sake." Who wants to make a recipe with 17/6 cups of flour?

@itsme

Many thanks for the pointer. I was not previously aware that Finance is as powerful as you suggest. Can you show an example of solving and plotting a user-supplied stochastic differential equation? I would find that most instructive.

@lt Your Reply is a completely new Question rather than a followup to the previous Answer. Please post it as a new Question.

@jockoflocko You wrote:

...I thought that every variable declared outside of a procedure could be used in the procedure without declaring it again....

That's mostly true. You can access the value of any variable declared in a scope more global than the procedure without needing to declare it again. But if the variable appears on the left side of an assignment statement, then it needs to be declared global.

@wolfman29 For a real range, the left endpoint can be -infinity and the right endpoint can be infinity. A complex range must be a rectangle (possibly infinite) specified by (lower left corner)..(upper right corner). For example:

Simply real: -infinity..infinity
A finite complex range: -1-I..1+I
The right half plane (real part nonnegative): 0-I*infinity..infinity+I*infinity

@Markiyan Hirnyk Yes. Considering that this will be done in floating point, a threshold volume to be considered nonplanar can be based on the setting of Digits. I only envision using this method for smooth curves. A nonplanar piecewise curve could contain a planar piece. If all the randomly selected points are on this planar piece, it defeats the algorithm.

@Axel Vogt 

I had mistakenly used 11+1/2 instead 11/2 to replace the 5.5 in the original integrand. After correcting that, I get the same answer as you and as Matlab. I have updated my Answer above.

@sami131 

Note that the expression being plotted has both c0 and m in denominators, so neither of those parameters can be 0. Other than that, putting the plots together is trivial. Indeed, even display is not needed, although it would also be trivial to use it.

M:= [1/2,1/3,3/4,2,3]:
C0:= [0.277164,0.340257,0.408617,0.581345,0.649268]:
plot(
     [seq([X(C0[1],m)(c), c, c= 0..1], m= M)],
     view= [0..1, 0..1], legend= M, labels= [x, C(x)]
);

 

@smith_alpha 

The 6 is the overall length, in characters, of the formatted number, not counting the "e" or the ".".

Note that my procedure MyPrint works without needing the number of digits or characters specified. It counts the digits itself.

@Kitonum Your example is not what the OP meant. All of the following steps work fine:

S:= Sum(w[k], k= 1..n);
P:= randpoly(x);
eval(P, x= S);
algsubs(S= Sw, %);
eval(%, Sw= S);

 

Please post the system of equations.

Having seen Kitonum's solution, I must say that my solution takes a risk of performing a mathematically invalid operation. If the expression had contained a stray 1/(T[1]*V[2]) (perhaps in one of the e exponents), my evalindets would've changed it to 1.

Nonetheless, I understand down to the smallest detail what evalindets does. I can't say the same for algsubs; it is somewhat unpredictable to me.

First 514 515 516 517 518 519 520 Last Page 516 of 709