COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### New to Mathematica

• Follow

```Hi,

I only need it for one thing (as yet, anyway), and I wonder whether
someone can help me in step-by-step fashion to get what I want. I need
the solution to the following (I might make amendments to the values):

"For any integer k, let r(k) be x such that

(x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)

product (k = 0 to 3000) (1-1/r(k))"

```
 0
Reply jack.j.jepper (42) 5/3/2012 8:40:36 AM

```On May 3, 9:40 am, "J.Jack.J." <jack.j.jep...@googlemail.com> wrote:
> Hi,
>
>  I only need it for one thing (as yet, anyway), and I wonder whether
> someone can help me in step-by-step fashion to get what I want. I need
> the solution to the following (I might make amendments to the values):
>
> "For any integer k, let r(k) be x such that
>
> (x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)
>
> product (k = 0 to 3000) (1-1/r(k))"
>
> With many thanks in advance.

Can nobody help me with this? Just for a Newbie?
As most will realise, the first lines define my function and the
product (k = 0 to 3000) (1-1/r(k))
is my desired calculation. I need to know what inputs to use.

```
 0
Reply jack.j.jepper (42) 5/5/2012 8:16:45 AM

```First, perhaps folks were reluctant to respond because this looked like
it could be a homework exercise.

Second, you don't even have proper Mathematica syntax in your equation
relating x and k. Did you even try to read the documentation to learn
the very basics? For example, proper syntax for the equation would be:

(x/Log[x]) (1 + 1/Log[x]) == 108.2 + k

Function arguments must be enclosed in brackets, not parentheses, and
the equality is a doubled "=" sign. Moreover, your original expression

Third, the equation itself looks really nasty. Aside from the fact that
it mixes exact formulas with an approximate real (108.2), the left-hand
side is transcendental.

Fourth, the equation does not seem to uniquely define x as a function of
k! For example, form the difference between the two sides...

f[x_] := (x/Log[x]) (1 + 1/Log[x]) - 108.2 - k

.... and plot f for, say, k = 2:

Plot[Evaluate[f[x] /. k -> 2], {x, 0.5, 2}, Exclusions -> {x == 1},
AxesOrigin -> {0, 0}, PlotRange -> {-5, 5}]

The graph crosses the x-axis twice. And indeed, if you use FindRoot with
initial guesses above and below 1, you'll see that this is so:

FindRoot[Evaluate[f[x] /. k -> 2], {x, 0.9}]
{x -> 0.916554}

FindRoot[Evaluate[f[x] /. k -> 2], {x, 1.1}]
{x -> 1.11137}

On 5/5/12 4:14 AM, J.Jack.J. wrote:
> On May 3, 9:40 am, "J.Jack.J."<jack.j.jep...@googlemail.com>  wrote:
>> Hi,
>>
>>   I only need it for one thing (as yet, anyway), and I wonder whether
>> someone can help me in step-by-step fashion to get what I want. I need
>> the solution to the following (I might make amendments to the values):
>>
>> "For any integer k, let r(k) be x such that
>>
>> (x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)
>>
>> product (k = 0 to 3000) (1-1/r(k))"
>>
>> With many thanks in advance.
>
> Can nobody help me with this? Just for a Newbie?
> As most will realise, the first lines define my function and the
> product (k = 0 to 3000) (1-1/r(k))
> is my desired calculation. I need to know what inputs to use.
>
>

--
Murray Eisenberg                     murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

```
 0
Reply murray (1862) 5/6/2012 7:24:06 AM

```On 05/05/2012 09:16, J.Jack.J. wrote:
> On May 3, 9:40 am, "J.Jack.J."<jack.j.jep...@googlemail.com>  wrote:
>> Hi,
>>
>>   I only need it for one thing (as yet, anyway), and I wonder whether
>> someone can help me in step-by-step fashion to get what I want. I need
>> the solution to the following (I might make amendments to the values):
>>
>> "For any integer k, let r(k) be x such that
>>
>> (x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)
>>
>> product (k = 0 to 3000) (1-1/r(k))"
>>
>> With many thanks in advance.
>
> Can nobody help me with this? Just for a Newbie?
> As most will realise, the first lines define my function and the
> product (k = 0 to 3000) (1-1/r(k))
> is my desired calculation. I need to know what inputs to use.
>
>

If you press F1, you will enter the help system. Once there, you could
try looking up log and product. The examples will give you the basics of
Mathematica syntax, and you can cut and paste them into your notebook,
and alter them as desired.

David Bailey
http://www.dbaileyconsultancy.co.uk

```
 0
Reply dave2659 (507) 5/6/2012 7:25:38 AM

