pagan

5147 Reputation

23 Badges

17 years, 130 days

 

 

"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway

 

MaplePrimes Activity


These are replies submitted by pagan

And, for fun,

> op(3/4);
                                     3, 4

> map(f, 3/4);
                                    f(3/4)

How about an alternative way. Where instead of making the "action" an aspect of the Plot component, you make it an additonal aspect of the Sliders.

So, run the Explore on your expression in your original worksheet just as before, and get the new worksheet window. Then insert a new Plot0 component in your new worksheet window. Now, don't place any action-when-clicked on Plot0 at all. Instead, edit the "Action When Value Changes" properties of either one or both of the Slider components.

For example, for the first Slider (controlling values of 'a'), change its Action When Value Changes from this,

update(_Explore_expr,false);

to instead be this,

update(_Explore_expr,false);
DocumentTools:-SetProperty('Plot0','value',
  plot(eval(a*x^2-(b+a)*x+b,
            [a=DocumentTools:-GetProperty('Slider1','value'),
             b=DocumentTools:-GetProperty('Slider2','value')]),
             x=-2..2));

After doing the above, then my Plot0 component automatically updates with every movement of that 'a' Slider. And the MathContainder component also updates with the new formula.

It seems also possible to replace the formula a*x^2-(b+a)*x+b above with simply _Explore_expr so that the formula doesn't need to be typed or pasted in by you.

Of course, you probably already realize that if you only want to explore a plot then you could do just this from your original worksheet.

Explore(plot(a*x^2-(b+a)*x+b,x=-2..2));

How about an alternative way. Where instead of making the "action" an aspect of the Plot component, you make it an additonal aspect of the Sliders.

So, run the Explore on your expression in your original worksheet just as before, and get the new worksheet window. Then insert a new Plot0 component in your new worksheet window. Now, don't place any action-when-clicked on Plot0 at all. Instead, edit the "Action When Value Changes" properties of either one or both of the Slider components.

For example, for the first Slider (controlling values of 'a'), change its Action When Value Changes from this,

update(_Explore_expr,false);

to instead be this,

update(_Explore_expr,false);
DocumentTools:-SetProperty('Plot0','value',
  plot(eval(a*x^2-(b+a)*x+b,
            [a=DocumentTools:-GetProperty('Slider1','value'),
             b=DocumentTools:-GetProperty('Slider2','value')]),
             x=-2..2));

After doing the above, then my Plot0 component automatically updates with every movement of that 'a' Slider. And the MathContainder component also updates with the new formula.

It seems also possible to replace the formula a*x^2-(b+a)*x+b above with simply _Explore_expr so that the formula doesn't need to be typed or pasted in by you.

Of course, you probably already realize that if you only want to explore a plot then you could do just this from your original worksheet.

Explore(plot(a*x^2-(b+a)*x+b,x=-2..2));

Did you create the first (successful) plot in that Plot0 component? If so, then after doing so you should see usual plot context-menu items for it.

Did you create the first (successful) plot in that Plot0 component? If so, then after doing so you should see usual plot context-menu items for it.

In a sense, the OP was lucky that no results were obtained, since that led to making enquiries. The much trickier scenario is one in which 1D and 2D produce very different results, without a failure to compute or an error message.

Consider the following, all entered using 2D Math input.

> (D(sin))(x), (D(sin))(Pi)
                                 cos(x), -1
> (D (sin))(x), (D (sin))(Pi)
                               D(x) sin(x), 0

In 1D notation, both lines would produce the first result. Now, imagine that someone sees the second input above inside some 1D program found on a webpage, and then enters that by typing directly (or via cut and paste) into Maple where the default is 2D Math input mode...

In a sense, the OP was lucky that no results were obtained, since that led to making enquiries. The much trickier scenario is one in which 1D and 2D produce very different results, without a failure to compute or an error message.

Consider the following, all entered using 2D Math input.

> (D(sin))(x), (D(sin))(Pi)
                                 cos(x), -1
