acer

32722 Reputation

29 Badges

20 years, 86 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@taro Thanks for your comments. I know what there is to know about Worksheets vs Documents and Execution Groups vs Document Blocks, both in terms of what's available with the mouse & menus as well as what might be accomplished acting on the XML source of the file. I believe that know how to take programatically a pair of Exec Groups in a Doc Block and merge the Input of the former with the Output of the latter (they are linked by a target-redirect "Label" in the saved XML) into just one single Exce Group. I also believe that I know how to turn programatically an Exec Group with 2D Input into one with a prompt and 1D Maple Notation input. And I'm considering code to sweep through a Worksheet or Document file and do all the above, keeping Text and Components and Sections untouched. I'll have to see how that goes. 

Others have informed member nm about how to set Preferences, to use 1D Maple Notation instead of 2D Math, Worksheets instead of Documents, etc. But that's not what he asked.

He asked how to take a particular worksheet with many Execution Groups containing 2D Input and change it into one with those as 1D Maple Notation input.

He knows how to change each one by hand (context menu), but he wants an easy way to do them all at once. Since the main menubar's offerings convert Text pieces when attempting such a sweep I suggested that it might be done with custom code.

@Markiyan Hirnyk Your wrote,

x = 1.7218665298804079765305637769036280861977865585731

when you should have used,

x = -1.7218665298804079765305637769036280861977865585731

@Markiyan Hirnyk The point you were arguing with me about was whether there are solutions other than with x=y. Your last worksheet numerically_with_inserted_MS.mw contains `Eqn1` and `Eqn2` for which my earlier method showing a root with x<>y succeeds.

Somesol := fsolve(eval([Eqn1, Eqn2], y = 2*x), {x = -6 .. 0, z = 0 .. 6});

              {x = -1.721866530, z = 2.191157882}

eval([Eqn1, Eqn2], `union`(Somesol, {y = eval(2*x, Somesol)}));

                    [       -10         -9]
                    [-1.0 10   , -1.5 10  ]

What I wrote was true.

If the strange things in the OP's code are function applications then it is crazy that he didn't just use the much, much shorter form with function calls. It seem very likely that function calls were not intended.

Using multiplication instead of function calls (two instances were problematic) then there are curves where Eqn1 and Eqn2 are both zero, but for which x<>y. You can see them, in your last worksheet, using this command,

plots:-implicitplot3d([Eqn1, Eqn2], x = -6 .. 0, y = -6 .. 0, z = 0 .. 6,
                      color = [red, blue], grid = [20, 20, 20], style = patchcontour);

@Markiyan Hirnyk The thing you have used as `eqn2` in your Document numerically.mw is not what you think it is.

The thing that you have used as `eqn2` will evaluate as numeric values of x,y,z the same as this:

pseudo_eqn2 := -x*(2*x+2*y+2*z)/((x+y+z)^2+1)^2-x*(2*x+2*y)/((x+y)^2+1)^2+1/((x+z)^2+1)-x*(2*x+2*z)/((x+z)^2+1)^2+1/(x^2+1)-2*x^2/(x^2+1)^2+y*(2*x+2*y+2*z)/((x+y+z)^2+1)^2+y*(2*x+2*y)/((x+y)^2+1)^2-1/((y+z)^2+1)+y*(2*y+2*z)/((y+z)^2+1)^2-1/(y^2+1)+2*y^2/(y^2+1)^2;

The thing that you are using as `eqn2` contains this function call, amongst several others,

  lprint(indets(eqn2, function)[1]);

x(-(3/2)*(2*x+2*y+2*z)/(x^2+2*x*y+2*x*z+y^2+2*y*z+z^2+1)^(5/2)-(3/2)*(2*x+2*y)/(x^2+2*x*y+y^2+1)^(5/2)-(3/2)*(2*x+2*z)/(x^2+2*x*z+z^2+1)^(5/2)-3*x/(x^2+1)^(5/2))

Not that the above is function call of `x`, of the form `x(...)`. That will evaluate the same as just `x`, for all numeric values of x,y,z. If you assign the above function call `x(...)` to the name `silly` then the following results obtain in Maple,

  eval(silly, [x = 4.5, y = 9, z = 11]);

                              4.5

  eval(silly, [x = 4.5, y = 99.4, z = 57.3]);

                              4.5

  eval(silly, x = 7.3);

                              7.3

Pay attention to that last call. The expression `silly` does not depend on `y` or `z`.

The expression `silly` is a function call of the name `x`. It will evaluate the same as just `x` does, at numeric values of x,y, and z. It is not the same as, say,

x * (-(3/2)*(2*x+2*y+2*z)/(x^2+2*x*y+2*x*z+y^2+2*y*z+z^2+1)^(5/2)-(3/2)*(2*x+2*y)/(x^2+2*x*y+y^2+1)^(5/2)-(3/2)*(2*x+2*z)/(x^2+2*x*z+z^2+1)^(5/2)-3*x/(x^2+1)^(5/2));

We do not know whether the original poster intended, explicit multiplication but forgot the `*`, or implicit multiplication but forgot the space, or addition but forgot the `+`, and so on. But the fact that the original poster mentioned "2D Math" and did not appear to understand my earlier explanation of this problem is a pretty good indication that function application was not what was intended.

The user failed to upload a file, and mentioned 2D Math but posted 1D plaintext. As I mention above, why post such a long and confusing eqn2 since if function application is actually the intention then the much shorter form of `pseudo_eqn2` above is equivalent.

Digits:=50:

