Carl Love

Carl Love

28100 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@J4James The value of exp(x*y) is never 0 or negative, so the surface z = exp(x*y) never intersects z = 0.

Sorry, it was just a standard English response to a "Why can't" question understood literally. I do realize that English isn't your first language, so I didn't actually think that you meant it literally. No offense meant.

The function exp(x+y+z) is never 0 or negative, so "empty plot" is correct. Try changing 0 to 1 and changing the ranges from 0..1 to -2..2.

I got -x-y + ln(C) from solve(C=exp(x+y+z), z). By the way, this shows that every level surface is a plane with normal vector <1, 1, 1>.

 

@J4James Did I say that you couldn't use implicitplot3d? You can use it. But since the level surface can be solved for z (an unusual situation), you'll usually get a more accurate plot in less time with plot3d. In this case, the level surfaces are just planes, so it doesn't make that much difference. But I have the habit of trying to switch to plot3d.

@acer I misread that bullet point. I thought that it said that the globalopts were the same as the localopts except for adaptive and sample. So, the help page isn't wrong.

@acer Hmm. My first inclination was to try to pass a view spec to draw, but upon checking ?geometry,draw I saw that it wasn't one of the supported options. So that help page is wrong. But, anyway, your way---nullifying the VIEW spec---is definitely superior. Vote up.

Surprisingly, the VIEW can't be nullfied by

draw(L1, view= [DEFAULT$2]);
Error, (in geometry:-draw) improper op or subscript selector


For those who prefer minimalist code: In the subsindets, z-> NULL can be replaced by 'NULL'. That leads to this curiousity:

subsindets(draw(L1), specfunc(VIEW), ''()'');

produces the same (correct) plot and then gives the unusually formatted error message

Plot Internal Error:unrecognised option Dag in Plot:null

@sikjw1305 

Here's a resource-usage comparison for partitioning into pairs using Iterator:-SetPartitionFixedSize and using combinat:-setpartition. The former requires some significant post-processing to get it to match the format of the latter, but as we can see below, it's worth it.

restart:

AllPairPartitions:= proc(n::And(posint,even))
local p, `n/2`:= n/2;
     {seq([seq([p[2*k-1], p[2*k]], k= 1..`n/2`)],
      p= Iterator:-SetPartitionFixedSize([2$`n/2`]))
     }
end proc:

ByCombinat:= (n::And(posint,even))-> {combinat:-setpartition([$1..n], 2)[]}:     

 

It's not really fair to count the compilation time because it only occurs the first time that the Iterator is used.

CodeTools:-Usage(AllPairPartitions(2)):

memory used=9.55MiB, alloc change=32.00MiB, cpu time=156.00ms, real time=158.00ms, gc time=0ns

CodeTools:-Usage(ByCombinat(2)):

memory used=30.49KiB, alloc change=0 bytes, cpu time=0ns, real time=2.00ms, gc time=0ns

P1:= CodeTools:-Usage(AllPairPartitions(12)):

memory used=4.49MiB, alloc change=0 bytes, cpu time=78.00ms, real time=85.00ms, gc time=0ns

P2:= CodeTools:-Usage(ByCombinat(12)):

memory used=76.65MiB, alloc change=4.00MiB, cpu time=719.00ms, real time=714.00ms, gc time=46.88ms

 

Verify that the two procedures produce the same output.

evalb(P1=P2);

true

 


Download Iterator_vs_combinat.mw

@Thomas Dean It's possible to calculate the exact values in this problem. Just remove the evalfs.

@mojtaba75 Unfortunately, those file download links don't work.

You should never use a variable in an indexed form (beta[1,2]) and an unindexed form (beta) in the same computation as if they were separate variables. They aren't separate variables. But beta__12 and beta are separate variables.

Assuming that Kitonum's interpretation of the second problem is correct (I have some skepticism because the OP said "24", not "48"), here is the same solution using package Iterator. This generalizes Kitonum's solution to an arbitrary number of subfactors.

Bijections:= proc(A::list, B::And(list, satisfies(B-> nops(B)=nops(A))))
local b;
     [seq(zip(`[]`, A, convert(b[],list)), b= Iterator:-Permute(B))]
end proc:

ProductOfBijections:= proc(A::list(list), B::And(list(list), satisfies(B-> nops~(A)=nops~(B))))
uses It= Iterator;
local p, n:= add(nops~(A));
     [seq(op~(convert(p[], list))[..n], p= It:-CartesianProduct(zip(Bijections, A, B)[]))]
end proc:

ProductOfBijections([[3,5],[6,7,9,12]], [[8,10],[1,2,4,11]]);

[[[3, 8], [5, 10], [6, 1], [7, 2], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 2], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 2], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 1], [7, 2], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 1], [7, 4], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 4], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 1], [7, 4], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 1], [7, 4], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 1], [7, 11], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 1], [7, 11], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 1], [7, 11], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 1], [7, 11], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 2], [7, 1], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 1], [9, 4], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 1], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 2], [7, 1], [9, 11], [12, 4]], [[3, 8], [5, 10], [6, 2], [7, 4], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 4], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 2], [7, 4], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 2], [7, 4], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 2], [7, 11], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 2], [7, 11], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 2], [7, 11], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 2], [7, 11], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 1], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 1], [9, 2], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 1], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 4], [7, 1], [9, 11], [12, 2]], [[3, 8], [5, 10], [6, 4], [7, 2], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 2], [9, 1], [12, 11]], [[3, 10], [5, 8], [6, 4], [7, 2], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 2], [9, 11], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 11], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 4], [7, 11], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 4], [7, 11], [9, 2], [12, 1]], [[3, 8], [5, 10], [6, 4], [7, 11], [9, 2], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 1], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 1], [9, 2], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 1], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 11], [7, 1], [9, 4], [12, 2]], [[3, 8], [5, 10], [6, 11], [7, 2], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 2], [9, 1], [12, 4]], [[3, 10], [5, 8], [6, 11], [7, 2], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 2], [9, 4], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 4], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 11], [7, 4], [9, 1], [12, 2]], [[3, 10], [5, 8], [6, 11], [7, 4], [9, 2], [12, 1]], [[3, 8], [5, 10], [6, 11], [7, 4], [9, 2], [12, 1]]]

