Ask Your Question
2

using sage functions with data from octave

asked 2011-06-27 10:28:39 -0500

jamlatino gravatar image

updated 2020-05-24 02:13:34 -0500

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 09:30:22 -0500 )edit

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

Juanlu001 gravatar imageJuanlu001 ( 2011-06-28 09:36:33 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2020-05-24 16:39:56 -0500

dsejas gravatar image

updated 2020-05-24 16:40:45 -0500

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 10:28:39 -0500

Seen: 225 times

Last updated: May 24