acer

32373 Reputation

29 Badges

19 years, 334 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

For example, calling R() once produced this image. It produces a different result each time it gets called.

 

acer

For example, calling R() once produced this image. It produces a different result each time it gets called.

acer

@Markiyan Hirnyk Sure, and I'm not disagreeing with your answer, which does the job asked. But the requested task seems a bit flaky, if generalized in some ways.

Suppose that you had something with units m^3 added to something with units cm^2. You could not make that unit-free, it would make no sense. It cannot be made unit-free without knowing which variable is supposed to represent a unit that makes the dimensions compatible. And since the units of length vary in scale then it would not be valid to just eradicate them without rescaling.

If everything has the very same units (eg. m^3*s, or whatever) then you could simply evaluate with Units:-Unit=1.

acer

@Christopher2222 It might be possible to unprotect and overwrite routines in the Typesetting package in order to have typed 2D Math input be displayed (or even parsed?!) differently. But one might want some Button, coded to restore the original, or else doing anything else in the session could be problematic.

@Christopher2222 It might be possible to unprotect and overwrite routines in the Typesetting package in order to have typed 2D Math input be displayed (or even parsed?!) differently. But one might want some Button, coded to restore the original, or else doing anything else in the session could be problematic.

@Christopher2222 That's the earlier post I had in mind, thanks.

@Christopher2222 That's the earlier post I had in mind, thanks.

The warning is just there to let you know that you forgot to declare p1 as a local inside the procedure `myplot`. The original post, which you cited, did not make that omission.

acer

@Christopher2222 I think I see. So you don't want to programmatically insert any new embedded component, which is how I interpreted your question. You want to type into an existing component and have it update (by running some custom code) as you type.

As far as I know the Action When Changed code behind components currently on gets executed when the focus is changed to elsewhere.

And I seem to recall previous related queries which could not be done even by some Thread (Threads package) in the "background" because the GUI did not allow asynchronous updating of that sort. I could be wrong about this.

That's about all I can think of, for mechanisms that might actively watch the value of a Text/Math component and process and replace it in such a dynamic manner.

@Christopher2222 I think I see. So you don't want to programmatically insert any new embedded component, which is how I interpreted your question. You want to type into an existing component and have it update (by running some custom code) as you type.

As far as I know the Action When Changed code behind components currently on gets executed when the focus is changed to elsewhere.

And I seem to recall previous related queries which could not be done even by some Thread (Threads package) in the "background" because the GUI did not allow asynchronous updating of that sort. I could be wrong about this.

That's about all I can think of, for mechanisms that might actively watch the value of a Text/Math component and process and replace it in such a dynamic manner.

@erdem You might consider calling the EigenConditionNumbers command at default working precision (Digits=10 say), with options supplied to make it return both  estimated eigenvalues and condition numbers. Then you might test the estimated condition numbers, to try and gauge whether you need to rerun under higher working precision.

You might call that command and supply the option 'balance=scale', to help keep the condition numbers smaller. (See here.)

Let me know if you need code to estimate bounds on the eigenvalues' errors, as a function of condition numbers and working precision. Or see here and here.

But most importantly, you should follow Carl's advice below and ensure that the eigen-solving is done as a floating-point computation and not as an exact one. You can do that by either forming the Matrices with datatype=float or by wrapping each Matrix in a call to `evalf` before passing to the LinearAlgebra command.

Christopher, you wrote,

    sqrt(a)/a is in fact simplified to 1/sqrt(a)

and there it does seem that you mean unassigned symbolic `a` there. But what is actually happening under that call to the `simplify` command is that symbolic a^(1/2)/a becomes 1/a^(1/2). Just for the sake of clarity.

Another somewhat related inconsistency is the following distinction, which can sometimes be awkward (such as when trying to do matching),

A := 1/x^(p);

                               1 
                               --
                                p
                               x 

dismantle(A);

PROD(3)
   POWER(3)
      NAME(4): x
      NAME(4): p
   INTNEG(2): -1


B := x^(-p);

                              (-p)
                             x    

dismantle(B);

POWER(3)
   NAME(4): x
   SUM(3)
      NAME(4): p
      INTNEG(2): -1

Here, the powers of symbolic `p` involved in A-B do not combine unless we issue a subsequent command to force it. Also, the value of `A` becomes that of `B` under a call to `simplify` or `combine` but not under a call to `normal` or `expand`. And the value of `B` becomes that of `A` under `expand` but not under `normal`, `simplify`, or `combine`. And A/B and B/A do not become 1 under `normal`, but they do under `simplify`, `combine`, and `expand`. I expect that some of this might confuse new users.

acer

Please read my response again. I wrote a power of 1/2, not a call to sqrt.

You can enter '1/2^(1/2)' to check that. It autosimplifies to 2^(1/2)/2.

I interpreted Christopher's comments as being about power 1/2 values, and I can understand that some others in your audience (and possibly the OP) might not be fully aware of the distinctions. The fact that they prettyprint the same as 2D output doesn't help for general understanding.

Unprotecting and redefining `^` is of course possible, just as is producing some other mechanism that merely prints like power 1/2. But each of those will be quite some other object, and not the same as 2^(1/2)/2 in value, which I suppose should be made clear to the audience.

It might be nice if a solution which satisfies Christopher here would also allow for simplification (`simplify` or `radnormal`) on 6^(1/2)/3^(1/2) or its reciprocal say.

I doubt that the return result from (un-redefined, global) 1/sqrt(2), which indeed is 2^(1/2)/2, can be easily (if at all) prevented from autosimplifying. Changing how that value prints, or creating quite another value, is not the same thing.

I'm not saying that your solution might not satisfy Christopher. (You might want to demonstrate its use, though.) His original question was somewhat ambiguous, given that unevaluated 'sqrt(7)' is not what the call sqrt(7) returns. But I wasn't making a claim about autosimplification of '1/sqrt(7)', I was making it about '1/7^(1/2)'.

acer

Please read my response again. I wrote a power of 1/2, not a call to sqrt.

You can enter '1/2^(1/2)' to check that. It autosimplifies to 2^(1/2)/2.

I interpreted Christopher's comments as being about power 1/2 values, and I can understand that some others in your audience (and possibly the OP) might not be fully aware of the distinctions. The fact that they prettyprint the same as 2D output doesn't help for general understanding.

Unprotecting and redefining `^` is of course possible, just as is producing some other mechanism that merely prints like power 1/2. But each of those will be quite some other object, and not the same as 2^(1/2)/2 in value, which I suppose should be made clear to the audience.

It might be nice if a solution which satisfies Christopher here would also allow for simplification (`simplify` or `radnormal`) on 6^(1/2)/3^(1/2) or its reciprocal say.

I doubt that the return result from (un-redefined, global) 1/sqrt(2), which indeed is 2^(1/2)/2, can be easily (if at all) prevented from autosimplifying. Changing how that value prints, or creating quite another value, is not the same thing.

I'm not saying that your solution might not satisfy Christopher. (You might want to demonstrate its use, though.) His original question was somewhat ambiguous, given that unevaluated 'sqrt(7)' is not what the call sqrt(7) returns. But I wasn't making a claim about autosimplification of '1/sqrt(7)', I was making it about '1/7^(1/2)'.

acer

First 375 376 377 378 379 380 381 Last Page 377 of 592