dharr

Dr. David Harrington

7720 Reputation

22 Badges

20 years, 238 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@PeterTang To find the directory of a (previously saved) worksheet from the worksheet, use 

interface(worksheetdir)

 

@Carl Love Lucky eyeball!

@vs140580 It is a good general rule that data for processing numerically not differ by too many orders of magnitude from one. So scale independent or dependent data until it is all like this. This is what I did in your case - after scaling all columns had data of similar magnitude, with most values around 1-10.

You say C1 cannot be zero, but it was calculated as zero because of the numerical issue. After scaling, it was evident that it was not zero.

@William Han Sorry for the misleading answer. Here is one way to do it, another variation of the replies from the others.

Research.mw

@toran You can adapt into an algorithm, but it is always best to look at things.

restart

P := x^12*y^3+10*x^11*y^4+43*x^10*y^5+105*x^9*y^6+161*x^8*y^7+161*x^7*y^8+105*x^6*y^9+43*x^5*y^10+10*x^4*y^11+x^3*y^12-x^12*y^2-8*x^11*y^3-17*x^10*y^4+8*x^9*y^5+82*x^8*y^6+128*x^7*y^7+82*x^6*y^8+8*x^5*y^9-17*x^4*y^10-8*x^3*y^11-x^2*y^12-x^12*y-4*x^11*y^2-62*x^10*y^3-341*x^9*y^4-902*x^8*y^5-1410*x^7*y^6-1410*x^6*y^7-902*x^5*y^8-341*x^4*y^9-62*x^3*y^10-4*x^2*y^11-x*y^12+x^12-8*x^11*y-62*x^10*y^2-680*x^9*y^3-3169*x^8*y^4-7312*x^7*y^5-9540*x^6*y^6-7312*x^5*y^7-3169*x^4*y^8-680*x^3*y^9-62*x^2*y^10-8*x*y^11+y^12+10*x^11-17*x^10*y-341*x^9*y^2-3169*x^8*y^3-11838*x^7*y^4-21793*x^6*y^5-21793*x^5*y^6-11838*x^4*y^7-3169*x^3*y^8-341*x^2*y^9-17*x*y^10+10*y^11+43*x^10+8*x^9*y-902*x^8*y^2-7312*x^7*y^3-21793*x^6*y^4-30696*x^5*y^5-21793*x^4*y^6-7312*x^3*y^7-902*x^2*y^8+8*x*y^9+43*y^10+105*x^9+82*x^8*y-1410*x^7*y^2-9540*x^6*y^3-21793*x^5*y^4-21793*x^4*y^5-9540*x^3*y^6-1410*x^2*y^7+82*x*y^8+105*y^9+161*x^8+128*x^7*y-1410*x^6*y^2-7312*x^5*y^3-11838*x^4*y^4-7312*x^3*y^5-1410*x^2*y^6+128*x*y^7+161*y^8+161*x^7+82*x^6*y-902*x^5*y^2-3169*x^4*y^3-3169*x^3*y^4-902*x^2*y^5+82*x*y^6+161*y^7+105*x^6+8*x^5*y-341*x^4*y^2-680*x^3*y^3-341*x^2*y^4+8*x*y^5+105*y^6+43*x^5-17*x^4*y-62*x^3*y^2-62*x^2*y^3-17*x*y^4+43*y^5+10*x^4-8*x^3*y-4*x^2*y^2-8*x*y^3+10*y^4+x^3-x^2*y-x*y^2+y^3

plots:-implicitplot(P, x = -1 .. 2, y = -1 .. 2)

xval := {x = .5}

{x = .5}

yval := {y = fsolve(eval(P, xval), y = 0 .. .5)}

{y = .1478226028}

Check these values are a pair of roots.

eval(P, `union`(xval, yval))

0.225e-8

 

Download bivariate2.mw

@toran Use implicitplot to look at your function in the region you are interested in - you can see where the roots are. Then choose an x value and find the corresponding y by something like

fsolve(eval(P,x=1.0),y=0..2)

where the y range is where you can see there is a root. (These values would work for the above plot)

If it is an isolated root you want, then algcurves:-singularities may be needed.

Perhaps if you supply the polynomial here, you can get more specific advice.

@nicolesharp100 As a shortcut you can use %,%%, and %%% to refer to the last result (in time), 2nd to last and third-to-last. I use them within an execution group but not across execution groups, to avoid confusing results in time with results by location. I think they work on the command line.

@nicolesharp100 I don't know how to do this. I rarely use eqn numbers (in fact my default is not to show them). But I just put every result in a variable, and that is how I refer to them in the next execution group.

@nicolesharp100 Try this

Download Lines.mw

The result should be this:

LinesAfter.mw

Otherwise, I'm not sure I understand.

@nicolesharp100 To refer to a previous line number use ctrl-L. Then the automatic renumbering should work correctly. 

@nicolesharp100 Maple's StringTools package can do quite sophisticated substitutions based on pattern matching but here Subs (substitute all) and Substitute (substitute the first) will do the trick.

restart;

with(StringTools):

str:="f(x,y):=sin(x)*cos(y);";

"f(x,y):=sin(x)*cos(y);"

str2:=Substitute(Subs([":=" = "->"],str), "(", ":=(" );

"f:=(x,y)->sin(x)*cos(y);"

parse(str2);

proc (x, y) options operator, arrow; sin(x)*cos(y) end proc

NULL

Download MaxMaple.mw

@nicolesharp100 f(x,y):=x*y is an alternative way to enter an operator definition. The f:=(x,y)->x*y; (which I prefer) emphasizes that you are storing a procedure in the variable f; f:=proc(x,y) x*y end proc; does the same thing. If you use the arrow notation (also used in math), then f(0,0):=1 is used to set (in a remember table) a specific value for arguments (0,0).

You seem to have asked a similar question here.

@acer Yes, I saw that; I said "as documented" in my question. My point is I'm not sure why it is designed that way. Functionally, if I make a Matrix with fill=6 and assign some values with an initializer or by later assigning values, I use that Matrix knowing all the others values I retrieve will be 6. Now I decide I only have a few values to assign, so I think I'll change to storage = sparse. So now I would think it can functionally work the same; the fill value is just stored once and returned when I request an unstored value. It seems strange I now have to write a custom indexing function for a situation that is not that different. In fact the default fill value of zero works in just this way for sparse storage; it just can't be changed to some other value. 

For backward compatibility, I'm sure modifying the way fill works is a bad idea, but I think some way to change the default fill value to other than zero would be useful.

@mmcdara Yes, you understood correctly.

First 38 39 40 41 42 43 44 Last Page 40 of 78