Mac Dude

1536 Reputation

17 Badges

11 years, 99 days

MaplePrimes Activity


These are answers submitted by Mac Dude

I doubt there is a closed-form expression for B; but you could try IntegrationTools:-Change and come up with a clever substitution e.g. to simplify the exponent & maybe get the thing integrated. But I am not at all confident this would get you anywhere (and I do not have the time to play this through).

You could also approximate your function with something that can be integrated. Given the range of arguments and values that may be a bit challenging but it may be possible. As Preben suggested, you may need to normalize to get an expression somewhat better conditioned. Finally, you may try a series expansion of B in terms of A & see if this gets you somewhere (the series, being a polynomial, should integrate easily)

As it is, Maple does not know how to solve this integral, & I don't either.

Mac Dude.

Your plot is the same as what I got when I replied to your original question http://www.mapleprimes.com/questions/142296-Pade-Approximation . So it is just about as correct or incorrect as my own evaluation (which was done with Maple 15 on Mac OS X). I think it is correct.

One concludes from the plot that the Pade approximation goes bad above X=0.5; as I pointed out before.

From your reply to Preben's comments I gather that your function is obtained by some form of series approximation used in solving the original d.e. This is a perfectly fine thing to do. However, I fail to see why you want to then approximate the already approximate solution with a more complicated function. To be clear: this is not a way to increase the accuracy of your solution. If you want to get a more accurate solution you have to carry more terms in the original series (assuming your problem is stable enough to give you meaningful terms of higher order). You may consider approximating a series solution of much higher order with your Pade approx.; that could be a meaningful thing to do. You could even consider calculating a numerical solution and approximate that with a rational expression (this would not be a Pade approximation in the technical sense, though).

What is it that makes you unhappy with your original function??

M.D.

If you plot the results:

plot([f,pade(f,x=0,[5,4])],x=0..1);

you will see that the pade result is close to f up until about x=0.5.

I don't know whether it should agree for higher values of x; but I also do not see the point of approximating what is obviously already a truncated series with a rational function of too high a degree. If you want the Pade approximation to the original function you should start from there. As the docs to pade() explain; it'll start from a series to order 5+4 (in your case). Then you can compare these approximations with the original function & decide what best suits your problem.

Mac Dude

Sur mon ecran, le texte est coupe a la droite. Peut etre quelques parentheses sont perdu?

On my screen, the text is truncated on the right. Maybe some braces got lost?

 

M.D.

This seems to work:

t:=1200*Unit(degF);

     1200*Units:-Unit(degF)

evalf(convert(t,temperature,degF,degC));

     666.666666666667*Units:-Unit(degF)-17.7777777777778

I do not like the dimensionless number being subtracted... but then, I usually do not use Maple's unit facility.

Mac Dude

Why do you start from a list construct? There are Vector & Matrix constructors, see ?Vector and ?Matrix.

When you try to convert a Matrix like A1 to a Vector, what is the result you expect? A colum or row? The Matrix "unrolled"? If so, how?

Mac Dude

 

While Carl showed you how to do this right in your case, Arrays can be dynamically extended using "programmer indexing" i.e. round braces () rather than angle brackets [], by assigning to not-yet extant elements of the Array. Programmer indexing always starts at 1 even if the Array is not 1-based. See the Programming Guide for details.

I do believe Carl's suggestion will be more efficient in your case.

Mac Dude.

Use the +~ operator

v1 +~ v2 +~ v3   etc.

 

Mac Dude

PS: Please be aware that in the western world you usually do not call on a higher authority like God when discussing technical matters. Some people consider that inappropriate.

You are looking at round-off errors. In my environment I set Digits to 15 and I get

n=1: 1.12000000000000 E+15 (this is probably infinite as the exponent goes up with Digits)

You probably have Maple's default of 10 Digits.

For n=2 clearly Matlab is underrunning.

For n=3 Maple may be doing it symbolically and correct. You can get a similar result as Matlab if you evalhf(A3(3)) thus forcing floating-point evaluation using your computer's FPU. Floating hardware is not accurate to the last bit (many numbers cannot be represented exactly in fp) & thus the denominator can underrun to a small non-zero number rather than exact zero.

Mac Dude

You probably know that a correct answer is x=4,y=3,z=5.

Here is how the result of isolve may be explained (which does not make it correct!):

xpr:=(1 + 1/x)*(1 + 1/y)*(1 + 1/z);

xpr2:=normal(subs(y=-2,xpr));
                        (x + 1) (z + 1)
                        ---------------
                             2 x z     
solve(xpr2=2,x);
                             z + 1  
                            --------
                            -1 + 3 z

and isolve will merrily solve this by z=-1 which gives x=0. All perfectly reasonable, right? Except that we make an implicit assumption of x>0 as else the given solution of xpr2=2 for x is not bounded. But just looking at the solution for xpr2=2 this little detail is lost. On the other hand; there is nothing wrong with xpr2 a priori either.

So the message here is that one needs to keep track of assumptions, in particular the implicit ones. Note that in many cases what I outlined here would be a perfectly fine thing to do; as long as all intermediate results are well defined.

I am not sure this qualifies as a bug. I would call it a limitation (of isolve). Such limitations are frequently encountered with any CAS, not just Maple.

Mac Dude

Did you try plot(x,y); ?

Are the x and y actually populated? If longer than 10 they evaluate to a placeholder; double click on it to get a viewer into the Vector (or whatever you have made x and y to be).

I do suggest you read the literature that comes with Maple or can be dl/d from the Maplesoft website. Maple is a complex tool & requires practise to master it. "One Homework Problem at a Time (r)"  :-)

Mac Dude.

I played around a little with your example but in the end it is the same: the individual procs work as expected but putting them together using overload either fails or produces unexpected behaviour (calling the wrong proc) as soon as more than one argument is given for s (the posint).

Incidentally; I use Maple 15. I assume Preben has Maple 16, but...??

Anyway: SPR time! (sorry, I guess Maplesoft calls it SCR)

M.D.

What you do does reverse the string but is not an example for recursion.

Recursion happens when a procedure calls itself. For your (homework?) problem; you can use seq to convert the string into a sequence of characters and then write a procedure to exchange the position of the first and all the other elements of the sequence (i.e. move the first to the last position). Then within the procedure you call the procedure itself on the subsequence of all but the last elements. When you have only two elements as argument you exchange the position of these of & return.

M.D.

Maple has the ability to insert spreadsheet-like frames into a (standard-) worksheet. Help Spread will tell you all about it. I don't have much experience with it but you can set its cells & look at the data.

If you have a long Vector or Matrix that displays only its placeholder: you can double click on the placeholder & a viewer window opens.

Mac Dude

Ask yourself: what is the minimum info defining the object you want to draw:

A circle is defined by its radius.

Prallel lines are defined by their slope and the distance between them

So, given good enough "geometry software" these are the pieces of info necessary to draw these objects, no more, no less. An entirely different question would be: What are suitable "mechanics" to plot these: parametric, in polar coordinates, ...

My $0.02

Mac Dude

First 17 18 19 20 Page 19 of 20