Re: Re: Re: odd mathematica blindspot

*To*: mathgroup at smc.vnet.net*Subject*: [mg56580] Re: [mg56547] Re: [mg56472] Re: [mg56468] odd mathematica blindspot*From*: yehuda ben-shimol <bsyehuda at gmail.com>*Date*: Fri, 29 Apr 2005 03:21:02 -0400 (EDT)*References*: <200504260533.BAA14442@smc.vnet.net> <200504270152.VAA01634@smc.vnet.net> <200504280640.CAA24717@smc.vnet.net>*Reply-to*: yehuda ben-shimol <bsyehuda at gmail.com>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, In Solve[a^x==b,x] with a and b symbols you get an exact symbolic solution This will also be with your function definition for sol sol[a_,b_]:=Solve[a^x==b,x] if you call it with symbols sol[a,b] you will get the same solution. As for the numerical example of mixing exact representation of (9999999999/10000000000) together with 0.5 and it implication, well this was already answered on previos posts. As in any other programming environments you need to get used to Mathematica's convention and use it correctly in order to get along. yy[[0]] means the HEAD of yy which is List. so yy[[0]]{x} means List[Times[List,x]] which makes no sense you may see it by yy[[0]]{x} // FullForm In order to get the values you can always type something like {x,y}/.yy or {x,y}/.yy[[1]] for the first result you can do assignment as well with {a,b}={x,y}/.y[[1]] This is actually a double assignment. a will be assigned the value 1 and b will be assigned the value 1 yehuda On 4/28/05, Edward Peschko <esp5 at pge.com> wrote: > On Tue, Apr 26, 2005 at 09:52:28PM -0400, yehuda ben-shimol wrote: > > Hi, > > First Mathematica solves it with no problem. I wonder which version > > you are using. I tested it on ver. 5.1 on Win XP. > > Second, the (rather simple) problem is > > Solve[a^x==b,x] will return > > {{x->Log[b]/Log[a]}} > > so if you assign > > sol = Solve[a^x==b,x]; > > you can check it for many values of a and b which in your case will lead to > > sol={{x->-Log[2]/Log[(999999999999/10000000000000)]}} > > to extract this value you need to use replacement rules > > x/. sol[[1]] will give you the number > > x/.sol will give you the number as a list of a single element. > > .... because the problem is so simple, that's why its a blindspot > in mathematica IMO. > > Anyways, I tried it again - > > Mathematica 5.1 for Linux > Copyright 1988-2004 Wolfram Research, Inc. > -- Terminal graphics initialized -- > > In[1]:= Off[Solve::ifun]; > > In[2]:= sol[a_, b_] := Solve[a^x == b, x] > > In[3]:= sol[(9999999999/10000000000), .5] > > Out[3]= {] > > In[4]:= sol[5,15]; > > {{ x -> Log[15]/Log[5] }} > > The really odd thing is that it doesn't come up with a *symbolic* solution, > it just says that none exists. Perhaps it is evaluating (9.../10....) as one, > and hence triggering Solve to make the problem insoluble. > > Perhaps there's an issue of precision? However, FindRoot works perfectly fine > on the same expression, so its a bit strange. > > btw - the notation for extraction of elements is rather.. odd. Is it basically an > array of array of arrays? I would expect: > > yy = {{ x -> 1, y -> 1}, { x -> 2, y -> 2 }} > > to be accessed via: > > yy[[0]]{x} > > and the keys of the solution to be accessed by: > > keys(yy[[0]]) > > or somesuch. > > Is there a good tutorial somewhere on the use of datastructures in mathematica? > sort of a pocketguide on getting around? > > Ed > >

**References**:**odd mathematica blindspot***From:*Edward Peschko <esp5@pge.com>

**Re: odd mathematica blindspot***From:*yehuda ben-shimol <bsyehuda@gmail.com>

**Re: Re: odd mathematica blindspot***From:*Edward Peschko <esp5@pge.com>