```Thanks for replying. Responses embedded:

On May 6, 8:24 am, Murray Eisenberg <mur...@math.umass.edu> wrote:
> First, perhaps folks were reluctant to respond because this looked like
> it could be a homework exercise.
>
> Second, you don't even have proper Mathematica syntax in your equation
> relating x and k. Did you even try to read the documentation to learn
> the very basics?

I tried and tried for hours but couldn't so much as find any section
that would even tell me how to write the condition that k be an
integer.

For example, proper syntax for the equation would be:
>
>    (x/Log[x]) (1 + 1/Log[x]) == 108.2 + k
>
> Function arguments must be enclosed in brackets, not parentheses, and
> the equality is a doubled "=" sign. Moreover, your original expression
> had an unbalanced terminal parenthesis.
>

Thanks.

> Third, the equation itself looks really nasty. Aside from the fact that
> it mixes exact formulas with an approximate real (108.2), the left-hand
> side is transcendental.
>
> Fourth, the equation does not seem to uniquely define x as a function of
> k! For example, form the difference between the two sides...
>
>    f[x_] := (x/Log[x]) (1 + 1/Log[x]) - 108.2 - k
>
> ... and plot f for, say, k = 2:
>
>    Plot[Evaluate[f[x] /. k -> 2], {x, 0.5, 2}, Exclusions -> {x ==
= 1},
>   AxesOrigin -> {0, 0}, PlotRange -> {-5, 5}]
>
> The graph crosses the x-axis twice. And indeed, if you use FindRoot with
> initial guesses above and below 1, you'll see that this is so:
>
>     FindRoot[Evaluate[f[x] /. k -> 2], {x, 0.9}]
> {x -> 0.916554}
>
>     FindRoot[Evaluate[f[x] /. k -> 2], {x, 1.1}]
> {x -> 1.11137}
>

Am sorry, I should have said "let r(k) be the highest x such that..."

Can you give me the required inputs? That would help me immensely.

```
 0
Reply jack.j.jepper (42) 5/7/2012 12:30:13 AM

```On May 6, 8:25 am, David Bailey <d...@removedbailey.co.uk> wrote:
> On 05/05/2012 09:16, J.Jack.J. wrote:
>
>
>
>
>
>
>
>
>
> > On May 3, 9:40 am, "J.Jack.J."<jack.j.jep...@googlemail.com>  wrote:
> >> Hi,
>
> >>   I have just downloaded my free trial version of Mathematica.
> >>   I only need it for one thing (as yet, anyway), and I wonder whethe=
r
> >> someone can help me in step-by-step fashion to get what I want. I need
> >> the solution to the following (I might make amendments to the values):
>
> >> "For any integer k, let r(k) be x such that
>
> >> (x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)
>
> >> product (k = 0 to 3000) (1-1/r(k))"
>
> >> With many thanks in advance.
>
> > Can nobody help me with this? Just for a Newbie?
> > As most will realise, the first lines define my function and the
> > product (k = 0 to 3000) (1-1/r(k))
> > is my desired calculation. I need to know what inputs to use.
>
> > With thanks in advance.
>
> If you press F1, you will enter the help system. Once there, you could
> try looking up log and product. The examples will give you the basics of
> Mathematica syntax, and you can cut and paste them into your notebook,
> and alter them as desired.
>
> David Baileyhttp://www.dbaileyconsultancy.co.uk

Have tried and failed, tried and failed, with this method! Can
somebody give me the requisite inputs? Note that I need to add the
condition that x be the highest integer for which <definition of
r(k)>.

With thanks.

```
 0
Reply jack.j.jepper (42) 5/7/2012 12:30:43 AM

