acer

32747 Reputation

29 Badges

20 years, 110 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

Another command that you could experiment with is collect. Reading its help page is worthwhile.

@dgh So it's a Bad Idea to have both c and c[1],etc, in the same expression.

I change unindexed c to cc at the start. I inserted a multiplication symbol in the definition of EI.

I also evaluated sqrt(RRn/RRd) at the results from solving for c[0],..,c[3].

Check that it's what you intended.

Try not suppressing all output with full colons, as it's hidden clues from you (like the very presence of the indexed lam[i].)
 

restart

w := c[0]+c[1]*x+c[2]*exp(cc*x)+c[3]*exp(-cc*x)+c[4]*x^n:

dw := simplify(diff(w, x))

c[1]+c[2]*cc*exp(cc*x)-c[3]*cc*exp(-cc*x)+c[4]*x^(n-1)*n

ddw := simplify(diff(w, x, x))

c[2]*cc^2*exp(cc*x)+c[3]*cc^2*exp(-cc*x)+c[4]*x^(n-2)*n^2-c[4]*x^(n-2)*n

dddw := simplify(diff(w, x, x, x))

c[2]*cc^3*exp(cc*x)-c[3]*cc^3*exp(-cc*x)+c[4]*x^(n-3)*n^3-3*c[4]*x^(n-3)*n^2+2*c[4]*x^(n-3)*n

m := -alpha*x+1:

EI := -x^4*beta[4]-x^3*beta[3]-x^2*beta[2]-x*beta[1]+1:

T := lam^2*(int(m*(R+x), x = x .. L))/L^4+F

lam^2*(-(1/3)*alpha*(L^3-x^3)+(1/2)*(-R*alpha+1)*(L^2-x^2)+R*(L-x))/L^4+F

n := 4

4

RRn := `assuming`([simplify(int(EI*ddw^2, x = 0 .. L)+int(T*dw^2, x = 0 .. L))], [L > 0]):

RRd := `assuming`([simplify(int(m*w^2, x = 0 .. L))], [L > 0]):

NULL

alpha := 0:

Eq1 := subs(x = 0, w = 0):

Eq2 := subs(x = 0, dw = 0):

Eq3 := subs(x = L, ddw = 0):

Eq4 := subs(x = L, dddw = 0):

S := solve({Eq1, Eq2, Eq3, Eq4}, {c[0], c[1], c[2], c[3]}):

cc := `assuming`([simplify(subs(x = 0, sqrt(T/EI)))], [lam > 0])

(1/2)*lam*2^(1/2)

new := eval(sqrt(RRn/RRd), S):

RQ := evalf(subs(lam = 1, new))

3.700371506

NULL


Download Uniform_Beam_1.mw

 

@dgh Your attempt to substitute lam=1 will not make all of lam[0], lam[1],...,lam[4] take on values of 1. That's just not how it works.

Try this:

evalf(subs(lam=1,eval(RRn/RRd,{lam[0],lam[1],lam[2],lam[3],lam[4]}=~1)));

Also, it's a Bad Idea to use both a name like lam and indexed names like lam[0], lam[4] in the same expression.

@dgh When you are composing your Reply you should see a green up-arrow in the Mapleprimes editor. Use it to upload your worksheet (and insert a link to that).

@mapleatha You write, "For the last time, I have never used the cat command anywhere."

But the red input Maple code in this very Question, submitted by you, is:

The call to the cat command appears twice in that code, posted here by you. It's use is the central issue in your Question.

You are wrong also about what you claimed the || means in the output in your Question.

