Plotting two datasets in ListLinePlot gives errors?

Dear all,

I am quite angry because I got a lot of error messages already. What I want to do:

Plot a Brownian Motion with RandomFunction as described in the example (data=randomfunction[GeometricBrownianMotionPro
cess…] and apply ListLinePlot to it.

That works perfectly.

Now I want to add another function to the graph.
dataG=100/(1+.0275)^(30-Range[0,30,0.01])
was the list I created.
Unfortunately - even though I used as stepsize in the GBMProcess above 0.01 from 0 to 30 I got here a list from 1 to 3000. That doesn‘t fit. How to I get a process from 0 to 30 with the function above??

Once I take a range from 0 to 30 with stepsize 1 I don‘t get the first value 100/1.0275^30. I am looking forward to read where I did a mistake.
Kind regards,

Jotwie.

Please include your code and output using one of the methods explained in the rules: http://wolfr.am/READ-1ST

Hi there,

okay, sorry… this is my code:

data = RandomFunction[
  GeometricBrownianMotionProcess[.05, .25, 100], {0, 30, .01}]
dataG = 100/(1 + .0275)^(30 - Range[0, 30, .01]);
ListLinePlot[{data,dataG}, Filling -> Axis]

This provides an error. Any ideas??
Kind regards,

Jotwie

I am quite angry because …

No need for that, really! Your dataG just need to have step the same size and limits as data. Try e.g.:

data = RandomFunction[GeometricBrownianMotionProcess[.05, .25, 100], {0, 30, .01}];
dataG = Table[{x, 100/(1 + .0275)^(30 - x)}, {x, 0, 30, .01}];
ListLinePlot[{data, dataG}, Filling -> Axis, PlotRange -> All]

Danke. Das hat geklappt. Gruß nach Weilheim.

Dear all,

Another question related to this topic: how is it possible to take a value of the path generated by
data = RandomFunction[GeometricBrownianMotionProcess[.05, .25, 100], {0, 30, .01}];
Data[[2]] for example doesn‘t evaluate the path „data“ at time 2. How do I get the value of the process at time 2, i.e. the value of the path…??
Thank you,

Jotwie

Mathematica is case sensitive - you have defined data, so anything using Data will definitely not work.

The result from how data is defined, it has the header TemporalData. Here is what you can do with this:

data["Properties"]
(*  Out:     {"Components","DateList","DatePath","DatePaths","Dates","FirstDates",\
"FirstTimes","FirstValues","LastDates","LastTimes","LastValues",\
"Part","Path","PathComponent","PathComponents","PathCount",\
"PathDates","PathFunction","PathFunctions","PathLength","PathLengths",\
"Paths","PathTimes","SliceData","SliceDistribution","TimeList",\
"Times","ValueDimensions","ValueList","Values"}   *)

So - for example for getting all values you just write:

data["Path"]

or for the value at time t=2:

data["SliceData", 2]

or you have an interpolating function for any time value inside the respective interval:

data["PathFunction"][2.0001]

Liebe Gruesse – Henrik