acer

30934 Reputation

29 Badges

19 years, 45 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@C_R How is the second approach the best? The first is much faster and simpler, and completely avoids the float-roundoff (Pi) edge idiosyncrasy & need for higher grid values.

Cannot the individual portions all be exported to STL just as easily as the conjoined result from the second approach? I would expect that they can (even if done separately).

@C_R The first approach seems better all round. Why would you use the second approach?

The two kinds of gap can be reduced by increasing the corresponding grid option values.

You may be able to get by there with NULL instead of undefined (I had other variants where it had an effect). The key bit is adaptmesh=false.

But the first way is so much simpler, and faster and lightweight, that I don't understand any preference for using the second.

While it's not nearly as fast and simple as the above, the original methodology can be hammered into something that omits those conjoining artefacts.
1) Using adaptmesh=false to prevent plot3d from trying extra hard to stitch together pieces adjacent in the data structure.
2) split by undefined rather than NULL
3) increase the grid resolution.

restart;

rmod:= (t,n)->(round@((x->x)-floor))(n*t):

f:=(t,p)-> ifelse(is(rmod(t,4/(2*Pi))+rmod(p,4/(2*Pi))=1),1,NULL):

p1:=plot3d(f,0..2*Pi,0..Pi,coords=spherical,scaling=constrained,
           color="black",grid=[200,200],style=surface,adaptmesh=false):

p2:=plots:-sphereplot(0.999,theta=0..2*Pi,phi=0..Pi,color=white,style=surface):

plots:-display(p1,p2);


Download Chessboard_sphere_ac2.mw

Maple automatically transforms 1/2^(1/4) and 2^(-1/4) into 1/2*2^(3/4) .

That happens as a result of what's called automatic simplification, and cannot be avoid just by unevaluation. That is, it'd also happen for '1/2^(1/4)', ie. wrapped in single right-quotes (aka uneval quotes).

It should be possible programatically to turn it into an inert form and have that be displayed without the automatic simplification. Then you could get the output rendered as follows (or with 2^(-1/4) in the numerator):

restart;

with(InertForm):

'1/2^(1/4)';

(1/2)*2^(3/4)

'2^(-1/4)';

(1/2)*2^(3/4)

foo := something / 2 %^ (1/4):

value(foo);

(1/2)*something*2^(3/4)

Display(foo,'inert'=false);

something/Typesetting:-_Hold([`%^`(2, 1/4)])


Download inert_p_ex.mw

ps. Are you also wanting to simplify wrt that B^2 inside the square-root? Is B real?
Also, you have a term like e^(i*psi(x,t)), so is that deliberate that you don't use I and exp?

@salim-barzani Right the simplify command will not produce the results you want in Maple 2021.

That's why I showed you how it might be done using applyrule.

Is it the performance of the Maple GUI which is slow, or computation of results that is slow (even when run in both systems with all display of output results suppressed, etc)?

If it's the computation, then what computation?

@salim-barzani I've already showed you (above) that your given examples can be handled automatically by Maple 2024 by just the simplify command.

Such simplifications can also usually be restricted (eg. simplify(...,trig), etc) so that they don't alter other type of term.

