Ask Your Question
1

Use assume() on find_fit

asked 2012-06-21 09:24:13 -0600

god.one gravatar image

Hi everyone,

does anyone know how I can use assumptions with find_fit? A minimal example would be

var('a,b,x')
assume(a>0,b>0)
find_fit([(2,2),(3,2.9),(4,4.1)],(a+1)/b*x,variables=[x],initial_guess=(-2,-2))

and the output is

[a == -105.66654155674746, b == -104.30685450333799]

Any help or hint on where to find a solution is appriciated. Thanks in advance.

edit retag flag offensive close merge delete

Comments

Considering that `find_fit` uses Scipy and assumptions are in Maxima, I think it's quite unlikely that this would do much. I guess we could try to run them through assumptions, though this might slow it down appreciably.

kcrisman gravatar imagekcrisman ( 2012-06-21 09:44:24 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2012-06-22 17:28:06 -0600

benjaminfjones gravatar image

You could fake it like this:

find_fit([(2,2),(3,2.9),(4,4.1)],(abs(a)+1)/abs(b)*x,variables=[x],initial_guess=(-2,-2))

So the best fit values of a,b are negative, but their absolute values are a "good fit" in your model.

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

1 follower

Stats

Asked: 2012-06-21 09:24:13 -0600

Seen: 126 times

Last updated: Jun 22 '12