```On Mon, 07 May 2012 01:30:43 +0100, J.Jack.J.

> On May 6, 8:25 am, David Bailey <d...@removedbailey.co.uk> wrote:
>> On 05/05/2012 09:16, J.Jack.J. wrote:
>>
>> > On May 3, 9:40 am, "J.Jack.J."<jack.j.jep...@googlemail.com>  wrote:
>> >> Hi,
>>
>> >>   I have just downloaded my free trial version of Mathematica.
>> >>   I only need it for one thing (as yet, anyway), and I wonder whether
>> >> someone can help me in step-by-step fashion to get what I want. I
>> need
>> >> the solution to the following (I might make amendments to the
>> values):
>>
>> >> "For any integer k, let r(k) be x such that
>>
>> >> (x/ln(x))*(1 + 1/ln(x)) = 108.2 + k)
>>
>> >> product (k = 0 to 3000) (1-1/r(k))"
>>
>> >> With many thanks in advance.
>>
>> > Can nobody help me with this? Just for a Newbie?
>> > As most will realise, the first lines define my function and the
>> > product (k = 0 to 3000) (1-1/r(k))
>> > is my desired calculation. I need to know what inputs to use.
>>
>> > With thanks in advance.
>>
>> If you press F1, you will enter the help system. Once there, you could
>> try looking up log and product. The examples will give you the basics of
>> Mathematica syntax, and you can cut and paste them into your notebook,
>> and alter them as desired.
>>
>> David Baileyhttp://www.dbaileyconsultancy.co.uk
>
>
> Have tried and failed, tried and failed, with this method! Can
> somebody give me the requisite inputs? Note that I need to add the
> condition that x be the highest integer for which <definition of
> r(k)>.
>
> With thanks.
>

Just give up. There is no such integer x for any integer k between 0 and
3000 inclusive, and Mathematica can prove it:

Exists[
x, x \[Element] Integers,
(x/Log[x]) (1 + 1/Log[x]) == 541/5 + k &&
k \[Element] Integers &&
0 <= k <= 3000
] // Resolve

False

However, your problem was not well stated from the beginning, so I doubt
if you really meant what you wrote above. Here is one of the 3^3001
possible solutions (type this into Mathematica; it is an absurdly large
number, too big to post here) to your problem consistent with the
definition of r(k) originally given, and with the additional assumption
that r(k) is the largest *real* x such that (x/Log[x]) (1 + 1/Log[x]) ==
541/5 + k:

r[k_?NumericQ] := Block[{x},
x /. FindRoot[
(x/Log[x]) (1 + 1/Log[x]) == 541/5 + k,
{x, 5}, WorkingPrecision -> \$MachinePrecision
]
];

Product[1 - 1/r[k], {k, 0, 3000}]

0.6308341356354897

I don't know if you will be able to find a closed form for this, but if an
approximation good to 100 places will do, you could use the second root of:

0 == -70 - 13047 x + 9183 x^2 - 5019 x^3 + 35491 x^4 - 3680 x^5 -
14978 x^6 + 6707 x^7 + 28462 x^8 + 9675 x^9 + 30267 x^10 +
19638 x^11 + 3179 x^12 + 15750 x^13 - 21197 x^14 - 5200 x^15 +
37078 x^16 - 4243 x^17 + 10128 x^18 - 15288 x^19 + 27082 x^20

```
 0

```OK I have got my answer now.

```
 0
Reply jack.j.jepper (42) 5/8/2012 8:09:00 AM

```Please start over and carefully rewrite your question, stating exactly
what you are trying to calculate. Take the trouble to use clear
language. When you do so, I and others here will be glad to help if we
can.

If you have more general questions about how to tell Mathematica to
produce what you want, please also state them clearly, so that some of
us can help.

For better or worse, learning how to use Mathematica is a significant
job. Do as much studying as possible on your own, then if you are
really stumped, ask for help with a specific difficulty.

Ralph

On Sun, May 6, 2012 at 8:29 PM, J.Jack.J. <jack.j.jepper@googlemail.com> wrote:
> On May 6, 8:25 am, David Bailey <d...@removedbailey.co.uk> wrote:
>> On 05/05/2012 09:16, J.Jack.J. wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > On May 3, 9:40 am, "J.Jack.J."<jack.j.jep...@googlemail.com>  wrote:
>> >> Hi,
>>
>> >>   I have just downloaded my free trial version of Mathematica.
>> >>   I only need it for one thing (as yet, anyway), and I wonder whether
>> >> someone can help me in step-by-step fashion to get what I want. I need
>> >> the solution to the following (I might make amendments to the values):
>>
>> >> "For any integer k, let r(k) be x such that
>>
>> >> (x/ln(x))*(1 + 1/ln(x)) == 108.2 + k)
>>
>> >> product (k == 0 to 3000) (1-1/r(k))"
>>
>> >> With many thanks in advance.
>>
>> > Can nobody help me with this? Just for a Newbie?
>> > As most will realise, the first lines define my function and the
>> > product (k == 0 to 3000) (1-1/r(k))
>> > is my desired calculation. I need to know what inputs to use.
>>
>> > With thanks in advance.
>>
>> If you press F1, you will enter the help system. Once there, you could
>> try looking up log and product. The examples will give you the basics of
>> Mathematica syntax, and you can cut and paste them into your notebook,
>> and alter them as desired.
>>
>> David Baileyhttp://www.dbaileyconsultancy.co.uk
>
>
> Have tried and failed, tried and failed, with this method! Can
> somebody give me the requisite inputs? Note that I need to add the
> condition that x be the highest integer for which <definition of
> r(k)>.
>
> With thanks.
>

```
 0