@Thomas Dean From the strip of choices at the bottom of your Question, click on the rightmost one, More. Select Edit from the pill-down menu.

@mskalsi I don't understand it. Hopefully Edgardo Cheb-Terrab will step in here to explain what's going on.

@sikjw1305 I don't understand how to use setpartition for this purpose. Would you please show an explicit example?

There's a lot of overlap of functionality between packages Iterator and combinat with the former generally being more efficient both with time and memory. Iterator has its own version of setpartition called SetPartitionFixedSize.

@mskalsi I don't understand why this one didn't need value. Since the expression is constructed with capital-D Diff, it should require it. Maybe it has something to do with u being an unassigned symbol in your current example.

What happened with your first example? Was the value required there? If I don't use it, the result ofdchange has the derivative unevaluated. In the worksheet below, notice the subscript t outside the whole expression.


restart:

with(PDEtools):

DepVars := [F(xi), G(xi)]

[F(xi), G(xi)]

alias(F = F(xi), G = G(eta))

F, G

declare(F, G(xi))

F(xi)*`will now be displayed as`*F

G(xi)*`will now be displayed as`*G

u := a[0]+(F*a[1]+G*a[2]+kappa[1])/(mu[0]+mu[1]*(diff(F, xi))+mu[2]*(diff(G, eta)))+(F^2*a[3]+F*G*a[4]+G^2*a[5]+kappa[2])/(mu[0]+mu[1]*(diff(F, xi))+mu[2]*(diff(G, eta)))^2

a[0]+(a[1]*F+a[2]*G+kappa[1])/(mu[0]+mu[1]*(diff(F, xi))+mu[2]*(diff(G, eta)))+(a[3]*F^2+a[4]*F*G+a[5]*G^2+kappa[2])/(mu[0]+mu[1]*(diff(F, xi))+mu[2]*(diff(G, eta)))^2

PDEtools:-dchange({xi= k[1]*x-k[1]*c[1]*t, eta= k[2]*x-k[2]*c[2]*t}, Diff(u,t), [x,t]);

diff(a[0]+(a[1]*F(-t*c[1]*k[1]+x*k[1])+a[2]*G(-t*c[2]*k[2]+x*k[2])+kappa[1])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))+(a[3]*F(-t*c[1]*k[1]+x*k[1])^2+a[4]*F(-t*c[1]*k[1]+x*k[1])*G(-t*c[2]*k[2]+x*k[2])+a[5]*G(-t*c[2]*k[2]+x*k[2])^2+kappa[2])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))^2, t)

value(%);

(-a[1]*(D(F))(-t*c[1]*k[1]+x*k[1])*c[1]*k[1]-a[2]*(D(G))(-t*c[2]*k[2]+x*k[2])*c[2]*k[2])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))-(a[1]*F(-t*c[1]*k[1]+x*k[1])+a[2]*G(-t*c[2]*k[2]+x*k[2])+kappa[1])*(-mu[1]*((D@@2)(F))(-t*c[1]*k[1]+x*k[1])*c[1]*k[1]-mu[2]*((D@@2)(G))(-t*c[2]*k[2]+x*k[2])*c[2]*k[2])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))^2+(-2*a[3]*F(-t*c[1]*k[1]+x*k[1])*(D(F))(-t*c[1]*k[1]+x*k[1])*c[1]*k[1]-a[4]*(D(F))(-t*c[1]*k[1]+x*k[1])*c[1]*k[1]*G(-t*c[2]*k[2]+x*k[2])-a[4]*F(-t*c[1]*k[1]+x*k[1])*(D(G))(-t*c[2]*k[2]+x*k[2])*c[2]*k[2]-2*a[5]*G(-t*c[2]*k[2]+x*k[2])*(D(G))(-t*c[2]*k[2]+x*k[2])*c[2]*k[2])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))^2-2*(a[3]*F(-t*c[1]*k[1]+x*k[1])^2+a[4]*F(-t*c[1]*k[1]+x*k[1])*G(-t*c[2]*k[2]+x*k[2])+a[5]*G(-t*c[2]*k[2]+x*k[2])^2+kappa[2])*(-mu[1]*((D@@2)(F))(-t*c[1]*k[1]+x*k[1])*c[1]*k[1]-mu[2]*((D@@2)(G))(-t*c[2]*k[2]+x*k[2])*c[2]*k[2])/(mu[0]+mu[1]*(D(F))(-t*c[1]*k[1]+x*k[1])+mu[2]*(D(G))(-t*c[2]*k[2]+x*k[2]))^3

 


Download [1063]_Sub-equation_Method.mw

 

@one man Did you make the GIF file with Maple, or did you use some external utility to compress it?

First 416 417 418 419 420 421 422 Last Page 418 of 709