> (D (sin))(x), (D (sin))(Pi)
                               D(x) sin(x), 0

In 1D notation, both lines would produce the first result. Now, imagine that someone sees the second input above inside some 1D program found on a webpage, and then enters that by typing directly (or via cut and paste) into Maple where the default is 2D Math input mode...

One problem is that the Original Poster's first line of code,

  with (VectorCalculus):

works in 1D Maple notation but does not work in 2D Math input.

That's why his subsequent individual VectorCalculus command calls returned as unevaluated function calls, because `with` had not been invoked.

That led to a further failure cascade. If VectorCalculus had actually been loaded, then the Vector*[...] would have been seen as invalid input to the later calls and an explanatory error message issued.

One problem is that the Original Poster's first line of code,

  with (VectorCalculus):

works in 1D Maple notation but does not work in 2D Math input.

That's why his subsequent individual VectorCalculus command calls returned as unevaluated function calls, because `with` had not been invoked.

That led to a further failure cascade. If VectorCalculus had actually been loaded, then the Vector*[...] would have been seen as invalid input to the later calls and an explanatory error message issued.

That general result appears to be wrong, when _Z2 is taken to be exact 0.

> sol:=solve(-ln(1-x)/x-x+2 = 0,x, AllSolutions);
              sol := -exp(-1/2 LambertW(_Z2~, 2 exp(2)) + 1) + 1

> limit( -ln(1-x)/x-x+2, x=eval(sol,op(indets(sol,name))=0) );
                                       3

That validity restriction on _Z2 is not one of its assumptions.

> about( op(indets(sol,name)) );
Originally _Z2, renamed _Z2~:
  is assumed to be: integer

There may not be a purely real solution.

There may be a complex-valued solution.

> restart:
> eq:=(-1/x)*ln(1-x)-x+2:
> solve(eq); # rubbish
                                       0

> limit(eq,x=%);
                                       3

> ceq:=subs(x=a+b*I,eq):

> interface(warnlevel=0):
> sol:=eval(a+b*I,Optimization:-Minimize(abs(ceq),
>     optimalitytolerance=10^trunc(-Digits/2),method=nonlinearsimplex)[2]);
                 sol := 2.23692628510754 + 0.995885874551822 I

> abs(eval(eq,x=sol)): evalf[10](%); abs(limit(eq,x=sol)): evalf[10](%);
                             0.000278490752645480

                             0.000278490783381592

> Digits:=50:
> sol:=eval(a+b*I,Optimization:-Minimize(abs(ceq),
>     optimalitytolerance=10^trunc(-Digits/2),method=nonlinearsimplex)[2]):
> abs(eval(eq,x=sol)): evalf[10](%); abs(limit(eq,x=sol)): evalf[10](%);
                                             -10
                              0.1023322408 10

                                             -10
                              0.1023322408 10

> Digits:=100:
> sol:=eval(a+b*I,Optimization:-Minimize(abs(ceq),
>     optimalitytolerance=10^trunc(-Digits/2),method=nonlinearsimplex)[2]):
memory used=539.1MB, alloc=20.3MB, time=15.24
> abs(eval(eq,x=sol)): evalf[10](%); abs(limit(eq,x=sol)): evalf[10](%);
                                             -21
                              0.4471271577 10

                                             -21
                              0.4471271577 10

The older, basic command-completion works in both 2D and 1D modes. By that I mean offering completion only of the partially typed command name.The new calling sequence templates are specific to 2D input mode.

It also works in the commandline (non-GUI) interface, in the basic fashion.

The older, basic command-completion works in both 2D and 1D modes. By that I mean offering completion only of the partially typed command name.The new calling sequence templates are specific to 2D input mode.

It also works in the commandline (non-GUI) interface, in the basic fashion.

You can cut down on the spelling mistakes at input time by using the command-completion facility.

You can cut down on the spelling mistakes at input time by using the command-completion facility.

First 59 60 61 62 63 64 65 Last Page 61 of 81