Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Re: odd mathematica blindspot


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
> 
>


  • Prev by Date: Re: Re: Re: odd mathematica blindspot
  • Next by Date: Re: Working with huge text files with mathematica
  • Previous by thread: Re: Re: Re: odd mathematica blindspot
  • Next by thread: Re: odd mathematica blindspot