Carl Love

Carl Love

27731 Reputation

25 Badges

12 years, 165 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Andiguys No, the plot command should not be inside the loop.

In the original double loop, you had s[Cv, tau0]:= Maximize(...). You changed that to s:= Maximize(...). If you change it back to s[Cv, tau0], then you will get the plot.

@charlie_fcl Like this:

(e,f):= ifelse(c<d, [a, 2*b], [3*a, b])[]

You could replace ifelse with piecewise (leaving everything else exactly as is) and get the same result, but IMO ifelse is better.

@charlie_fcl In Maple it can be done as follows, so it's likely to also work in Maple Flow:

(a,b):= (min,max)(c,d)

@Carl Love Okay, I couldn't resist the temptation to make the applyrule work, and I found something that works, although I can't explain why you were getting an infinite loop before.

applyrule(
    x::(anything^And(fraction, 2 &under denom))*y::(Not(1) &under denom)
    = y %* x,
    eq
);

@Carl Love I just added a small change to the code above. I replaced denom(R)=1 with S=1 or denom(R)=1. In other words, if there are no coefficients with denominators OR there are no square roots, then leave the product unchanged.

@SARBAST There is no attached file. Please try uploading it again.

@SARBAST I assume that you want to vary the initial values (x(0), y(0))  over [-6,6] x [-3,6]. We still need initial values z(0) and w(0) in order to do any computation.

@C_R The Wikipedia article "Attractor" contains a definition of basin of attraction. It's the mathematical generalization of the geological / geographical / hydrological concept of drainage basin or watershed.

@C_R I haven't run this yet, but in order to get such a slow and smooth animation to post, the OP very likely included a huge number of extra frames (10 times, or more) in the animation. These extra frames are not needed when viewing in a worksheet because you can slow down the animation with the toolbar controls. Not computing the extra frames should speed up the computation significantly.

@dharr As far as I can tell, the worksheet poly.mw attached to your Answer is the same as when it was originally attached. If this is not true, please include a comment in the worksheet to indicate the new part.

@Andiguys This is to diagnose the problem, not to fix it: Please insert this command after the double loop:

lprint(indices(s, pairs, indexorder));

Then execute the entire worksheet. Then post the entire executed worksheet.

@Andiguys s[1] isn't an equation, so it doesn't have an rhs. It's just a number. So, remove the first rhs.

@dharr p = sinnx (identically, not approximately) only for in -2..2, because of the real domain of arcsin(x/2). I don't know why the OP is trying to extend the domain to -2.1..2.1.

simplify ignores the domain restriction, just as it does with sin(2*arcsin(x)). Indeed, sin(arcsin(x)) automatically simplifies to x.

@Andiguys Here is one way to get that 3D plot. Do this after the double loop. I needed to remove the higher values of Cv because Maximize rejected them.

CV:= [50, 55, 60, 65, 70]:
T0:= [0.3, 0.4, 0.5, 0.55, 0.6, 0.65, 0.7]:
S:= Matrix((nops(CV),nops(T0)), (i,j)-> s[CV[i],T0[j]][1]):
A:= (Cv,t0)-> CurveFitting:-ArrayInterpolation(
    [CV, T0], S, [[Cv], [t0]], method= spline
)[1,1]:
plot3d(A, (min..max)(CV), (min..max)(T0), labels= ['Cv', '`&tau;0`', 'TRC']);

This isn't the most efficient way to use ArrayInterpolation, but the syntax is already daunting, and it's sufficiently efficient for this purpose.
 

@Andiguys I didn't mean to put do at the end of the whole loop; I meant to put it and the end of the the line with the for:

for i from 1 to 10 do 
    i^2
od

od can be replaced by end or end do (they mean exactly the same thing), but not by do. The do on the first line cannot be replaced by anything.

First 6 7 8 9 10 11 12 Last Page 8 of 704