You ask whether all your other Maple 2021 code (which you don't provide here) will run the ok in Maple 2024. It's likely that it will. But nobody can make such a prediction with 100% guarantee, without seeing the code.

Please put your followup examples on this here, instead of in wholly separate new Question threads,

@Ronan I added a response to your earlier Question thread on rotated text in a 2D plot.

@erik10 A terser variant on that is something like,

  Circle1 := ifelse(CircleOrNot="yes", circle(...), NULL);

or, when CircleOrNot is definitely assigned one of true or false,

  Circle1 := ifelse(CircleOrNot, circle(...), NULL);

@adam25185 Could you please upload and attach your full worksheet file, using the green up-arrow in the Mapleprimes editor?

@salim-barzani You're very welcome.

Please note that I put a line,

   indets(F, function)

into the sheet. That sort of thing can be useful, as a kind of check. In the original, it showed the long expressions that were just function calls of l and m.

You can also do it as,

   lprint(indets(F, function))

and get its result line-printed as 1-D code, if that helps diagnosis.

Please put your close followup queries here (or use the Branch button), rather than spawning another wholly separate Question thread for this.

You had a followup in which pointplot complained about non-numeric entries.
  Bifurcation_MaplePrimes_Oct_17.mw
The problem there is that not all the used entries of A (and L2) have (real,finite) numeric value as second element. Some have Float(infinity)+Float(infinity)*I, which your Maple 2018's pointplot doesn't like. Leaving the rest of your method the same, one possible adjustment is to replace non-numeric values by undefined as they occur.
  Bifurcation_MaplePrimes_Oct_17_ac.mw

ps. Another way to deal with such might be pare the final L2, right before calling pointplot. I didn't check which might be better, or add any bailout efficiencies. One you have it all working you might want to focus on its performance, and have it run under evalhf.

@WA573 I didn't at first understand that you were now wanting to deal with just this "new" example, and not the original example.

You can simply pass the explicit option to solve, to avoid any RootOf here.

Below I also show that you can verify the elements of those explicit solutions, after backsubstituting. (This simplification incantation is for this problem, not for all problems.)

restart

s := 32*exp(-3*t)*(delta1-delta2)*((delta1^2-5*delta1*delta2+(7/4)*delta2^2)*exp((4*I)*exp(-t)*((-(1/2)*delta1^2+delta2^2)*exp(-t)+x*(delta1-2*delta2)))-3*exp(-(2*I)*exp(-t)*(2*exp(-t)*delta1^2-3*exp(-t)*delta2^2-4*delta1*x+6*delta2*x))*delta1^2*(1/4)+((7/4)*delta1^2-5*delta1*delta2+delta2^2)*exp(-(4*I)*delta2*(-(1/2)*exp(-t)*delta2+x)*exp(-t))-3*exp(-(4*I)*delta1*(-(1/2)*exp(-t)*delta1+x)*exp(-t))*delta2^2*(1/4))/((exp(-(2*I)*exp(-t)*(delta1-delta2)*(exp(-t)*delta2+exp(-t)*delta1-2*x))+1)^3*(exp((2*I)*exp(-t)*(delta1-delta2)*(exp(-t)*delta2+exp(-t)*delta1-2*x))+1))

s1 := simplify(subs({delta1 = (1/2)*delta2}, s))

exp(-3*t)*delta2^3*(8*exp(((1/2)*I)*exp(-t)*delta2*(7*exp(-t)*delta2-12*x))+3*exp(-(8*I)*delta2*exp(-t)*(-(5/8)*exp(-t)*delta2+x))+17*exp(-(4*I)*delta2*(-(1/2)*exp(-t)*delta2+x)*exp(-t))+12*exp(-(2*I)*delta2*(-(1/4)*exp(-t)*delta2+x)*exp(-t)))/((exp(-(2*I)*delta2*(-(3/4)*exp(-t)*delta2+x)*exp(-t))+1)^3*(exp((2*I)*delta2*(-(3/4)*exp(-t)*delta2+x)*exp(-t))+1))


Now, using the explicit option to the solve command
G := solve({numer(s1) = 0, denom(s1) <> 0}, [delta2], explicit)

[[delta2 = 0], [delta2 = ((2/3)*x+(1/3)*(4*x^2-(6*I)*ln(-5/6+((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x-(1/3)*(4*x^2-(6*I)*ln(-5/6+((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x+(1/3)*(4*x^2-(6*I)*ln(-5/6-((1/6)*I)*119^(1/2)))^(1/2))*exp(t)], [delta2 = ((2/3)*x-(1/3)*(4*x^2-(6*I)*ln(-5/6-((1/6)*I)*119^(1/2)))^(1/2))*exp(t)]]

seq(simplify(expand(eval(s1, GG))), GG = G)

0, 0, 0, 0, 0

NULL

Download ss_root_ac.mw


ps. The solve+allvalues approach given by mmcdara seems unnecessarily complicated, given that the introduction of RootOf can be avoided here.

I was only unsure whether you were still talking about this Question thread's original example, or just your issues with the followup example.

@WA573 It's not clear what you're now asking.

1 2 3 4 5 6 7 Last Page 3 of 568