@mapleatha You wrote, "|| || is a symbol for a norm on a normed space. It has no business
in what I am doing for my DE classes. It appeared when I asked up here: `Why is this happenning in Maple?'"

In the Maple language || is a command that can be used as an infix concatenation operator. That's how it appears in the results in your Question's output above. (The example in your Question shows version specific behavior, related to how mixes of names and rationals were treated by the cat command.)

The || appearances in the output in your Question have nothing to do with norms.

 

@mapleatha You wrote in a Comment above, "I have never used the cat command anywhere." But in fact you used the cat command in the code in this very Question!

In your other, earlier Question you also had a rational value. I asked in my Answer there whether you needed that to be typeset (pretty-printed) in 2-D Math, rather than like "1/2" in 1-D text. You didn't confirm there. And now here you suddenly say that aspect is key.

It's not helpful if you don't give a complete description of what your trying to accomplish, at the start.

I'm not trying to berate you. It's a very common  situation on Mapleprimes. People ask about a technical difficulty in an approach they've decided is good for some goal, without telling us all the requirements. Then there's a big circus as we try and dig down to get the true requirements out of them, so that we could suggest a quite different but better overall approach.

This current Question has turned out to be simply a duplicate of another two Questions asked by you, asked close together. Please don't submit three duplicates like that because it splits the value, confuses readers, and separates detail unnecessarily. Please just ask followups details/comments/subcases to Replies/Comments on the original.

You have deleted a comment to which I had responded above. Now my response looks out of context. Please don't remove comments. (I'm trying to ask nicely. Some others here take that kind of thing very personally..)

[The Original Poster made an earlier Comment/Reply, to which I am responding below. The OP has since deleted that Comment, which makes the following look out of place and senseless.]

@mapleatha You claimed that I suggested you use printf, amongst other things. I have not once suggested that you use printf.

I know that you want normally printed output, centred with default blue.

The nprintf command works just like the printf command, the difference being that printf immediately line-prints (gray, left-aligned) while nprintf returns an actual name.

The name constructed by nprintf can be printed just like anything else, centred and in blue. 

So the result from nprintf will work just like your results from cat (when successful).

The result from nprintf can be assigned to a variable, just like the result from cat. The result from nprintf can be used with the actual `print` command, just like you can with the result from the cat command.

But nprintf is easier to use than cat, especially in your situation that not all the blobs are already names, and when there's lots of punctuation to stick in.

So go back and look at Rouben's Answer to your earlier Question, which used printf. But just change the command to nprintf.

That will give an easier way than using the cat command. And results will print in blue, centered.

 

@Christopher2222 In general (outside this context of using the `convert` command) symbol and name cannot be used interchangeably.

For example not everything of type name is of type symbol.

I don't understand why you would make such a potentially confusing and generally untrue statement in a clause that reads ambiguously (and could be easily interpreted as a general claim).

I messed around with code (originally from someone I know) to do that in Maple, about 5-8 years ago. It did wireframe 3-D plots, and relied on having those 3-D cinema glasses that filtered the two colors. The hard part to using that would be to find the worksheet...

But if I recall it was not very involved code. I'm sure several people here could implement the basic idea quite quickly.

@wilk007 That functionality to embed and automatically start playing relies on use of a PlotComponent, which only supports a pair of integers (pixel counts), and not the "golden" ratio.

A simple adjustment of the code allows the integer dimensions to be passed in.

I'll approximate using the golden ratio by obtaining the height as a suitable multiple of the width.

restart;

wave := (x,t) -> 12*(3+4*cosh(2*x-8*t)+cosh(4*x-64*t))/(3*cosh(x-28*t)+cosh(3*x-36*t))^2:

autoplay := proc( anim, {continuous::truefalse:=false},
                        {size::[posint,posint]:=[400,400]} )
  local P, T;
  uses DocumentTools, DocumentTools:-Layout,
       DocumentTools:-Components;
  P := Plot(':-identity' = "Plot0", anim,
            ':-continuous'=continuous,
            'pixelwidth'=size[1], 'pixelheight'=size[2]);
  T:=InsertContent(Worksheet(Group(Input(Textfield(P)))),
                   ':-output'=':-table');
  DocumentTools:-SetProperty(T["Plot0"],':-play',true);
  NULL:
end proc:

aniplot := plots:-animate( plot,[wave(x,t),x=-20..20],t=-1..1,frames=45,thickness=3 ):

autoplay( aniplot, size=[1500, floor(1500*0.61)] );

I wrote a fancier version of the "autoplay" procedure above. It came up recently in another thread. I'll try and find the link for you.

NB. Several of your Mapleprimes posts contain images (pictures) of code. Nobody enjoys having to retype stuff out. Please use the green up-arrow in the editor to upload worksheet attachments, or inline your complete code as plaintext, moving forwards. Thanks.

@mapleatha You can simply change the printf to nprintf in Rouben's suggestion.

The result would then be a name, similar to the concatenation you asked about your related Question. And it would then print in the usual way (centered, and in blue or according to the style).

The mimicing of a sentence by multiplication is somewhat dubious and awkward, in comparison. If you don't need 2D pretty-printing of any portions then using nprintf is so much more straightforward.

Using Maple 2017 for 64bit Linux I get a smoothly rendered curve for this example, displayed inline in the Standard GUI, simply by removing the high numpoints option.

More particularly, for this example I get a jagged display for the inlined plot display if the value for the numpoints option is 2000 or greater, and a much smoother curve if numpoints is less than 2000 (or absent).

 

@_Maxim_ 

Loss of detail occurs due to scaling (and possibly by encoding which involves GUI-side conversion to PNG).

In the attachment below those details are still quite clear, by Preview2D without altering the size.

As mentioned, a benefit is that the point-probe manipulator can be used. Other benefits include the fact that it is regular output like a plot and so doesn't have the Embed restriction of one result per execution-group (which affects all programmaticly embedded component assemblies). Also, the GUI can be slower to render image backgroups on 2-D plots. I agree, if those benefits aren't needed then Embed serves better.

[edit] By supplying the extra option axes=none the Preview2D result can be a closer match to the image size, since the axes and tickmarks don't contributes to the sizing bookkeeping. But the point-probe details can still be enabled and accessed. (See new attachment) Perhaps a better default would be with axes=none.

2dpreview3.mw

@vv Nice example.

Testzero:=u->evalb(radnormal(expand(convert(u,exp)))=0):

Testzero( sin((3/7)*Pi)-sin((1/7)*Pi)+sin((2/7)*Pi)-sqrt(7)/2 );

                           true

That Testzero handles the original Matrix M. I hope nobody interprets this as meaning that I think finding a strong-enough but fast-enough zero detection mechanism is easy or even always possible.

[edited] Also, getting an effective Testzero won't help with expression swell and obtaining results that are unwieldy. So obtaining a Normalizer that handles the swell usefully while not taking a great deal of time can also be important. I realize that most of the participants in this thread are aware of the difficulties.

First 275 276 277 278 279 280 281 Last Page 277 of 600