somesol := fsolve( eval([eqn1,eqn2], y=2*x ), {z=0..6, x=-6..0} );

      somesol := {x = -1.7218665298804079765305637769036280861977865585731, 

                  z = 2.1911578821680592163709009560887596312929138055503}

eval( [eqn1, eqn2], somesol union {y=eval(2*x,somesol)} );

                           [      -50         -49]
                           [1.8 10   , -3.3 10   ]

@Markiyan Hirnyk Try plotting the two surfaces, where the two instances of touching bracketed subexpressions like I showed are both taken as multiplications.

The red and blue curves intersect along spacecurves which are not in the x=y plane.

restart:

eqn1 := (1/8)*x/((x+y+z)^2+1)+(1/8)*x/((x+y)^2+1)+(1/8)*x/((x+z)^2+1)+(1/8)*x/(x^2+1)-(1/8)*y/((x+y+z)^2+1)-(1/8)*y/((x+y)^2+1)-(1/8)*y/((y+z)^2+1)-(1/8)*y/(y^2+1):

eqn2:=(1/((x+y+z)^2+1)-x*(2*x+2*y+2*z)/((x+y+z)^2+1)^2+1/((x+y)^2+1)-x*(2*x+2*y)/((x+y)^2+1)^2+1/((x+z)^2+1)-x*(2*x+2*z)/((x+z)^2+1)^2+1/(x^2+1)-2*x^2/(x^2+1)^2)*(-(3/2)*(2*x+2*y+2*z)/(x^2+2*x*y+2*x*z+y^2+2*y*z+z^2+1)^(5/2)-(3/2)*(2*x+2*y)/(x^2+2*x*y+y^2+1)^(5/2)-(3/2)*(2*y+2*z)/(y^2+2*y*z+z^2+1)^(5/2)-3*y/(y^2+1)^(5/2))-(1/((x+y+z)^2+1)-y*(2*x+2*y+2*z)/((x+y+z)^2+1)^2+1/((x+y)^2+1)-y*(2*x+2*y)/((x+y)^2+1)^2+1/((y+z)^2+1)-y*(2*y+2*z)/((y+z)^2+1)^2+1/(y^2+1)-2*y^2/(y^2+1)^2)*(-(3/2)*(2*x+2*y+2*z)/(x^2+2*x*y+2*x*z+y^2+2*y*z+z^2+1)^(5/2)-(3/2)*(2*x+2*y)/(x^2+2*x*y+y^2+1)^(5/2)-(3/2)*(2*x+2*z)/(x^2+2*x*z+z^2+1)^(5/2)-3*x/(x^2+1)^(5/2)):

indets(eqn2,function); # after inserting two instances of `*`.

{}

plots:-implicitplot3d( [eqn1,eqn2], x=-6..0,y=-6..0,z=0..6, color=[red,blue],
                       grid=[20,20,20], style=patchcontour, orientation=[-11,78,9] );

 


Download surfs.mw

 

@beidouxing There are a few instances of what appear to accidental function application rather than say addition or multiplication, due to missing arithmetic operations in the formula you posted as 1D Maple Notation.

For example,  (x^2+1)^2)(-(3/2)*...) is going to become a function call of (x^2+1)^2) rather than some product or sum (or whatever you intended).

Depending on how I interpret these I can see some different solutions other than just x=y.

@wolfman29 Sure.

expr := .956^2-PpRM(s, .185)-PkRM(s, .895):
fsolve( unapply( expr - 1.4, s), ... );

where you might still want to give it a hint about the domain in which to look. Hence my `...`, which you would replace.

By the way, you may not have done anything strictly speaking wrong in your original attempt. There is a case where a mix of constants and expressions containing procedures runs amok of an (over)aggressive check by fsolve. Turning the thing into an operator (unapply) makes it go another route.

@Preben Alsholm Thanks for the relevant comments.

The derivative-free method=nonlinearsimplex option to NLPSolve might also help, in some cases.

@Alejandro Jakubi It could be a serious drawback if all formatting, sectioning, Tables, and embedded components would be lost by such an action.

That's on top of how robust the .mpl export may or may not be. (What does it dig into, or not).

 

@Axel Vogt I used vi and (just a little) Chrome.

It's disappointing that the Maple GUI itself cannot do a much better job of recovery.

@Soldalma I believe that accepting an answer is done by clicking on the chalice/cup/goblet/grail image that appears in the right of the header (below the thumbs-up and star).

Make sure that you remove (just) those added lines from the file you edited under bin.X86_64_WINDOWS.

@Soldalma When you copied the file from bin.xxx to homedir location you kept other lines in it? The file "C:\Users\Fernando\maple.ini" should contain only valid Maple commands. It sounds to me as if you have inadvertantly copied over some preferences file.

I suggest leaving all files under bin.xxx alone, and never edited. Have the file "C:\Users\Fernando\maple.ini" contain only valid maple commands, such as the ones you wanted. Those line are read as 1D Maple Notation commands and should end in a semicolon (if you want the results echoed) or a colon (if you want them executed silently).

@kle8309 While the goal of "easy ways to use units" is important, the Units:-Natural subpackage was not a great idea. When loaded it simply takes away far too many common names and symbols from other uses.

But you can still use convert(..,units,..) in the following way for this example, with Units:-Natural loaded.

restart:
with(Units:-Natural):
convert( Unit(m^2*kg/(s^4*A)), units, :-`/`(V,us));
convert( Unit(m^2*kg/(s^4*A)), units, 'V/us');

@maple fan In this case "hybrid" means a hybrid of both hardware and software floating-point precision, not a hybrid of numeric and symbolic methods.

First 351 352 353 354 355 356 357 Last Page 353 of 599