[Date Index]
[Thread Index]
[Author Index]
Re: Re: odd mathematica blindspot
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: Converting a mapping into a well-defined function**
Next by Date:
** Re: Converting a mapping into a well-defined function**
Previous by thread:
**Re: odd mathematica blindspot**
Next by thread:
**Re: Re: Re: odd mathematica blindspot**
| |