Reply ralph.dratman (64) 5/8/2012 8:12:03 AM

```Build one step at a time.

For a given value of k (say k=2) use exact values (i.e., 1082/10
rather than 108.2) and restrict the domain of Solve to Reals

With[{k = 2}, Solve[(x/Log[x]) (1 + 1/Log[x]) == 1082/10 + k,
x, Reals]]

{{x -> Root[{-551 Log[#1]^2 + 5 #1 + 5 Log[#1] #1 &,
0.91655356819195758220}]}, {x ->
Root[{-551 Log[#1]^2 + 5 #1 + 5 Log[#1] #1 &,
1.11136974029598568569}]}, {x ->
Root[{-551 Log[#1]^2 + 5 #1 + 5 Log[#1] #1 &, 611.73540466624378639}]}}

Use N to convert Root objects to their values (last entry in Root object)

With[{k = 2}, Solve[
(x/Log[x]) (1 + 1/Log[x]) == 1082/10 + k,
x, Reals] // N]

{{x -> 0.916554}, {x -> 1.11137}, {x -> 611.735}}

Use ReplaceAll to extract values from rules

With[{k = 2}, x /. Solve[
(x/Log[x]) (1 + 1/Log[x]) == 1082/10 + k,
x, Reals] // N]

{0.916554, 1.11137, 611.735}

Use Part, Last, or Max to extract largest value

With[{k = 2}, x /. Solve[
(x/Log[x]) (1 + 1/Log[x]) == 1082/10 + k,
x, Reals][[-1]] // N]

611.735

Convert to a function of k with k restricted to Integers

r[k_Integer] := x /. Solve[
(x/Log[x]) (1 + 1/Log[x]) == 1082/10 + k,
x, Reals][[-1]] // N

r[2]

611.735

Plot of r

ListPlot[{#, r[#]} & /@ Range[-20, 20, 4],
Frame -> True, Axes -> False]

Define your Product as a function of kmax

p[kmax_Integer] :=
Product[1 - 1/r[k], {k, 0, kmax}]

p[10]

0.982714

This is quite slow so calculation for large values of kmax will take
considerable time. Plot of p

ListPlot[{#, p[#]} & /@ Range[0, 20, 2],
Frame -> True, Axes -> False]

Bob Hanlon

On Sun, May 6, 2012 at 8:28 PM, J.Jack.J. <jack.j.jepper@googlemail.com> wr=
ote:
> Thanks for replying. Responses embedded:
>
>
> On May 6, 8:24 am, Murray Eisenberg <mur...@math.umass.edu> wrote:
>> First, perhaps folks were reluctant to respond because this looked like
>> it could be a homework exercise.
>>
>> Second, you don't even have proper Mathematica syntax in your equation
>> relating x and k. Did you even try to read the documentation to learn
>> the very basics?
>
> I tried and tried for hours but couldn't so much as find any section
> that would even tell me how to write the condition that k be an
> integer.
>
>  For example, proper syntax for the equation would be:
>>
>>    (x/Log[x]) (1 + 1/Log[x]) == 108.2 + k
>>
>> Function arguments must be enclosed in brackets, not parentheses, and
>> the equality is a doubled "=" sign. Moreover, your original expression
>> had an unbalanced terminal parenthesis.
>>
>
> Thanks.
>
>> Third, the equation itself looks really nasty. Aside from the fact that
>> it mixes exact formulas with an approximate real (108.2), the left-hand
>> side is transcendental.
>>
>> Fourth, the equation does not seem to uniquely define x as a function of
>> k! For example, form the difference between the two sides...
>>
>>    f[x_] := (x/Log[x]) (1 + 1/Log[x]) - 108.2 - k
>>
>> ... and plot f for, say, k = 2:
>>
>>    Plot[Evaluate[f[x] /. k -> 2], {x, 0.5, 2}, Exclusions -> {x ==
=
> = 1},
>>   AxesOrigin -> {0, 0}, PlotRange -> {-5, 5}]
>>
>> The graph crosses the x-axis twice. And indeed, if you use FindRoot with
>> initial guesses above and below 1, you'll see that this is so:
>>
>>     FindRoot[Evaluate[f[x] /. k -> 2], {x, 0.9}]
>> {x -> 0.916554}
>>
>>     FindRoot[Evaluate[f[x] /. k -> 2], {x, 1.1}]
>> {x -> 1.11137}
>>
>
> Am sorry, I should have said "let r(k) be the highest x such that..."
>
> Can you give me the required inputs? That would help me immensely.
>

```
 0
Reply hanlonr357 (712) 5/8/2012 8:15:07 AM

9 Replies
35 Views

5/20/2013 3:02:21 AM