precission/accuracy in mathlink for excel
- To: mathgroup at smc.vnet.net
- Subject: [mg53332] precission/accuracy in mathlink for excel
- From: "plizak" <plizak at gmail.com>
- Date: Thu, 6 Jan 2005 02:52:13 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I have some code running in a spreadsheet on a M-code worksheet in excel. I can call the code in either a VBA macro or in a cell, but it only returns four digits of accuracy. Yet when I run it in a notebook in Mathematica I get more precision. Is there a way to get more precision? Here's what I've been doing... In Excel I use =Math("mainModule[ 5, {38357, 60, 10000000, 100, 40183, 442600., 1000, 0.05, 0.1, 1}, {10, 20, 30, 40, 50}, {0.4, 0.4, 0.4, 0.4, 0.4} ]") and the output is {212500., 630400., 417800., 0.02126, 150.9} In Mathematica notebook I use mainModule[ 5, {38357, 60, 10000000, 100, 40183, 442600., 1000, 0.05, 0.1, 1}, {10, 20, 30, 40, 50}, {0.4, 0.4, 0.4, 0.4, 0.4} ] and the output is {212553., 630363., 417810., 0.0212553, 150.873} alternatively I can enter result = Application.Run("Mathematica", "mainModule", _ ActiveWorkbook.Sheets("Input Screen").Range("B17"), _ ActiveWorkbook.Sheets("Input Screen").Range("B7:B16"), _ ActiveWorkbook.Sheets("Input Screen").Range("B21:B25"), _ ActiveWorkbook.Sheets("Input Screen").Range("C21:C25")) result = Application.Run("Mathematica", "N[ mainModule[ N[#1], N[#2], N[#3], N[#4] ] ]", _ ActiveWorkbook.Sheets("Input Screen").Range("B17"), _ ActiveWorkbook.Sheets("Input Screen").Range("B7:B16"), _ ActiveWorkbook.Sheets("Input Screen").Range("B21:B25"), _ ActiveWorkbook.Sheets("Input Screen").Range("C21:C25")) in a macro and get the same results as if it were directly in an excel spreadsheet, {212500., 630400., 417800., 0.02126, 150.9}. Thanks for any help in advance! Peter