Ask Your Question
2

using sage functions with data from octave

asked 2011-06-27 17:28:39 +0200

jamlatino gravatar image

updated 2020-05-24 09:13:34 +0200

FrédéricC gravatar image

Hello, I´m trying to construct a histogram using octave within sage, but I don´t know how to use sage functions with data that comes from octave, here´s what I´m doing:

a = octave.normrnd(50,3,100,1) #this generates a column vector with normal random data
b = octave.hist(a) #this generates a histogram from the previous data

bar_chart(b)  # this is where I get the following error:

NotImplementedError: Unable to parse output

Is this something that has not been implemented as the message suggests or am I doing something wrong?

edit retag flag offensive close merge delete

Comments

Did you mean `b = octave_hist(a)`?

Juanlu001 gravatar imageJuanlu001 ( 2011-06-28 16:30:22 +0200 )edit

Good question, though. I tried `b.sage()`, but also raised a NotImplementedError

Juanlu001 gravatar imageJuanlu001 ( 2011-06-28 16:36:33 +0200 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2020-05-24 23:39:56 +0200

dsejas gravatar image

updated 2020-05-24 23:40:45 +0200

Hello, @jamlatino! I had success with the following code:

a = octave.normrnd(50,3,100,1)
b = octave.hist(a)

bar_chart(b.sage()) # first convert the Octave object into a Sage object, and then plot

The idea behind this code is simple: When you create an Octave object, you cannot operate it with pure-Sage functions, so you have to transform the object to Sage representation first. That is what the sage() method does.

This is what I get in a particular run:

image description

(Other software interfaces Sage defines, like maxima, GAP, etc. should have a sage() method too, for this same purpose.)

I hope this helps!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-06-27 17:28:39 +0200

Seen: 388 times

Last updated: May 24 '20