Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

I have a vague feeling that I may be missing something important in this discussion (especially since I would've expected Acer to come up with this also), but doesn't the following simple code, which uses no unapply and no quotes, do what you want?

G:= [seq(subs(_u= u, theta-> x-> _u*theta*x), u in [v1,v2])];

Many commands (perhaps most) don't automatically map themselves over container objects such as Vectors, lists, and sets. This can often be achieved by appending ~ to the command name, making it into an elementwise command. In your case, this works:

A:= Vector([1, 2, 3]):
solve~(2*A =~ 5+x);

Note also the use of the in =~. See ?elementwise.

 

 

If you're willing to change Matrix itself, you can perform the operation in place, which saves time, memory, and typing:

A[.., 1]:= b;

Matrix, in addition to being a type, is also a procedure. It's the constructor procedure for matrices that you just used. When you use print, it forces the expansion of the name Matrix into its underlying procedure. You'd get the same thing if you'd executed print(Matrix) at the top level (i.e., outside a procedure). The solution to your problem is to simply not use print. A procedure's return value is simply the result of its last executed statement; there's no need to use print to see a procedure's result. Indeed, it is a bad practice to use print in this way. It should only be used to display supplementary information, not the procedure's return value.

Set new initial conditions after the singularity, and plot on the range after the singularity. Then combine the plots. For your case, I set n(14) = 1.1, T(14) = 1.1, then plotted on 14..30. It reaches the next singularity at t = 27.....

To convert a table T into a list in the order implied by its indices, use 

[entries(T, 'indexorder', 'nolist')];

instead of

convert(T, 'list');

Also, the plot and Statistics commands accept lists as well as Vectors. With these changes, your code simplifies to

restart:

Atot:= 0:
PtotFkt:= ii-> ii^2: #Keep function definition outside loop.

for ii from 0 by 0.01 to 2 do
     (Atot, A[ii], t[ii]):= (Atot + 0.01*PtotFkt(ii), Atot, ii)
end do:

#Conversion from tables to lists.
#Reuse names A and t to encourage garbage collection.
(A,t):= [entries]~([A,t], 'indexorder', 'nolist')[]:

plot(t, A, style= point, symbol= asterisk, color= blue);
regress:= Statistics:-PolynomialFit(10, A, t, time);
plot(regress, time= 0..2);

 

In the future, please use plaintext for your posted Maple code, or upload a worksheet. Then we won't need to retype your commands.

The solve your problem, go to the Maple Application Center and download the package DirectSearch. The worksheet below shows how to use it. You can see that the package stumbles around a bit before coming up with a solution, but the solution that it finally produces is accurate.

 

restart:

Digits:= 15:

T[l]:= 20:

C[p]:= 3779:

rho:= 1026:

nu:= 0.004/60:

P:= 1000:

lign1:= H = 40.09 + 14.774*ln(T[i]-T[l])+(2.28+0.338*ln(T[i]-T[l]))*T[l];

H = 85.69+21.534*ln(T[i]-20)

lign2:= H = -nu*rho*C[p]*ln(1-(T[i]-T[r])/(T[i]-T[l]));

H = -258.483600000000*ln(1-(T[i]-T[r])/(T[i]-20))

lign3:= P = nu*rho*C[p]*(T[i]-T[r]);

1000 = 258.483600000000*T[i]-258.483600000000*T[r]

Two failed attempts to solve it:

solve({lign||(1..3)}, {T[i], T[r], H});

Warning, solutions may have been lost

fsolve({lign||(1..3)}, {T[i], T[r], H});

fsolve({1000 = 258.483600000000*T[i]-258.483600000000*T[r], H = -258.483600000000*ln(1-(T[i]-T[r])/(T[i]-20)), H = 85.69+21.534*ln(T[i]-20)}, {H, T[i], T[r]})

Sol:= DirectSearch:-SolveEquations([lign||(1..3)]);

Warning, objective function returns unfeasible value 1017419.58204931+20066.4653263053*I for initial point [H = .900000000000000, T[i] = .900000000000000, T[r] = .900000000000000]; trying to find a feasible initial point

Warning, the new feasible initial point is [H = -.124468522829816, T[i] = 27.0904567017001, T[r] = 44.6637687621344]

Warning, complex or non-numeric value encountered; trying to find a feasible point

Sol := [2.12535788608859*10^(-22), Vector(3, {(1) = 0.4057199021e-11, (2) = 0.5826450433e-11, (3) = -0.1273292582e-10}), [H = 134.278515805142, T[i] = 29.5482965427669, T[r] = 25.6795791463827], 609]

Sol[3];

[H = HFloat(134.27851580514186), T[i] = HFloat(29.54829654276689), T[r] = HFloat(25.6795791463827)]

 

 

Download Temp_Power.mw

Why not simply use solve:

solve((z^2-1)/(z^2+1) = c, z);

Simple: Use a local declaration:

lisse:= proc(...)
local AzIII;

...
end proc:

It's not built-in (AFAIK), but it can be written as a trivial one-liner. However, you do need to specify the maximum number of bits to allow for the numerator.

`convert/dyadic`:= (x::nonnegative, b::posint)-> ``(trunc(x))+round(2^b*frac(x))/2^b:

convert(1.74, dyadic, 5);

     (1)+3/4

convert(1.74, dyadic, 6);

     (1)+47/64

The pochhammers can be converted to summations by following the differentiation command with

convert(%, Sum);

The best simplifier that I've found for explicit algebraic numbers (meaning those specified without RootOf) is evala@evalc. In this case, this combo will quickly reduce ab, and c to a form from which it's obvious that no further simplification is possible. Then I do two independent verifications--one numeric and one symbolic---that these simplifications are correct. The numeric is evalf[10]@evalf[999]; the symbolic is evala@Normal.

 

restart:

a:= -((4*I)*sqrt(3)+4*sqrt(3)-5-7*I)/((4*I)*sqrt(3)+4*sqrt(3)-7-9*I);

 

b:= -((390*I)*sqrt(3)+30*sqrt(3)-52-675*I)/(-3-4*I+2*sqrt(3)+(2*I)*sqrt(3))^3;

 

c:= -(1/2)*sqrt(2-2*I)*((6*I)*sqrt(3)+6*sqrt(3)-11-10*I)*
    (-2+sqrt(3))*sqrt(-2-2*I)*((2*I)*sqrt(3)+2*sqrt(3)-5-2*I)/
    (-3-4*I+2*sqrt(3)+(2*I)*sqrt(3))^3;

 

-((4*I)*3^(1/2)+4*3^(1/2)+(-5-7*I))/((4*I)*3^(1/2)+4*3^(1/2)+(-7-9*I))

-((390*I)*3^(1/2)+30*3^(1/2)+(-52-675*I))/((-3-4*I)+2*3^(1/2)+(2*I)*3^(1/2))^3

-(1/2)*(2-2*I)^(1/2)*((6*I)*3^(1/2)+6*3^(1/2)+(-11-10*I))*(-2+3^(1/2))*(-2-2*I)^(1/2)*((2*I)*3^(1/2)+2*3^(1/2)+(-5-2*I))/((-3-4*I)+2*3^(1/2)+(2*I)*3^(1/2))^3

v:= <a,b,c>:

vs:= (evala@evalc)~(v);

vs := Vector(3, {(1) = (-209/481-(226/481)*I)+(120/481)*sqrt(3)-((128/481)*I)*sqrt(3), (2) = (132/343)*sqrt(3)+(425/343)*I, (3) = (374/343)*sqrt(2)-((75/343)*I)*sqrt(3)*sqrt(2)})

evalf[999](v-vs): evalf(%);

Vector(3, {(1) = 0.1000000000e-998-0.7000000000e-998*I, (2) = 0.1861000000e-995+0.2560000000e-995*I, (3) = 0.1000000000e-997+0.4700000000e-997*I})

(evala@Normal)~(v-vs);

Vector(3, {(1) = 0, (2) = 0, (3) = 0})

Perm(cycles)

``

 

Download evala_evalc.mw

Square brackets can't be used as a higher level of parentheses. Only round parentheses may be used for algebraic grouping.

After you correct that, it'll require many function evaluations and several minutes for it to integrate out to 20. You need to include the option maxfun= 0 in the dsolve command so that it doesn't try to limit the number of function evaluations.

I doubt that in the general case that it's possible to do any better than this brute force method:

Ker:= (H, g1::Group)->  select(g-> H(g)=Perm([]), GroupTheory:-Elements(g1));

where is the homomorphism. Certainly nothing to this end is already implemented in Maple 18.

As far as I'm concerned, the correct way to do it is now, and always (at least since Maple Vr4) has been, 

t:= (a/b)^2*x*y:
fprintf(outfile, "%A:= %A;\n", 't', t);

Your usage of cat doesn't seem to be supported by the documentation at ?cat, which clearly states (in Maple 18) that cat may return an object of type `||`. Also, it's been ages since strings and names were considered the same thing. You're using names; you'd be better off using true strings.

First 235 236 237 238 239 240 241 Last Page 237 of 395